mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
Revert CMasternodePayments::IsTransactionValid to the logic before the recent refactorings (#2237)
partially reverts #2216
This commit is contained in:
parent
73c2ddde7a
commit
e415fd049a
@ -706,30 +706,9 @@ std::string CMasternodePayments::GetRequiredPaymentsString(int nBlockHeight) con
|
|||||||
|
|
||||||
bool CMasternodePayments::IsTransactionValid(const CTransaction& txNew, int nBlockHeight, CAmount blockReward) const
|
bool CMasternodePayments::IsTransactionValid(const CTransaction& txNew, int nBlockHeight, CAmount blockReward) const
|
||||||
{
|
{
|
||||||
std::vector<CTxOut> voutMasternodePayments;
|
LOCK(cs_mapMasternodeBlocks);
|
||||||
if (!GetBlockTxOuts(nBlockHeight, blockReward, voutMasternodePayments)) {
|
const auto it = mapMasternodeBlocks.find(nBlockHeight);
|
||||||
LogPrintf("CMasternodePayments::%s -- ERROR failed to get payees for block at height %s\n", __func__, nBlockHeight);
|
return it == mapMasternodeBlocks.end() ? true : it->second.IsTransactionValid(txNew);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMasternodePayments::CheckAndRemove()
|
void CMasternodePayments::CheckAndRemove()
|
||||||
|
Loading…
Reference in New Issue
Block a user