Skip to content

Commit

Permalink
use block height from caller
Browse files Browse the repository at this point in the history
Github-Pull: PIVX-Project#2772
Rebased-From: a50ba7e
  • Loading branch information
PeterL73 authored and Fuzzbawls committed Nov 22, 2022
1 parent b221c7f commit d285af0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/masternode-payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ void CMasternodePayments::AddWinningMasternode(CMasternodePaymentWinner& winnerI
mapMasternodeBlocks[winnerIn.nBlockHeight].AddPayee(winnerIn.payee, 1);
}

bool CMasternodeBlockPayees::IsTransactionValid(const CTransaction& txNew)
bool CMasternodeBlockPayees::IsTransactionValid(const CTransaction& txNew, int nBlockHeight)
{
LOCK(cs_vecPayments);

Expand All @@ -582,8 +582,7 @@ bool CMasternodeBlockPayees::IsTransactionValid(const CTransaction& txNew)
if (nMaxSignatures < MNPAYMENTS_SIGNATURES_REQUIRED) return true;

std::string strPayeesPossible = "";
int nHeight = mnodeman.GetBestHeight();
CAmount requiredMasternodePayment = GetMasternodePayment(nHeight);
CAmount requiredMasternodePayment = GetMasternodePayment(nBlockHeight);

for (CMasternodePayee& payee : vecPayments) {
bool found = false;
Expand Down Expand Up @@ -671,7 +670,7 @@ bool CMasternodePayments::IsTransactionValid(const CTransaction& txNew, const CB
LOCK(cs_mapMasternodeBlocks);

if (mapMasternodeBlocks.count(nBlockHeight)) {
return mapMasternodeBlocks[nBlockHeight].IsTransactionValid(txNew);
return mapMasternodeBlocks[nBlockHeight].IsTransactionValid(txNew, nBlockHeight);
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion src/masternode-payments.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class CMasternodeBlockPayees
return false;
}

bool IsTransactionValid(const CTransaction& txNew);
bool IsTransactionValid(const CTransaction& txNew, int nBlockHeight);
std::string GetRequiredPaymentsString();

SERIALIZE_METHODS(CMasternodeBlockPayees, obj) { READWRITE(obj.nBlockHeight, obj.vecPayments); }
Expand Down

0 comments on commit d285af0

Please sign in to comment.