updated type conversion point to simplify - tested flag and no-flag (default) settings

This commit is contained in:
Alex 2023-02-07 20:43:03 -08:00
parent f6903b4f57
commit 5496007cba
4 changed files with 5 additions and 5 deletions

View file

@ -758,7 +758,7 @@ var (
TxArrivalWaitFlag = cli.IntFlag{ TxArrivalWaitFlag = cli.IntFlag{
Name: "txarrivalwait", Name: "txarrivalwait",
Usage: "Maximum number of milliseconds to wait for a transaction before requesting it (defaults to 100ms)", Usage: "Maximum number of milliseconds to wait for a transaction before requesting it (defaults to 100ms)",
Value: (int)(node.DefaultConfig.P2P.TxArrivalWait), Value: node.DefaultConfig.P2P.TxArrivalWait,
} }
// Metrics flags // Metrics flags
@ -1296,7 +1296,7 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
} }
if ctx.GlobalIsSet(TxArrivalWaitFlag.Name) { if ctx.GlobalIsSet(TxArrivalWaitFlag.Name) {
cfg.TxArrivalWait = (time.Duration)(TxArrivalWaitFlag.Value) * time.Millisecond cfg.TxArrivalWait = TxArrivalWaitFlag.Value
} }
} }

View file

@ -266,7 +266,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
EthAPI: ethAPI, EthAPI: ethAPI,
PeerRequiredBlocks: config.PeerRequiredBlocks, PeerRequiredBlocks: config.PeerRequiredBlocks,
checker: checker, checker: checker,
txArrivalWait: eth.p2pServer.TxArrivalWait, txArrivalWait: time.Duration(eth.p2pServer.TxArrivalWait) * time.Millisecond,
}); err != nil { }); err != nil {
return nil, err return nil, err
} }

View file

@ -1051,7 +1051,7 @@ func (c *Config) buildNode() (*node.Config, error) {
MaxPendingPeers: int(c.P2P.MaxPendPeers), MaxPendingPeers: int(c.P2P.MaxPendPeers),
ListenAddr: c.P2P.Bind + ":" + strconv.Itoa(int(c.P2P.Port)), ListenAddr: c.P2P.Bind + ":" + strconv.Itoa(int(c.P2P.Port)),
DiscoveryV5: c.P2P.Discovery.V5Enabled, DiscoveryV5: c.P2P.Discovery.V5Enabled,
TxArrivalWait: time.Duration(c.P2P.TxArrivalWait), TxArrivalWait: int(c.P2P.TxArrivalWait),
}, },
HTTPModules: c.JsonRPC.Http.API, HTTPModules: c.JsonRPC.Http.API,
HTTPCors: c.JsonRPC.Http.Cors, HTTPCors: c.JsonRPC.Http.Cors,

View file

@ -159,7 +159,7 @@ type Config struct {
// TxArrivalWait is the duration (ms) that the node will wait after seeing // TxArrivalWait is the duration (ms) that the node will wait after seeing
// an announced transaction before explicitly requesting it // an announced transaction before explicitly requesting it
TxArrivalWait time.Duration TxArrivalWait int
} }
// Server manages all peer connections. // Server manages all peer connections.