diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index 18a8b6f5ff..c407600851 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -607,13 +607,19 @@ func parseDumpConfig(ctx *cli.Context, stack *node.Node) (*state.DumpConfig, eth arg := ctx.Args().First() if hashish(arg) { hash := common.HexToHash(arg) - if contain := triedb.ContainDiffLayer(hash); !contain { - log.Crit("PBSS doesn't contain specified hash", "hash", arg) - } + // if contain := triedb.ContainDiffLayer(hash); !contain { + // log.Crit("PBSS doesn't contain specified hash", "hash", arg) + // } if number := rawdb.ReadHeaderNumber(db, hash); number != nil { header = rawdb.ReadHeader(db, hash, *number) + if header == nil { + return nil, nil, common.Hash{}, fmt.Errorf("block_hash %x header not found", hash) + } } else { - return nil, nil, common.Hash{}, fmt.Errorf("block %x not found", hash) + return nil, nil, common.Hash{}, fmt.Errorf("block_hash %x not found", hash) + } + if contain := triedb.ContainDiffLayer(header.Root); !contain { + log.Crit("PBSS doesn't contain specified hash", "block_hash", arg, "mpt_root", header.Root) } } else { number, err := strconv.ParseUint(arg, 10, 64) @@ -621,12 +627,18 @@ func parseDumpConfig(ctx *cli.Context, stack *node.Node) (*state.DumpConfig, eth return nil, nil, common.Hash{}, err } if hash := rawdb.ReadCanonicalHash(db, number); hash != (common.Hash{}) { - if contain := triedb.ContainDiffLayer(hash); !contain { - log.Crit("PBSS doesn't contain specified block number", "number", number) - } + // if contain := triedb.ContainDiffLayer(hash); !contain { + // log.Crit("PBSS doesn't contain specified block number", "number", number) + // } header = rawdb.ReadHeader(db, hash, number) + if header == nil { + return nil, nil, common.Hash{}, fmt.Errorf("block_id %d header not found", number) + } + if contain := triedb.ContainDiffLayer(header.Root); !contain { + log.Crit("PBSS doesn't contain specified block number", "block_height", number, "mpt_root", header.Root) + } } 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_height %d not found", number) } } } else {