mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-24 23:55:18 +00:00
fix: stop trying to sync with uncooperative peers
This commit is contained in:
parent
53a19f3f23
commit
b4ad1aed18
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
@ -146,17 +147,18 @@ func NewCeremonyDataClockConsensusEngine(
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
},
|
||||
lastFrameReceivedAt: time.Time{},
|
||||
frameProverTrie: &tries.RollingFrecencyCritbitTrie{},
|
||||
frameSeenProverTrie: &tries.RollingFrecencyCritbitTrie{},
|
||||
pendingCommits: make(chan *anypb.Any),
|
||||
pendingCommitWorkers: engineConfig.PendingCommitWorkers,
|
||||
prover: qcrypto.DefaultKZGProver(),
|
||||
stagedKeyCommits: make(InclusionMap),
|
||||
stagedKeyPolynomials: make(PolynomialMap),
|
||||
syncingStatus: SyncStatusNotSyncing,
|
||||
peerAnnounceMap: map[string]*protobufs.CeremonyPeerListAnnounce{},
|
||||
peerMap: map[string]*peerInfo{},
|
||||
lastFrameReceivedAt: time.Time{},
|
||||
frameProverTrie: &tries.RollingFrecencyCritbitTrie{},
|
||||
frameSeenProverTrie: &tries.RollingFrecencyCritbitTrie{},
|
||||
pendingCommits: make(chan *anypb.Any),
|
||||
pendingCommitWorkers: engineConfig.PendingCommitWorkers,
|
||||
prover: qcrypto.DefaultKZGProver(),
|
||||
stagedKeyCommits: make(InclusionMap),
|
||||
stagedKeyPolynomials: make(PolynomialMap),
|
||||
syncingStatus: SyncStatusNotSyncing,
|
||||
peerAnnounceMap: map[string]*protobufs.CeremonyPeerListAnnounce{},
|
||||
peerMap: map[string]*peerInfo{},
|
||||
uncooperativePeersMap: map[string]*peerInfo{},
|
||||
}
|
||||
|
||||
logger.Info("constructing consensus engine")
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user