fix: stop trying to sync with uncooperative peers

This commit is contained in:
Cassandra Heart 2023-10-05 15:17:06 -05:00
parent 53a19f3f23
commit b4ad1aed18
No known key found for this signature in database
GPG Key ID: 6352152859385958
3 changed files with 21 additions and 11 deletions

View File

@ -158,6 +158,10 @@ func (e *CeremonyDataClockConsensusEngine) handleCeremonyPeerListAnnounce(
e.peerMapMx.Lock()
for _, p := range announce.PeerList {
if _, ok := e.uncooperativePeersMap[string(p.PeerId)]; ok {
continue
}
if bytes.Equal(p.PeerId, e.pubSub.GetPeerID()) {
continue
}

View File

@ -87,6 +87,7 @@ type CeremonyDataClockConsensusEngine struct {
peerAnnounceMap map[string]*protobufs.CeremonyPeerListAnnounce
peerMap map[string]*peerInfo
activeChannelsMap map[string]ChannelServer
uncooperativePeersMap map[string]*peerInfo
fullResync bool
}
@ -157,6 +158,7 @@ func NewCeremonyDataClockConsensusEngine(
syncingStatus: SyncStatusNotSyncing,
peerAnnounceMap: map[string]*protobufs.CeremonyPeerListAnnounce{},
peerMap: map[string]*peerInfo{},
uncooperativePeersMap: map[string]*peerInfo{},
}
logger.Info("constructing consensus engine")

View File

@ -892,6 +892,10 @@ func (e *CeremonyDataClockConsensusEngine) collect(
"could not establish direct channel",
zap.Error(err),
)
e.peerMapMx.Lock()
e.uncooperativePeersMap[string(peerId)] = e.peerMap[string(peerId)]
delete(e.peerMap, string(peerId))
e.peerMapMx.Unlock()
} else {
from := latest.FrameNumber
if from == 0 {