diff --git a/node/consensus/ceremony/broadcast_messaging.go b/node/consensus/ceremony/broadcast_messaging.go index 119e302..9cae3f5 100644 --- a/node/consensus/ceremony/broadcast_messaging.go +++ b/node/consensus/ceremony/broadcast_messaging.go @@ -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 } diff --git a/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go b/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go index d1ddafb..3dbbbc5 100644 --- a/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go +++ b/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go @@ -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") diff --git a/node/consensus/ceremony/consensus_frames.go b/node/consensus/ceremony/consensus_frames.go index 7d44b02..67ae961 100644 --- a/node/consensus/ceremony/consensus_frames.go +++ b/node/consensus/ceremony/consensus_frames.go @@ -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 {