Skip to content

Commit

Permalink
[Consensus] Check against current hash when no payee is found
Browse files Browse the repository at this point in the history
Instead of using always the genesis hash (which is constant)
  • Loading branch information
random-zebra committed May 23, 2021
1 parent ede4519 commit ad2cc30
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/masternode-payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,10 @@ bool CMasternodePayments::GetLegacyMasternodeTxOut(int nHeight, std::vector<CTxO
CScript payee;
if (!GetBlockPayee(nHeight, payee)) {
//no masternode detected
MasternodeRef winningNode = mnodeman.GetCurrentMasterNode(Params().GetConsensus().hashGenesisBlock);
const Consensus::Params& consensus = Params().GetConsensus();
const uint256& hash = consensus.NetworkUpgradeActive(nHeight, Consensus::UPGRADE_V6_0) ?
mnodeman.GetHashAtHeight(nHeight - 1) : consensus.hashGenesisBlock;
MasternodeRef winningNode = mnodeman.GetCurrentMasterNode(hash);
if (winningNode) {
payee = winningNode->GetPayeeScript();
} else {
Expand Down

0 comments on commit ad2cc30

Please sign in to comment.