Skip to content

Commit 8c2d16f

Browse files
authored
Limit IS quorums by updated MNs only (#2107)
1 parent 0a71c69 commit 8c2d16f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/instantx.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "instantx.h"
77
#include "key.h"
88
#include "validation.h"
9+
#include "masternode-payments.h"
910
#include "masternode-sync.h"
1011
#include "masternodeman.h"
1112
#include "messagesigner.h"
@@ -233,7 +234,8 @@ void CInstantSend::Vote(CTxLockCandidate& txLockCandidate, CConnman& connman)
233234
int nLockInputHeight = nPrevoutHeight + Params().GetConsensus().nInstantSendConfirmationsRequired - 2;
234235

235236
int nRank;
236-
if(!mnodeman.GetMasternodeRank(activeMasternode.outpoint, nRank, nLockInputHeight, MIN_INSTANTSEND_PROTO_VERSION)) {
237+
int nMinRequiredProtocol = std::max(MIN_INSTANTSEND_PROTO_VERSION, mnpayments.GetMinMasternodePaymentsProto());
238+
if(!mnodeman.GetMasternodeRank(activeMasternode.outpoint, nRank, nLockInputHeight, nMinRequiredProtocol)) {
237239
LogPrint("instantsend", "CInstantSend::Vote -- Can't calculate rank for masternode %s\n", activeMasternode.outpoint.ToStringShort());
238240
++itOutpointLock;
239241
continue;
@@ -1023,7 +1025,8 @@ bool CTxLockVote::IsValid(CNode* pnode, CConnman& connman) const
10231025
int nLockInputHeight = coin.nHeight + Params().GetConsensus().nInstantSendConfirmationsRequired - 2;
10241026

10251027
int nRank;
1026-
if(!mnodeman.GetMasternodeRank(outpointMasternode, nRank, nLockInputHeight, MIN_INSTANTSEND_PROTO_VERSION)) {
1028+
int nMinRequiredProtocol = std::max(MIN_INSTANTSEND_PROTO_VERSION, mnpayments.GetMinMasternodePaymentsProto());
1029+
if(!mnodeman.GetMasternodeRank(outpointMasternode, nRank, nLockInputHeight, nMinRequiredProtocol)) {
10271030
//can be caused by past versions trying to vote with an invalid protocol
10281031
LogPrint("instantsend", "CTxLockVote::IsValid -- Can't calculate rank for masternode %s\n", outpointMasternode.ToStringShort());
10291032
return false;

0 commit comments

Comments
 (0)