mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-21 22:56:22 +00:00
move reinstatement after if statement in pex reactor
This commit is contained in:
+3
-2
@@ -60,7 +60,9 @@ type AddrBook interface {
|
||||
// Mark address
|
||||
MarkGood(p2p.ID)
|
||||
MarkAttempt(*p2p.NetAddress)
|
||||
MarkBad(*p2p.NetAddress)
|
||||
MarkBad(*p2p.NetAddress) // Move peer to bad peers list
|
||||
// Add bad peers back to addrBook
|
||||
ReinstateBadPeers()
|
||||
|
||||
IsGood(*p2p.NetAddress) bool
|
||||
|
||||
@@ -236,7 +238,6 @@ func (a *addrBook) HasAddress(addr *p2p.NetAddress) bool {
|
||||
|
||||
// NeedMoreAddrs implements AddrBook - returns true if there are not have enough addresses in the book.
|
||||
func (a *addrBook) NeedMoreAddrs() bool {
|
||||
a.ReinstateBadPeers()
|
||||
return a.Size() < needAddressThreshold
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
amino "github.com/tendermint/go-amino"
|
||||
"github.com/tendermint/go-amino"
|
||||
"github.com/tendermint/tendermint/libs/cmap"
|
||||
tmmath "github.com/tendermint/tendermint/libs/math"
|
||||
"github.com/tendermint/tendermint/libs/rand"
|
||||
@@ -494,6 +494,8 @@ func (r *Reactor) ensurePeers() {
|
||||
}
|
||||
|
||||
if r.book.NeedMoreAddrs() {
|
||||
// 0) Check if banned nodes can be reinstated
|
||||
r.book.ReinstateBadPeers()
|
||||
// 1) Pick a random peer and ask for more.
|
||||
peers := r.Switch.Peers().List()
|
||||
peersCount := len(peers)
|
||||
|
||||
Reference in New Issue
Block a user