-
Notifications
You must be signed in to change notification settings - Fork 670
/
config.go
60 lines (45 loc) · 1.63 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
// Copyright (C) 2019-2021, 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/validators"
)
// Config wraps the common configurations that are needed by a Snow consensus
// engine
type Config struct {
Ctx *snow.ConsensusContext
Validators validators.Set
Beacons validators.Set
SampleK int
StartupAlpha uint64
Alpha uint64
Sender Sender
Bootstrapable Bootstrapable
Subnet Subnet
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.GetState() == 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
}