-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
p2p_v1_config.go
33 lines (27 loc) · 942 Bytes
/
p2p_v1_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
package configtest
import (
"time"
"github.com/smartcontractkit/chainlink/core/config"
)
var _ config.P2PV1Networking = &TestGeneralConfig{}
// P2PListenPort returns the overridden value, if one exists.
func (c *TestGeneralConfig) P2PListenPort() uint16 {
if c.Overrides.P2PListenPort.Valid {
return uint16(c.Overrides.P2PListenPort.Int64)
}
return 12345
}
// P2PBootstrapPeers returns the overridden value, if one exists.
func (c *TestGeneralConfig) P2PBootstrapPeers() ([]string, error) {
if c.Overrides.P2PBootstrapPeers != nil {
return c.Overrides.P2PBootstrapPeers, nil
}
return c.GeneralConfig.P2PBootstrapPeers()
}
// P2PBootstrapCheckInterval returns the overridden value, if one exists.
func (c *TestGeneralConfig) P2PBootstrapCheckInterval() time.Duration {
if c.Overrides.P2PBootstrapCheckInterval != nil {
return *c.Overrides.P2PBootstrapCheckInterval
}
return c.GeneralConfig.P2PBootstrapCheckInterval()
}