mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-26 00:25:17 +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()
|
e.peerMapMx.Lock()
|
||||||
for _, p := range announce.PeerList {
|
for _, p := range announce.PeerList {
|
||||||
|
if _, ok := e.uncooperativePeersMap[string(p.PeerId)]; ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if bytes.Equal(p.PeerId, e.pubSub.GetPeerID()) {
|
if bytes.Equal(p.PeerId, e.pubSub.GetPeerID()) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,7 @@ type CeremonyDataClockConsensusEngine struct {
|
|||||||
peerAnnounceMap map[string]*protobufs.CeremonyPeerListAnnounce
|
peerAnnounceMap map[string]*protobufs.CeremonyPeerListAnnounce
|
||||||
peerMap map[string]*peerInfo
|
peerMap map[string]*peerInfo
|
||||||
activeChannelsMap map[string]ChannelServer
|
activeChannelsMap map[string]ChannelServer
|
||||||
|
uncooperativePeersMap map[string]*peerInfo
|
||||||
fullResync bool
|
fullResync bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,17 +147,18 @@ func NewCeremonyDataClockConsensusEngine(
|
|||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
},
|
},
|
||||||
lastFrameReceivedAt: time.Time{},
|
lastFrameReceivedAt: time.Time{},
|
||||||
frameProverTrie: &tries.RollingFrecencyCritbitTrie{},
|
frameProverTrie: &tries.RollingFrecencyCritbitTrie{},
|
||||||
frameSeenProverTrie: &tries.RollingFrecencyCritbitTrie{},
|
frameSeenProverTrie: &tries.RollingFrecencyCritbitTrie{},
|
||||||
pendingCommits: make(chan *anypb.Any),
|
pendingCommits: make(chan *anypb.Any),
|
||||||
pendingCommitWorkers: engineConfig.PendingCommitWorkers,
|
pendingCommitWorkers: engineConfig.PendingCommitWorkers,
|
||||||
prover: qcrypto.DefaultKZGProver(),
|
prover: qcrypto.DefaultKZGProver(),
|
||||||
stagedKeyCommits: make(InclusionMap),
|
stagedKeyCommits: make(InclusionMap),
|
||||||
stagedKeyPolynomials: make(PolynomialMap),
|
stagedKeyPolynomials: make(PolynomialMap),
|
||||||
syncingStatus: SyncStatusNotSyncing,
|
syncingStatus: SyncStatusNotSyncing,
|
||||||
peerAnnounceMap: map[string]*protobufs.CeremonyPeerListAnnounce{},
|
peerAnnounceMap: map[string]*protobufs.CeremonyPeerListAnnounce{},
|
||||||
peerMap: map[string]*peerInfo{},
|
peerMap: map[string]*peerInfo{},
|
||||||
|
uncooperativePeersMap: map[string]*peerInfo{},
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Info("constructing consensus engine")
|
logger.Info("constructing consensus engine")
|
||||||
|
@ -892,6 +892,10 @@ func (e *CeremonyDataClockConsensusEngine) collect(
|
|||||||
"could not establish direct channel",
|
"could not establish direct channel",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
)
|
)
|
||||||
|
e.peerMapMx.Lock()
|
||||||
|
e.uncooperativePeersMap[string(peerId)] = e.peerMap[string(peerId)]
|
||||||
|
delete(e.peerMap, string(peerId))
|
||||||
|
e.peerMapMx.Unlock()
|
||||||
} else {
|
} else {
|
||||||
from := latest.FrameNumber
|
from := latest.FrameNumber
|
||||||
if from == 0 {
|
if from == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user