blockmanager: current() for testnet should check blockchain timesource. (#302)

This commit is contained in:
David Hill 2016-08-09 13:10:13 -04:00 committed by Alex Yocom-Piatt
parent bcca98d50a
commit 35a103d454
2 changed files with 4 additions and 7 deletions

View File

@ -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
}

View File

@ -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