-
Notifications
You must be signed in to change notification settings - Fork 672
/
test_config.go
40 lines (34 loc) · 1.3 KB
/
test_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
// Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package common
import (
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/snow/engine/common/tracker"
"github.com/ava-labs/avalanchego/snow/validators"
)
// DefaultConfigTest returns a test configuration
func DefaultConfigTest() Config {
isBootstrapped := false
subnet := &SubnetTest{
IsBootstrappedF: func() bool { return isBootstrapped },
BootstrappedF: func(ids.ID) { isBootstrapped = true },
}
beacons := validators.NewSet()
connectedPeers := tracker.NewPeers()
startupTracker := tracker.NewStartup(connectedPeers, 0)
beacons.RegisterCallbackListener(startupTracker)
return Config{
Ctx: snow.DefaultConsensusContextTest(),
Validators: validators.NewSet(),
Beacons: beacons,
StartupTracker: startupTracker,
Sender: &SenderTest{},
Bootstrapable: &BootstrapableTest{},
Subnet: subnet,
Timer: &TimerTest{},
AncestorsMaxContainersSent: 2000,
AncestorsMaxContainersReceived: 2000,
SharedCfg: &SharedConfig{},
}
}