cmd/evm: reopen the statedb for dumping (#29437)

This commit is contained in:
rjl493456442 2024-04-02 20:25:06 +08:00 committed by GitHub
parent 0bd03dbc55
commit fe0bf325a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -272,8 +272,17 @@ func runCmd(ctx *cli.Context) error {
output, leftOverGas, stats, err := timedExec(bench, execFunc)
if ctx.Bool(DumpFlag.Name) {
statedb.Commit(genesisConfig.Number, true)
fmt.Println(string(statedb.Dump(nil)))
root, err := statedb.Commit(genesisConfig.Number, true)
if err != nil {
fmt.Printf("Failed to commit changes %v\n", err)
return err
}
dumpdb, err := state.New(root, sdb, nil)
if err != nil {
fmt.Printf("Failed to open statedb %v\n", err)
return err
}
fmt.Println(string(dumpdb.Dump(nil)))
}
if ctx.Bool(DebugFlag.Name) {