mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
changed txArrivalWait config type from int to time.Duration, changed flags to duration type. Tested on live both w/o flag set (default) and w/ flag set
This commit is contained in:
parent
b5ff754b70
commit
3c23de2486
8 changed files with 17 additions and 14 deletions
|
|
@ -754,10 +754,11 @@ var (
|
|||
Usage: "Gas price below which gpo will ignore transactions",
|
||||
Value: ethconfig.Defaults.GPO.IgnorePrice.Int64(),
|
||||
}
|
||||
// fetcher flag to set arrival timeout
|
||||
TxArrivalWaitFlag = cli.IntFlag{
|
||||
// flag to set the transaction fetcher's txArrivalWait value, which is the maximum waiting
|
||||
// period the fetcher will wait to receive an announced tx before explicitly requesting it
|
||||
TxArrivalWaitFlag = cli.DurationFlag{
|
||||
Name: "txarrivalwait",
|
||||
Usage: "Maximum number of milliseconds to wait for a transaction before requesting it (defaults to 500ms)",
|
||||
Usage: "Maximum duration to wait for a transaction before requesting it (defaults to 500ms)",
|
||||
Value: node.DefaultConfig.P2P.TxArrivalWait,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```v5disc```: Enables the experimental RLPx V5 (Topic Discovery) mechanism (default: false)
|
||||
|
||||
- ```txarrivalwait```: Maximum number of milliseconds to wait before requesting an announced transaction (default: 500)
|
||||
- ```txarrivalwait```: Maximum duration to wait before requesting an announced transaction (default: 500)
|
||||
|
||||
### Sealer Options
|
||||
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
|||
EthAPI: ethAPI,
|
||||
PeerRequiredBlocks: config.PeerRequiredBlocks,
|
||||
checker: checker,
|
||||
txArrivalWait: time.Duration(eth.p2pServer.TxArrivalWait) * time.Millisecond,
|
||||
txArrivalWait: eth.p2pServer.TxArrivalWait,
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ type handlerConfig struct {
|
|||
|
||||
PeerRequiredBlocks map[uint64]common.Hash // Hard coded map of required block hashes for sync challenges
|
||||
checker ethereum.ChainValidator
|
||||
txArrivalWait time.Duration // Max time in milliseconds to wait for an announced tx before requesting it
|
||||
txArrivalWait time.Duration // Maximum duration to wait for an announced tx before requesting it
|
||||
}
|
||||
|
||||
type handler struct {
|
||||
|
|
|
|||
|
|
@ -132,8 +132,9 @@ type P2PConfig struct {
|
|||
// Discovery has the p2p discovery related settings
|
||||
Discovery *P2PDiscovery `hcl:"discovery,block" toml:"discovery,block"`
|
||||
|
||||
// TxArrivalWait sets the maximum wait for announced transactions
|
||||
TxArrivalWait uint64 `hcl:"txarrivalwait,optional" toml:"txarrivalwait,optional"`
|
||||
// TxArrivalWait sets the maximum duration the transaction fetcher will wait for
|
||||
// an announced transaction to arrive before explicitly requesting it
|
||||
TxArrivalWait time.Duration `hcl:"txarrivalwait,optional" toml:"txarrivalwait,optional"`
|
||||
}
|
||||
|
||||
type P2PDiscovery struct {
|
||||
|
|
@ -458,7 +459,7 @@ func DefaultConfig() *Config {
|
|||
Port: 30303,
|
||||
NoDiscover: false,
|
||||
NAT: "any",
|
||||
TxArrivalWait: 500,
|
||||
TxArrivalWait: 500 * time.Millisecond,
|
||||
Discovery: &P2PDiscovery{
|
||||
V5Enabled: false,
|
||||
Bootnodes: []string{},
|
||||
|
|
@ -1051,7 +1052,7 @@ func (c *Config) buildNode() (*node.Config, error) {
|
|||
MaxPendingPeers: int(c.P2P.MaxPendPeers),
|
||||
ListenAddr: c.P2P.Bind + ":" + strconv.Itoa(int(c.P2P.Port)),
|
||||
DiscoveryV5: c.P2P.Discovery.V5Enabled,
|
||||
TxArrivalWait: int(c.P2P.TxArrivalWait),
|
||||
TxArrivalWait: c.P2P.TxArrivalWait,
|
||||
},
|
||||
HTTPModules: c.JsonRPC.Http.API,
|
||||
HTTPCors: c.JsonRPC.Http.Cors,
|
||||
|
|
|
|||
|
|
@ -548,9 +548,9 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.P2P.Discovery.V5Enabled,
|
||||
Group: "P2P",
|
||||
})
|
||||
f.Uint64Flag(&flagset.Uint64Flag{
|
||||
f.DurationFlag(&flagset.DurationFlag{
|
||||
Name: "txarrivalwait",
|
||||
Usage: "Maximum number of milliseconds to wait for a transaction before requesting it (defaults to 500ms)",
|
||||
Usage: "Maximum duration to wait for a transaction before explicitly requesting it (defaults to 500ms)",
|
||||
Value: &c.cliConfig.P2P.TxArrivalWait,
|
||||
Default: c.cliConfig.P2P.TxArrivalWait,
|
||||
Group: "P2P",
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import (
|
|||
"os/user"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/p2p"
|
||||
"github.com/ethereum/go-ethereum/p2p/nat"
|
||||
|
|
@ -63,7 +64,7 @@ var DefaultConfig = Config{
|
|||
ListenAddr: ":30303",
|
||||
MaxPeers: 50,
|
||||
NAT: nat.Any(),
|
||||
TxArrivalWait: 500,
|
||||
TxArrivalWait: 500 * time.Millisecond,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ type Config struct {
|
|||
|
||||
// TxArrivalWait is the duration (ms) that the node will wait after seeing
|
||||
// an announced transaction before explicitly requesting it
|
||||
TxArrivalWait int
|
||||
TxArrivalWait time.Duration
|
||||
}
|
||||
|
||||
// Server manages all peer connections.
|
||||
|
|
|
|||
Loading…
Reference in a new issue