Don't use latency as initital estimate for blocksync

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-09-08 08:59:05 +02:00
parent f985f42e93
commit 043e62ab63
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -72,16 +72,7 @@ func (bpt *bsPeerTracker) prefSortedPeers() []peer.ID {
var costI, costJ float64 var costI, costJ float64
getPeerInitLat := func(p peer.ID) float64 { getPeerInitLat := func(p peer.ID) float64 {
var res float64 return float64(bpt.avgGlobalTime) * newPeerMul
if bpt.pmgr != nil {
if lat, ok := bpt.pmgr.GetPeerLatency(p); ok {
res = float64(lat)
}
}
if res == 0 {
res = float64(bpt.avgGlobalTime)
}
return res * newPeerMul
} }
if pi.successes+pi.failures > 0 { if pi.successes+pi.failures > 0 {