Skip to content

Commit

Permalink
Only announce votes from banned MNs to >= 70215 proto version nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
codablock committed May 28, 2019
1 parent a8b1515 commit ddf29fd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/governance/governance-object.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class CGovernanceVote;

static const int MIN_GOVERNANCE_PEER_PROTO_VERSION = 70213;
static const int GOVERNANCE_FILTER_PROTO_VERSION = 70206;
static const int GOVERNANCE_POSE_BANNED_VOTES_VERSION = 70215;

static const double GOVERNANCE_FILTER_FP_RATE = 0.001;

Expand Down
15 changes: 14 additions & 1 deletion src/governance/governance-vote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,21 @@ void CGovernanceVote::Relay(CConnman& connman) const
return;
}

auto mnList = deterministicMNManager->GetListAtChainTip();
auto dmn = mnList.GetMNByCollateral(masternodeOutpoint);
if (!dmn) {
return;
}

// When this vote is from non-valid (PoSe banned) MN, we should only announce it to v0.14.0.1 nodes as older nodes
// will ban us otherwise.
int minVersion = MIN_GOVERNANCE_PEER_PROTO_VERSION;
if (!mnList.IsMNValid(dmn)) {
minVersion = GOVERNANCE_POSE_BANNED_VOTES_VERSION;
}

CInv inv(MSG_GOVERNANCE_OBJECT_VOTE, GetHash());
connman.RelayInv(inv, MIN_GOVERNANCE_PEER_PROTO_VERSION);
connman.RelayInv(inv, minVersion);
}

void CGovernanceVote::UpdateHash() const
Expand Down

0 comments on commit ddf29fd

Please sign in to comment.