Skip to content

Commit 214bce9

Browse files
committed
Only require valid collaterals for votes and triggers (dashpay#2947)
* Only require valid collaterals for votes and triggers * Bump proto version * Only announce votes from banned MNs to >= 70215 proto version nodes
1 parent b293e6d commit 214bce9

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

src/governance-object.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -498,14 +498,6 @@ bool CGovernanceObject::IsValidLocally(std::string& strError, bool& fMissingMast
498498
strError = "Failed to find Masternode by UTXO, missing masternode=" + strOutpoint;
499499
return false;
500500
}
501-
if (!mnList.IsMNValid(dmn)) {
502-
if (mnList.IsMNPoSeBanned(dmn)) {
503-
strError = "Masternode is POSE_BANNED, masternode=" + strOutpoint;
504-
} else {
505-
strError = "Masternode is invalid for unknown reason, masternode=" + strOutpoint;
506-
}
507-
return false;
508-
}
509501

510502
// Check that we have a valid MN signature
511503
if (!CheckSignature(dmn->pdmnState->pubKeyOperator)) {

src/governance-object.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class CGovernanceVote;
2525

2626
static const int MIN_GOVERNANCE_PEER_PROTO_VERSION = 70213;
2727
static const int GOVERNANCE_FILTER_PROTO_VERSION = 70206;
28+
static const int GOVERNANCE_POSE_BANNED_VOTES_VERSION = 70215;
2829

2930
static const double GOVERNANCE_FILTER_FP_RATE = 0.001;
3031

src/governance-vote.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,21 @@ void CGovernanceVote::Relay(CConnman& connman) const
120120
return;
121121
}
122122

123+
auto mnList = deterministicMNManager->GetListAtChainTip();
124+
auto dmn = mnList.GetMNByCollateral(masternodeOutpoint);
125+
if (!dmn) {
126+
return;
127+
}
128+
129+
// When this vote is from non-valid (PoSe banned) MN, we should only announce it to v0.14.0.1 nodes as older nodes
130+
// will ban us otherwise.
131+
int minVersion = MIN_GOVERNANCE_PEER_PROTO_VERSION;
132+
if (!mnList.IsMNValid(dmn)) {
133+
minVersion = GOVERNANCE_POSE_BANNED_VOTES_VERSION;
134+
}
135+
123136
CInv inv(MSG_GOVERNANCE_OBJECT_VOTE, GetHash());
124-
connman.RelayInv(inv, MIN_GOVERNANCE_PEER_PROTO_VERSION);
137+
connman.RelayInv(inv, minVersion);
125138
}
126139

127140
void CGovernanceVote::UpdateHash() const
@@ -258,7 +271,7 @@ bool CGovernanceVote::IsValid(bool useVotingKey) const
258271
return false;
259272
}
260273

261-
auto dmn = deterministicMNManager->GetListAtChainTip().GetValidMNByCollateral(masternodeOutpoint);
274+
auto dmn = deterministicMNManager->GetListAtChainTip().GetMNByCollateral(masternodeOutpoint);
262275
if (!dmn) {
263276
LogPrint("gobject", "CGovernanceVote::IsValid -- Unknown Masternode - %s\n", masternodeOutpoint.ToStringShort());
264277
return false;

src/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313

14-
static const int PROTOCOL_VERSION = 70214;
14+
static const int PROTOCOL_VERSION = 70215;
1515

1616
//! initial proto version, to be increased after version/verack negotiation
1717
static const int INIT_PROTO_VERSION = 209;

0 commit comments

Comments
 (0)