|
6 | 6 | #include "instantx.h" |
7 | 7 | #include "key.h" |
8 | 8 | #include "validation.h" |
| 9 | +#include "masternode-payments.h" |
9 | 10 | #include "masternode-sync.h" |
10 | 11 | #include "masternodeman.h" |
11 | 12 | #include "messagesigner.h" |
@@ -233,7 +234,8 @@ void CInstantSend::Vote(CTxLockCandidate& txLockCandidate, CConnman& connman) |
233 | 234 | int nLockInputHeight = nPrevoutHeight + Params().GetConsensus().nInstantSendConfirmationsRequired - 2; |
234 | 235 |
|
235 | 236 | 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)) { |
237 | 239 | LogPrint("instantsend", "CInstantSend::Vote -- Can't calculate rank for masternode %s\n", activeMasternode.outpoint.ToStringShort()); |
238 | 240 | ++itOutpointLock; |
239 | 241 | continue; |
@@ -1023,7 +1025,8 @@ bool CTxLockVote::IsValid(CNode* pnode, CConnman& connman) const |
1023 | 1025 | int nLockInputHeight = coin.nHeight + Params().GetConsensus().nInstantSendConfirmationsRequired - 2; |
1024 | 1026 |
|
1025 | 1027 | 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)) { |
1027 | 1030 | //can be caused by past versions trying to vote with an invalid protocol |
1028 | 1031 | LogPrint("instantsend", "CTxLockVote::IsValid -- Can't calculate rank for masternode %s\n", outpointMasternode.ToStringShort()); |
1029 | 1032 | return false; |
|
0 commit comments