mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2025-01-05 10:12:19 +00:00
eth: fix tracing state retrieval if requesting the non-dirty genesis
This commit is contained in:
parent
9d10856e84
commit
2a7c4b62a9
@ -61,6 +61,16 @@ func (eth *Ethereum) stateAtBlock(block *types.Block, reexec uint64, base *state
|
|||||||
// the internal junks created by tracing will be persisted into the disk.
|
// the internal junks created by tracing will be persisted into the disk.
|
||||||
database = state.NewDatabaseWithConfig(eth.chainDb, &trie.Config{Cache: 16})
|
database = state.NewDatabaseWithConfig(eth.chainDb, &trie.Config{Cache: 16})
|
||||||
|
|
||||||
|
// If we didn't check the dirty database, do check the clean one, otherwise
|
||||||
|
// we would rewind past a persisted block (specific corner case is chain
|
||||||
|
// tracing from the genesis).
|
||||||
|
if !checkLive {
|
||||||
|
statedb, err = state.New(current.Root(), database, nil)
|
||||||
|
if err == nil {
|
||||||
|
return statedb, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Database does not have the state for the given block, try to regenerate
|
||||||
for i := uint64(0); i < reexec; i++ {
|
for i := uint64(0); i < reexec; i++ {
|
||||||
if current.NumberU64() == 0 {
|
if current.NumberU64() == 0 {
|
||||||
return nil, errors.New("genesis state is missing")
|
return nil, errors.New("genesis state is missing")
|
||||||
|
Loading…
Reference in New Issue
Block a user