mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
minor refactor
This commit is contained in:
parent
d89759c318
commit
7ae5bce4d5
3 changed files with 6 additions and 6 deletions
|
|
@ -1515,15 +1515,15 @@ func setPeerRequiredBlocks(ctx *cli.Context, cfg *ethconfig.Config) {
|
||||||
for _, entry := range strings.Split(peerRequiredBlocks, ",") {
|
for _, entry := range strings.Split(peerRequiredBlocks, ",") {
|
||||||
parts := strings.Split(entry, "=")
|
parts := strings.Split(entry, "=")
|
||||||
if len(parts) != 2 {
|
if len(parts) != 2 {
|
||||||
Fatalf("Invalid required block entry: %s", entry)
|
Fatalf("Invalid peer required block entry: %s", entry)
|
||||||
}
|
}
|
||||||
number, err := strconv.ParseUint(parts[0], 0, 64)
|
number, err := strconv.ParseUint(parts[0], 0, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fatalf("Invalid required block number %s: %v", parts[0], err)
|
Fatalf("Invalid peer required block number %s: %v", parts[0], err)
|
||||||
}
|
}
|
||||||
var hash common.Hash
|
var hash common.Hash
|
||||||
if err = hash.UnmarshalText([]byte(parts[1])); err != nil {
|
if err = hash.UnmarshalText([]byte(parts[1])); err != nil {
|
||||||
Fatalf("Invalid required block hash %s: %v", parts[1], err)
|
Fatalf("Invalid peer required block hash %s: %v", parts[1], err)
|
||||||
}
|
}
|
||||||
cfg.PeerRequiredBlocks[number] = hash
|
cfg.PeerRequiredBlocks[number] = hash
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ type Config struct {
|
||||||
|
|
||||||
TxLookupLimit uint64 `toml:",omitempty"` // The maximum number of blocks from head whose tx indices are reserved.
|
TxLookupLimit uint64 `toml:",omitempty"` // The maximum number of blocks from head whose tx indices are reserved.
|
||||||
|
|
||||||
// RequiredBlocks is a set of block number -> hash mappings which must be in the
|
// PeerRequiredBlocks 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
|
// canonical chain of all remote peers. Setting the option makes geth verify the
|
||||||
// presence of these blocks for every new peer connection.
|
// presence of these blocks for every new peer connection.
|
||||||
PeerRequiredBlocks map[uint64]common.Hash `toml:"-"`
|
PeerRequiredBlocks map[uint64]common.Hash `toml:"-"`
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue