cmd/utils: fix applying bootstrap nodes from config file (#25174)

This commit is contained in:
Andre Patta 2022-06-29 06:57:12 -03:00 committed by qinglin89
parent 8c90dc946a
commit 4ce9680212

@ -296,12 +296,12 @@ var (
defaultVerifyMode = ethconfig.Defaults.TriesVerifyMode defaultVerifyMode = ethconfig.Defaults.TriesVerifyMode
TriesVerifyModeFlag = TextMarshalerFlag{ TriesVerifyModeFlag = TextMarshalerFlag{
Name: "tries-verify-mode", Name: "tries-verify-mode",
Usage: `tries verify mode: Usage: `tries verify mode:
"local(default): a normal full node with complete state world(both MPT and snapshot), merkle state root will "local(default): a normal full node with complete state world(both MPT and snapshot), merkle state root will
be verified against the block header.", be verified against the block header.",
"full: a fast node with only snapshot state world. Merkle state root is verified by the trustworthy remote verify node "full: a fast node with only snapshot state world. Merkle state root is verified by the trustworthy remote verify node
by comparing the diffhash(an identify of difflayer generated by the block) and state root.", by comparing the diffhash(an identify of difflayer generated by the block) and state root.",
"insecure: same as full mode, except that it can tolerate without verifying the diffhash when verify node does not have it.", "insecure: same as full mode, except that it can tolerate without verifying the diffhash when verify node does not have it.",
"none: no merkle state root verification at all, there is no need to setup or connect remote verify node at all, "none: no merkle state root verification at all, there is no need to setup or connect remote verify node at all,
it is more light comparing to full and insecure mode, but get a very small chance that the state is not consistent it is more light comparing to full and insecure mode, but get a very small chance that the state is not consistent
with other peers."`, with other peers."`,
@ -975,10 +975,11 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
urls = params.RinkebyBootnodes urls = params.RinkebyBootnodes
case ctx.GlobalBool(GoerliFlag.Name): case ctx.GlobalBool(GoerliFlag.Name):
urls = params.GoerliBootnodes urls = params.GoerliBootnodes
case cfg.BootstrapNodes != nil:
return // already set, don't apply defaults.
} }
// don't apply defaults if BootstrapNodes is already set
if cfg.BootstrapNodes != nil {
return
}
cfg.BootstrapNodes = make([]*enode.Node, 0, len(urls)) cfg.BootstrapNodes = make([]*enode.Node, 0, len(urls))
for _, url := range urls { for _, url := range urls {
if url != "" { if url != "" {