Skip to content

Commit f9b447d

Browse files
StateBuildingLogFunction shouldn't take targetHeader as an arg
1 parent 2f247a3 commit f9b447d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

arbitrum/recordingdb.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ func (r *RecordingDatabase) GetOrRecreateState(ctx context.Context, header *type
322322
returnedBlockNumber := header.Number.Uint64()
323323
for ctx.Err() == nil {
324324
var block *types.Block
325-
state, block, err = AdvanceStateByBlock(ctx, r.bc, state, header, blockToRecreate, prevHash, logFunc)
325+
state, block, err = AdvanceStateByBlock(ctx, r.bc, state, blockToRecreate, prevHash, logFunc)
326326
if err != nil {
327327
return nil, err
328328
}

arbitrum/recreatestate.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type StateReleaseFunc tracers.StateReleaseFunc
2121

2222
var NoopStateRelease StateReleaseFunc = func() {}
2323

24-
type StateBuildingLogFunction func(targetHeader, header *types.Header, hasState bool)
24+
type StateBuildingLogFunction func(header *types.Header, hasState bool)
2525
type StateForHeaderFunction func(header *types.Header) (*state.StateDB, StateReleaseFunc, error)
2626

2727
// finds last available state and header checking it first for targetHeader then looking backwards
@@ -56,7 +56,7 @@ func FindLastAvailableState(ctx context.Context, bc *core.BlockChain, stateFor S
5656
return nil, lastHeader, nil, err
5757
}
5858
if logFunc != nil {
59-
logFunc(targetHeader, currentHeader, false)
59+
logFunc(currentHeader, false)
6060
}
6161
if currentHeader.Number.Uint64() <= genesis {
6262
return nil, lastHeader, nil, errors.Wrap(err, fmt.Sprintf("moved beyond genesis looking for state %d, genesis %d", targetHeader.Number.Uint64(), genesis))
@@ -69,7 +69,7 @@ func FindLastAvailableState(ctx context.Context, bc *core.BlockChain, stateFor S
6969
return state, currentHeader, release, ctx.Err()
7070
}
7171

72-
func AdvanceStateByBlock(ctx context.Context, bc *core.BlockChain, state *state.StateDB, targetHeader *types.Header, blockToRecreate uint64, prevBlockHash common.Hash, logFunc StateBuildingLogFunction) (*state.StateDB, *types.Block, error) {
72+
func AdvanceStateByBlock(ctx context.Context, bc *core.BlockChain, state *state.StateDB, blockToRecreate uint64, prevBlockHash common.Hash, logFunc StateBuildingLogFunction) (*state.StateDB, *types.Block, error) {
7373
block := bc.GetBlockByNumber(blockToRecreate)
7474
if block == nil {
7575
return nil, nil, fmt.Errorf("block not found while recreating: %d", blockToRecreate)
@@ -78,7 +78,7 @@ func AdvanceStateByBlock(ctx context.Context, bc *core.BlockChain, state *state.
7878
return nil, nil, fmt.Errorf("reorg detected: number %d expectedPrev: %v foundPrev: %v", blockToRecreate, prevBlockHash, block.ParentHash())
7979
}
8080
if logFunc != nil {
81-
logFunc(targetHeader, block.Header(), true)
81+
logFunc(block.Header(), true)
8282
}
8383
_, _, _, err := bc.Processor().Process(block, state, vm.Config{})
8484
if err != nil {

0 commit comments

Comments
 (0)