mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-30 14:41:20 +00:00
IsCaughtUp works with new networks
This commit is contained in:
parent
891ad9c1f0
commit
b468baf7ac
@ -32,6 +32,7 @@ const (
|
|||||||
|
|
||||||
type BlockPool struct {
|
type BlockPool struct {
|
||||||
QuitService
|
QuitService
|
||||||
|
startTime time.Time
|
||||||
|
|
||||||
// block requests
|
// block requests
|
||||||
mtx sync.Mutex
|
mtx sync.Mutex
|
||||||
@ -65,6 +66,7 @@ func NewBlockPool(start int, requestsCh chan<- BlockRequest, timeoutsCh chan<- s
|
|||||||
func (pool *BlockPool) OnStart() error {
|
func (pool *BlockPool) OnStart() error {
|
||||||
pool.QuitService.OnStart()
|
pool.QuitService.OnStart()
|
||||||
go pool.makeRequestsRoutine()
|
go pool.makeRequestsRoutine()
|
||||||
|
pool.startTime = time.Now()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +138,7 @@ func (pool *BlockPool) IsCaughtUp() bool {
|
|||||||
}
|
}
|
||||||
pool.peersMtx.Unlock()
|
pool.peersMtx.Unlock()
|
||||||
|
|
||||||
return numPeers >= 3 && height > 0 && height == maxPeerHeight
|
return numPeers >= 3 && (height > 0 || time.Now().Sub(pool.startTime) > 30*time.Second) && (maxPeerHeight == 0 || height == maxPeerHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to see the second block's Validation to validate the first block.
|
// We need to see the second block's Validation to validate the first block.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user