mirror of
https://github.com/FlipsideCrypto/dcrd.git
synced 2026-02-06 10:56:47 +00:00
blockmanager: current() for testnet should check blockchain timesource. (#302)
This commit is contained in:
parent
bcca98d50a
commit
35a103d454
@ -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
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user