cmd/geth: parse uint64 value with ParseUint instead of Atoi (#25545)

Parse uint64 value with ParseUint instead of Atoi
This commit is contained in:
Justin Traglia 2022-08-19 01:03:45 -05:00 committed by GitHub
parent 656dc8cc00
commit 9762ddf8b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -384,12 +384,12 @@ func parseDumpConfig(ctx *cli.Context, stack *node.Node) (*state.DumpConfig, eth
return nil, nil, common.Hash{}, fmt.Errorf("block %x not found", hash) return nil, nil, common.Hash{}, fmt.Errorf("block %x not found", hash)
} }
} else { } else {
number, err := strconv.Atoi(arg) number, err := strconv.ParseUint(arg, 10, 64)
if err != nil { if err != nil {
return nil, nil, common.Hash{}, err return nil, nil, common.Hash{}, err
} }
if hash := rawdb.ReadCanonicalHash(db, uint64(number)); hash != (common.Hash{}) { if hash := rawdb.ReadCanonicalHash(db, number); hash != (common.Hash{}) {
header = rawdb.ReadHeader(db, hash, uint64(number)) header = rawdb.ReadHeader(db, hash, number)
} else { } else {
return nil, nil, common.Hash{}, fmt.Errorf("header for block %d not found", number) return nil, nil, common.Hash{}, fmt.Errorf("header for block %d not found", number)
} }