MCPcopy Create free account
hub / github.com/CPChain/chain / updateP2pConfig

Function updateP2pConfig

cmd/cpchain/config.go:106–125  ·  view source on GitHub ↗
(ctx *cli.Context, cfg *p2p.Config)

Source from the content-addressed store, hash-verified

104}
105
106func updateP2pConfig(ctx *cli.Context, cfg *p2p.Config) {
107 // max peers
108 if ctx.IsSet(flags.MaxPeersFlagName) {
109 cfg.MaxPeers = ctx.Int(flags.MaxPeersFlagName)
110 }
111 // max pending peers
112 if ctx.IsSet(flags.MaxPendingPeersFlagName) {
113 cfg.MaxPendingPeers = ctx.Int(flags.MaxPendingPeersFlagName)
114 }
115 // port
116 if ctx.IsSet(flags.PortFlagName) {
117 cfg.ListenAddr = fmt.Sprintf(":%d", ctx.Int(flags.PortFlagName))
118 }
119
120 if isRunningChain {
121 updateBootstrapNodes(ctx, cfg)
122 updateValidatorNodes(ctx)
123 }
124 updateNodeKey(ctx, cfg)
125}
126
127// updateBootstrapNodes creates a list of bootstrap nodes from the command line
128// flags, reverting to pre-configured ones if none have been specified.

Callers 1

updateNodeConfigFunction · 0.85

Calls 3

updateBootstrapNodesFunction · 0.85
updateValidatorNodesFunction · 0.85
updateNodeKeyFunction · 0.85

Tested by

no test coverage detected