From 35a103d4542546137d8e76ede1f839dbb2ab7aa3 Mon Sep 17 00:00:00 2001 From: David Hill Date: Tue, 9 Aug 2016 13:10:13 -0400 Subject: [PATCH] blockmanager: current() for testnet should check blockchain timesource. (#302) --- blockchain/chain.go | 5 ++--- blockmanager.go | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/blockchain/chain.go b/blockchain/chain.go index 013f179a..9b898aaf 100644 --- a/blockchain/chain.go +++ b/blockchain/chain.go @@ -1582,10 +1582,9 @@ func (b *BlockChain) IsCurrent(timeSource MedianTimeSource) bool { } // Not current if the latest best block has a timestamp before 24 hours - // ago and is on mainnet. + // ago. minus24Hours := timeSource.AdjustedTime().Add(-24 * time.Hour) - if b.bestChain.timestamp.Before(minus24Hours) && - b.chainParams.Name == "mainnet" { + if b.bestChain.timestamp.Before(minus24Hours) { return false } diff --git a/blockmanager.go b/blockmanager.go index a65fb848..d58921a8 100644 --- a/blockmanager.go +++ b/blockmanager.go @@ -973,10 +973,8 @@ func (b *blockManager) handleTxMsg(tmsg *txMsg) { // current returns true if we believe we are synced with our peers, false if we // still have blocks to check func (b *blockManager) current() bool { - if !cfg.TestNet { - if !b.blockChain.IsCurrent(b.server.timeSource) { - return false - } + if !b.blockChain.IsCurrent(b.server.timeSource) { + return false } // if blockChain thinks we are current and we have no syncPeer it