Skip to content

Commit

Permalink
Revert CMasternodePayments::IsTransactionValid to the logic before th…
Browse files Browse the repository at this point in the history
…e recent refactorings (#2237)

partially reverts #2216
  • Loading branch information
codablock authored and UdjinM6 committed Aug 27, 2018
1 parent 73c2ddd commit e415fd0
Showing 1 changed file with 3 additions and 24 deletions.
27 changes: 3 additions & 24 deletions src/masternode-payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,30 +706,9 @@ std::string CMasternodePayments::GetRequiredPaymentsString(int nBlockHeight) con

bool CMasternodePayments::IsTransactionValid(const CTransaction& txNew, int nBlockHeight, CAmount blockReward) const
{
std::vector<CTxOut> voutMasternodePayments;
if (!GetBlockTxOuts(nBlockHeight, blockReward, voutMasternodePayments)) {
LogPrintf("CMasternodePayments::%s -- ERROR failed to get payees for block at height %s\n", __func__, nBlockHeight);
return false;
}

for (const auto& txout : voutMasternodePayments) {
bool found = false;
for (const auto& txout2 : txNew.vout) {
if (txout == txout2) {
found = true;
break;
}
}
if (!found) {
CTxDestination dest;
if (!ExtractDestination(txout.scriptPubKey, dest))
assert(false);
LogPrintf("CMasternodePayments::%s -- ERROR failed to find expected payee %s in block at height %s\n", __func__, CBitcoinAddress(dest).ToString(), nBlockHeight);
return false;
}
}

return true;
LOCK(cs_mapMasternodeBlocks);
const auto it = mapMasternodeBlocks.find(nBlockHeight);
return it == mapMasternodeBlocks.end() ? true : it->second.IsTransactionValid(txNew);
}

void CMasternodePayments::CheckAndRemove()
Expand Down

0 comments on commit e415fd0

Please sign in to comment.