From b1b24a0cfde1acf594a45bf43cc52223e4e4ea75 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 24 Jul 2020 02:48:07 -0500 Subject: [PATCH] blockchain: Rename last prune time field. This renames the field that tracks the last time the stake nodes were pruned to lastPruneTime to more accurately reflect its purpose. --- blockchain/prune.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/blockchain/prune.go b/blockchain/prune.go index 91a9d580..17a7b42a 100644 --- a/blockchain/prune.go +++ b/blockchain/prune.go @@ -11,15 +11,15 @@ const pruningIntervalInMinutes = 5 // chainPruner is used to occasionally prune the blockchain of old nodes that // can be freed to the garbage collector. type chainPruner struct { - chain *BlockChain - lastNodeInsertTime time.Time + chain *BlockChain + lastPruneTime time.Time } // newChainPruner returns a new chain pruner. func newChainPruner(chain *BlockChain) *chainPruner { return &chainPruner{ - chain: chain, - lastNodeInsertTime: time.Now(), + chain: chain, + lastPruneTime: time.Now(), } } @@ -29,11 +29,11 @@ func newChainPruner(chain *BlockChain) *chainPruner { // pruneChainIfNeeded must be called with the chainLock held for writes. func (c *chainPruner) pruneChainIfNeeded() { now := time.Now() - duration := now.Sub(c.lastNodeInsertTime) + duration := now.Sub(c.lastPruneTime) if duration < time.Minute*pruningIntervalInMinutes { return } - c.lastNodeInsertTime = now + c.lastPruneTime = now c.chain.pruneStakeNodes() }