Browse Source

Introduce CheckInputsAndUpdateCoins static wrapper in txmempool.cpp

0.16
Jorge Timón 8 years ago
parent
commit
3e8c91629e
No known key found for this signature in database
GPG Key ID: 8866C18EA1C944A2
  1. 22
      src/txmempool.cpp

22
src/txmempool.cpp

@ -611,6 +611,15 @@ void CTxMemPool::clear() @@ -611,6 +611,15 @@ void CTxMemPool::clear()
_clear();
}
static void CheckInputsAndUpdateCoins(const CTransaction& tx, CCoinsViewCache& mempoolDuplicate, const int64_t spendheight)
{
CValidationState state;
CAmount txfee = 0;
bool fCheckResult = tx.IsCoinBase() || Consensus::CheckTxInputs(tx, state, mempoolDuplicate, spendheight, txfee);
assert(fCheckResult);
UpdateCoins(tx, mempoolDuplicate, 1000000);
}
void CTxMemPool::check(const CCoinsViewCache *pcoins) const
{
if (nCheckFrequency == 0)
@ -704,12 +713,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const @@ -704,12 +713,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
if (fDependsWait)
waitingOnDependants.push_back(&(*it));
else {
CValidationState state;
CAmount txfee = 0;
bool fCheckResult = tx.IsCoinBase() ||
Consensus::CheckTxInputs(tx, state, mempoolDuplicate, spendheight, txfee);
assert(fCheckResult);
UpdateCoins(tx, mempoolDuplicate, 1000000);
CheckInputsAndUpdateCoins(tx, mempoolDuplicate, spendheight);
}
}
unsigned int stepsSinceLastRemove = 0;
@ -722,11 +726,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const @@ -722,11 +726,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
stepsSinceLastRemove++;
assert(stepsSinceLastRemove < waitingOnDependants.size());
} else {
CAmount txfee = 0;
bool fCheckResult = entry->GetTx().IsCoinBase() ||
Consensus::CheckTxInputs(entry->GetTx(), state, mempoolDuplicate, spendheight, txfee);
assert(fCheckResult);
UpdateCoins(entry->GetTx(), mempoolDuplicate, 1000000);
CheckInputsAndUpdateCoins(entry->GetTx(), mempoolDuplicate, spendheight);
stepsSinceLastRemove = 0;
}
}

Loading…
Cancel
Save