diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-10-03 13:10:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-03 13:10:07 +0800 |
commit | eb1fa8a1f9e8ba3cab764ecfe06336e63d798184 (patch) | |
tree | b2193797a8774c24d62370a1f8e92a1592deaf02 /core | |
parent | a6e8ee4d4800a1978eb474a01091f83937743718 (diff) | |
download | tangerine-consensus-eb1fa8a1f9e8ba3cab764ecfe06336e63d798184.tar tangerine-consensus-eb1fa8a1f9e8ba3cab764ecfe06336e63d798184.tar.gz tangerine-consensus-eb1fa8a1f9e8ba3cab764ecfe06336e63d798184.tar.bz2 tangerine-consensus-eb1fa8a1f9e8ba3cab764ecfe06336e63d798184.tar.lz tangerine-consensus-eb1fa8a1f9e8ba3cab764ecfe06336e63d798184.tar.xz tangerine-consensus-eb1fa8a1f9e8ba3cab764ecfe06336e63d798184.tar.zst tangerine-consensus-eb1fa8a1f9e8ba3cab764ecfe06336e63d798184.zip |
core: Prevent duplicated nack complaint (#162)
Diffstat (limited to 'core')
-rw-r--r-- | core/dkg-tsig-protocol.go | 10 | ||||
-rw-r--r-- | core/test/governance.go | 5 |
2 files changed, 14 insertions, 1 deletions
diff --git a/core/dkg-tsig-protocol.go b/core/dkg-tsig-protocol.go index 2bb4c52..9c0c476 100644 --- a/core/dkg-tsig-protocol.go +++ b/core/dkg-tsig-protocol.go @@ -212,8 +212,16 @@ func (d *dkgProtocol) enforceNackComplaints(complaints []*types.DKGComplaint) { if !complaint.IsNack() { continue } - from := complaint.ProposerID to := complaint.PrivateShare.ProposerID + // Do not propose nack complaint to itself. + if to == d.ID { + continue + } + from := complaint.ProposerID + // Nack complaint is already proposed. + if from == d.ID { + continue + } if _, exist := d.antiComplaintReceived[from][to]; !exist { d.recv.ProposeDKGComplaint(&types.DKGComplaint{ diff --git a/core/test/governance.go b/core/test/governance.go index ee4491f..473c331 100644 --- a/core/test/governance.go +++ b/core/test/governance.go @@ -127,6 +127,11 @@ func (g *Governance) PrivateKeys() (keys []crypto.PrivateKey) { func (g *Governance) AddDKGComplaint(complaint *types.DKGComplaint) { g.lock.Lock() defer g.lock.Unlock() + for _, comp := range g.DKGComplaint[complaint.Round] { + if comp == complaint { + return + } + } g.DKGComplaint[complaint.Round] = append(g.DKGComplaint[complaint.Round], complaint) } |