Skip to content

Commit

Permalink
[Cleanup] Remove unused parameter in GetCurrentMasternode
Browse files Browse the repository at this point in the history
Also pass the genesis hash instead of a null hash (as it was the
original behavior before bfa628e) when
no-masternode-to-pay is found in GetLegacyMasternodeTxOut (e.g. when
there are less than 9 masternodes enabled on the network, and they are
all scheduled already).
  • Loading branch information
random-zebra committed May 23, 2021
1 parent dd3bce9 commit ede4519
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/masternode-payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ bool CMasternodePayments::GetLegacyMasternodeTxOut(int nHeight, std::vector<CTxO
CScript payee;
if (!GetBlockPayee(nHeight, payee)) {
//no masternode detected
MasternodeRef winningNode = mnodeman.GetCurrentMasterNode(nHeight, UINT256_ZERO);
MasternodeRef winningNode = mnodeman.GetCurrentMasterNode(Params().GetConsensus().hashGenesisBlock);
if (winningNode) {
payee = winningNode->GetPayeeScript();
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/masternodeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ MasternodeRef CMasternodeMan::GetNextMasternodeInQueueForPayment(int nBlockHeigh
return pBestMasternode;
}

MasternodeRef CMasternodeMan::GetCurrentMasterNode(int nHeight, const uint256& hash) const
MasternodeRef CMasternodeMan::GetCurrentMasterNode(const uint256& hash) const
{
int minProtocol = ActiveProtocol();
int64_t score = 0;
Expand Down Expand Up @@ -617,7 +617,7 @@ std::vector<std::pair<MasternodeRef, int>> CMasternodeMan::GetMnScores(int nLast

for (int nHeight = nChainHeight - nLast; nHeight < nChainHeight + 20; nHeight++) {
const uint256& hash = GetHashAtHeight(nHeight - 101);
MasternodeRef winner = GetCurrentMasterNode(nHeight, hash);
MasternodeRef winner = GetCurrentMasterNode(hash);
if (winner) {
ret.emplace_back(winner, nHeight);
}
Expand Down
4 changes: 2 additions & 2 deletions src/masternodeman.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ class CMasternodeMan
/// Find an entry in the masternode list that is next to be paid
MasternodeRef GetNextMasternodeInQueueForPayment(int nBlockHeight, bool fFilterSigTime, int& nCount, const CBlockIndex* pChainTip = nullptr) const;

/// Get the current winner for this block
MasternodeRef GetCurrentMasterNode(int nHeight, const uint256& hash) const;
/// Get the winner for this block hash
MasternodeRef GetCurrentMasterNode(const uint256& hash) const;

/// vector of pairs <masternode winner, height>
std::vector<std::pair<MasternodeRef, int>> GetMnScores(int nLast) const;
Expand Down

0 comments on commit ede4519

Please sign in to comment.