mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 15:47:21 +00:00
cmd/utils: use IsHexAddress method (#32997)
Using the `IsHexAddress` method will result in no gaps in the verification logic, making it simpler.
This commit is contained in:
parent
2bb3d9a330
commit
030cd2d155
1 changed files with 2 additions and 8 deletions
|
|
@ -20,7 +20,6 @@ package utils
|
|||
import (
|
||||
"context"
|
||||
"crypto/ecdsa"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
|
@ -1341,15 +1340,10 @@ func setEtherbase(ctx *cli.Context, cfg *ethconfig.Config) {
|
|||
return
|
||||
}
|
||||
addr := ctx.String(MinerPendingFeeRecipientFlag.Name)
|
||||
if strings.HasPrefix(addr, "0x") || strings.HasPrefix(addr, "0X") {
|
||||
addr = addr[2:]
|
||||
}
|
||||
b, err := hex.DecodeString(addr)
|
||||
if err != nil || len(b) != common.AddressLength {
|
||||
if !common.IsHexAddress(addr) {
|
||||
Fatalf("-%s: invalid pending block producer address %q", MinerPendingFeeRecipientFlag.Name, addr)
|
||||
return
|
||||
}
|
||||
cfg.Miner.PendingFeeRecipient = common.BytesToAddress(b)
|
||||
cfg.Miner.PendingFeeRecipient = common.HexToAddress(addr)
|
||||
}
|
||||
|
||||
func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue