use the updated state in case there is one

pull/4510/head
Diego Nava 1 year ago
parent 924d1336f1
commit 6428430446
No known key found for this signature in database
GPG Key ID: 61AFC8738DA8B8B1
  1. 5
      core/preimages.go

@ -229,12 +229,13 @@ func GeneratePreimages(chain BlockChain, start, end uint64) error {
// because we have startingBlock we must have all following // because we have startingBlock we must have all following
return fmt.Errorf("block %d not found", i) return fmt.Errorf("block %d not found", i)
} }
stateAt, _ := chain.StateAt(block.Root())
_, _, _, _, _, _, endingState, err := chain.Processor().Process(block, startingState, *chain.GetVMConfig(), false) _, _, _, _, _, _, endingState, err := chain.Processor().Process(block, startingState, *chain.GetVMConfig(), false)
if err != nil { if err != nil {
return fmt.Errorf("error executing block #%d: %s", i, err) return fmt.Errorf("error executing block #%d: %s", i, err)
} }
stateAt, err := chain.StateAt(block.Root())
if err == nil && stateAt != nil { if stateAt != nil {
startingState = stateAt startingState = stateAt
} else { } else {
startingState = endingState startingState = endingState

Loading…
Cancel
Save