-
Notifications
You must be signed in to change notification settings - Fork 672
/
config.go
64 lines (49 loc) · 1.7 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package common
import (
"time"
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/snow/engine/common/tracker"
"github.com/ava-labs/avalanchego/snow/validators"
)
// Config wraps the common configurations that are needed by a Snow consensus
// engine
type Config struct {
Ctx *snow.ConsensusContext
Beacons validators.Set
SampleK int
Alpha uint64
StartupTracker tracker.Startup
Sender Sender
Bootstrapable Bootstrapable
BootstrapTracker BootstrapTracker
Timer Timer
// Should Bootstrap be retried
RetryBootstrap bool
// Max number of times to retry bootstrap before warning the node operator
RetryBootstrapWarnFrequency int
// Max time to spend fetching a container and its ancestors when responding
// to a GetAncestors
MaxTimeGetAncestors time.Duration
// Max number of containers in an ancestors message sent by this node.
AncestorsMaxContainersSent int
// This node will only consider the first [AncestorsMaxContainersReceived]
// containers in an ancestors message it receives.
AncestorsMaxContainersReceived int
SharedCfg *SharedConfig
}
func (c *Config) Context() *snow.ConsensusContext {
return c.Ctx
}
// IsBootstrapped returns true iff this chain is done bootstrapping
func (c *Config) IsBootstrapped() bool {
return c.Ctx.State.Get().State == snow.NormalOp
}
// Shared among common.bootstrapper and snowman/avalanche bootstrapper
type SharedConfig struct {
// Tracks the last requestID that was used in a request
RequestID uint32
// True if RestartBootstrap has been called at least once
Restarted bool
}