Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove AdvanceStateUpToBlock function #364

Merged
merged 5 commits into from
Nov 7, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
}
Loading