Skip to content

Commit

Permalink
Remove AdvanceStateUpToBlock function
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshvanahalli committed Oct 2, 2024
1 parent 4758974 commit fece13e
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions arbitrum/recreatestate.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,3 @@ func AdvanceStateByBlock(ctx context.Context, bc *core.BlockChain, state *state.
}
return state, block, nil
}

func AdvanceStateUpToBlock(ctx context.Context, bc *core.BlockChain, state *state.StateDB, targetHeader *types.Header, lastAvailableHeader *types.Header, logFunc StateBuildingLogFunction) (*state.StateDB, error) {
returnedBlockNumber := targetHeader.Number.Uint64()
blockToRecreate := lastAvailableHeader.Number.Uint64() + 1
prevHash := lastAvailableHeader.Hash()
for ctx.Err() == nil {
state, block, err := AdvanceStateByBlock(ctx, bc, state, targetHeader, blockToRecreate, prevHash, logFunc)
if err != nil {
return nil, err
}
prevHash = block.Hash()
if blockToRecreate >= returnedBlockNumber {
if block.Hash() != targetHeader.Hash() {
return nil, fmt.Errorf("blockHash doesn't match when recreating number: %d expected: %v got: %v", blockToRecreate, targetHeader.Hash(), block.Hash())
}
return state, nil
}
blockToRecreate++
}
return nil, ctx.Err()
}

0 comments on commit fece13e

Please sign in to comment.