From e307ad122f08d86d5ee3cb0cebd556cae9a40f66 Mon Sep 17 00:00:00 2001 From: Calvin Kim Date: Wed, 3 Jan 2024 14:24:36 +0900 Subject: [PATCH] blockchain: set the lastflushtime when setting the lastflushhash On startup when the headers-first mode is off, when receiving the first block, the periodic flush will trigger. The lastflushtime wasn't set which resulted in the flush being triggered on the first block on restart. --- blockchain/utxocache.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/blockchain/utxocache.go b/blockchain/utxocache.go index af7a3b7b6f..d6a9f7eaa0 100644 --- a/blockchain/utxocache.go +++ b/blockchain/utxocache.go @@ -634,6 +634,10 @@ func (b *BlockChain) InitConsistentState(tip *blockNode, interrupt <-chan struct // it to the tip since we checked it's consistent. s.lastFlushHash = tip.hash + // Set the last flush time as now since we know the state is consistent + // at this time. + s.lastFlushTime = time.Now() + return nil }