Skip to content

Commit f490228

Browse files
committed
move WriteBlockAndSetHeadWithTime to blockchain_arbitrum
1 parent 57a6751 commit f490228

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

core/blockchain.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,16 +1353,6 @@ func (bc *BlockChain) WriteBlockAndSetHead(block *types.Block, receipts []*types
13531353
return bc.writeBlockAndSetHead(block, receipts, logs, state, emitHeadEvent)
13541354
}
13551355

1356-
// WriteBlockAndSetHeadWithTime also counts processTime, which will cause intermittent TrieDirty cache writes
1357-
func (bc *BlockChain) WriteBlockAndSetHeadWithTime(block *types.Block, receipts []*types.Receipt, logs []*types.Log, state *state.StateDB, emitHeadEvent bool, processTime time.Duration) (status WriteStatus, err error) {
1358-
if !bc.chainmu.TryLock() {
1359-
return NonStatTy, errChainStopped
1360-
}
1361-
defer bc.chainmu.Unlock()
1362-
bc.gcproc += processTime
1363-
return bc.writeBlockAndSetHead(block, receipts, logs, state, emitHeadEvent)
1364-
}
1365-
13661356
// writeBlockAndSetHead is the internal implementation of WriteBlockAndSetHead.
13671357
// This function expects the chain mutex to be held.
13681358
func (bc *BlockChain) writeBlockAndSetHead(block *types.Block, receipts []*types.Receipt, logs []*types.Log, state *state.StateDB, emitHeadEvent bool) (status WriteStatus, err error) {

core/blockchain_arbitrum.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,23 @@
1818
package core
1919

2020
import (
21+
"time"
22+
23+
"github.com/ethereum/go-ethereum/core/state"
2124
"github.com/ethereum/go-ethereum/core/types"
2225
"github.com/ethereum/go-ethereum/rpc"
2326
)
2427

28+
// WriteBlockAndSetHeadWithTime also counts processTime, which will cause intermittent TrieDirty cache writes
29+
func (bc *BlockChain) WriteBlockAndSetHeadWithTime(block *types.Block, receipts []*types.Receipt, logs []*types.Log, state *state.StateDB, emitHeadEvent bool, processTime time.Duration) (status WriteStatus, err error) {
30+
if !bc.chainmu.TryLock() {
31+
return NonStatTy, errChainStopped
32+
}
33+
defer bc.chainmu.Unlock()
34+
bc.gcproc += processTime
35+
return bc.writeBlockAndSetHead(block, receipts, logs, state, emitHeadEvent)
36+
}
37+
2538
func (bc *BlockChain) ReorgToOldBlock(newHead *types.Block) error {
2639
bc.wg.Add(1)
2740
defer bc.wg.Done()

0 commit comments

Comments
 (0)