Skip to content

Commit b3e7b8b

Browse files
committed
Adds function that returns time before trie is flushed to disk
1 parent 9d1cd66 commit b3e7b8b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/blockchain.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,11 @@ func (bc *BlockChain) writeKnownBlock(block *types.Block) error {
15551555
return nil
15561556
}
15571557

1558+
func (bc *BlockChain) TimeBeforeFlush() time.Duration {
1559+
flushInterval := time.Duration(bc.flushInterval.Load())
1560+
return flushInterval - (bc.gcproc + bc.gcprocRandOffset)
1561+
}
1562+
15581563
// writeBlockWithState writes block, metadata and corresponding state data to the
15591564
// database.
15601565
func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.Receipt, statedb *state.StateDB) error {

0 commit comments

Comments
 (0)