diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 600e929706..af565d71ae 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -109,7 +109,7 @@ var ( utils.UltraLightFractionFlag, utils.UltraLightOnlyAnnounceFlag, utils.LightNoSyncServeFlag, - utils.EthPeerRequiredBlocksFlag, + utils.EthRequiredBlocksFlag, utils.LegacyWhitelistFlag, utils.BloomFilterSizeFlag, utils.CacheFlag, diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index af5175cd63..28f8f84533 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -56,7 +56,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{ utils.EthStatsURLFlag, utils.IdentityFlag, utils.LightKDFFlag, - utils.EthPeerRequiredBlocksFlag, + utils.EthRequiredBlocksFlag, }, }, { diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 5c733e2a23..a263e5ef56 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -250,13 +250,13 @@ var ( Name: "lightkdf", Usage: "Reduce key-derivation RAM & CPU usage at some expense of KDF strength", } - EthPeerRequiredBlocksFlag = cli.StringFlag{ + EthRequiredBlocksFlag = cli.StringFlag{ Name: "eth.requiredblocks", Usage: "Comma separated block number-to-hash mappings to require for peering (=)", } LegacyWhitelistFlag = cli.StringFlag{ Name: "whitelist", - Usage: "Comma separated block number-to-hash mappings to enforce (=) (deprecated in favor of --peer.requiredblocks)", + Usage: "Comma separated block number-to-hash mappings to enforce (=) (deprecated in favor of --eth.requiredblocks)", } BloomFilterSizeFlag = cli.Uint64Flag{ Name: "bloomfilter.size", @@ -1499,31 +1499,31 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) { } } -func setPeerRequiredBlocks(ctx *cli.Context, cfg *ethconfig.Config) { - peerRequiredBlocks := ctx.GlobalString(EthPeerRequiredBlocksFlag.Name) +func setRequiredBlocks(ctx *cli.Context, cfg *ethconfig.Config) { + requiredBlocks := ctx.GlobalString(EthRequiredBlocksFlag.Name) - if peerRequiredBlocks == "" { + if requiredBlocks == "" { if ctx.GlobalIsSet(LegacyWhitelistFlag.Name) { - log.Warn("The flag --rpc is deprecated and will be removed, please use --peer.requiredblocks") - peerRequiredBlocks = ctx.GlobalString(LegacyWhitelistFlag.Name) + log.Warn("The flag --whitelist is deprecated and will be removed, please use --eth.requiredblocks") + requiredBlocks = ctx.GlobalString(LegacyWhitelistFlag.Name) } else { return } } cfg.PeerRequiredBlocks = make(map[uint64]common.Hash) - for _, entry := range strings.Split(peerRequiredBlocks, ",") { + for _, entry := range strings.Split(requiredBlocks, ",") { parts := strings.Split(entry, "=") if len(parts) != 2 { - Fatalf("Invalid peer required block entry: %s", entry) + Fatalf("Invalid required block entry: %s", entry) } number, err := strconv.ParseUint(parts[0], 0, 64) if err != nil { - Fatalf("Invalid peer required block number %s: %v", parts[0], err) + Fatalf("Invalid required block number %s: %v", parts[0], err) } var hash common.Hash if err = hash.UnmarshalText([]byte(parts[1])); err != nil { - Fatalf("Invalid peer required block hash %s: %v", parts[1], err) + Fatalf("Invalid required block hash %s: %v", parts[1], err) } cfg.PeerRequiredBlocks[number] = hash } @@ -1592,7 +1592,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { setTxPool(ctx, &cfg.TxPool) setEthash(ctx, cfg) setMiner(ctx, &cfg.Miner) - setPeerRequiredBlocks(ctx, cfg) + setRequiredBlocks(ctx, cfg) setLes(ctx, cfg) if ctx.GlobalIsSet(BorLogsFlag.Name) { diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index c9272758ab..8089794948 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -144,7 +144,7 @@ type Config struct { TxLookupLimit uint64 `toml:",omitempty"` // The maximum number of blocks from head whose tx indices are reserved. - // PeerRequiredBlocks is a set of block number -> hash mappings which must be in the + // RequiredBlocks is a set of block number -> hash mappings which must be in the // canonical chain of all remote peers. Setting the option makes geth verify the // presence of these blocks for every new peer connection. PeerRequiredBlocks map[uint64]common.Hash `toml:"-"` diff --git a/eth/ethconfig/gen_config.go b/eth/ethconfig/gen_config.go index 874e30dffd..fdb6fe11e1 100644 --- a/eth/ethconfig/gen_config.go +++ b/eth/ethconfig/gen_config.go @@ -26,7 +26,7 @@ func (c Config) MarshalTOML() (interface{}, error) { NoPruning bool NoPrefetch bool TxLookupLimit uint64 `toml:",omitempty"` - PeerRequiredBlocks map[uint64]common.Hash `toml:"-"` + PeerRequiredBlocks map[uint64]common.Hash `toml:"-"` LightServ int `toml:",omitempty"` LightIngress int `toml:",omitempty"` LightEgress int `toml:",omitempty"` @@ -120,7 +120,7 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { NoPruning *bool NoPrefetch *bool TxLookupLimit *uint64 `toml:",omitempty"` - PeerRequiredBlocks map[uint64]common.Hash `toml:"-"` + PeerRequiredBlocks map[uint64]common.Hash `toml:"-"` LightServ *int `toml:",omitempty"` LightIngress *int `toml:",omitempty"` LightEgress *int `toml:",omitempty"` diff --git a/eth/sync.go b/eth/sync.go index 22c0c9054a..aa79b6181c 100644 --- a/eth/sync.go +++ b/eth/sync.go @@ -230,7 +230,7 @@ func (cs *chainSyncer) modeAndLocalHead() (downloader.SyncMode, *big.Int) { // return downloader.SnapSync, td // } // } - // Nope, we're really full syncing + // // Nope, we're really full syncing // head := cs.handler.chain.CurrentBlock() // td := cs.handler.chain.GetTd(head.Hash(), head.NumberU64()) // return downloader.FullSync, td