Introduce CheckInputsAndUpdateCoins static wrapper in txmempool.cpp
This commit is contained in:
parent
832e0744cb
commit
3e8c91629e
1 changed files with 11 additions and 11 deletions
|
@ -611,6 +611,15 @@ void CTxMemPool::clear()
|
||||||
_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
|
void CTxMemPool::check(const CCoinsViewCache *pcoins) const
|
||||||
{
|
{
|
||||||
if (nCheckFrequency == 0)
|
if (nCheckFrequency == 0)
|
||||||
|
@ -704,12 +713,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
|
||||||
if (fDependsWait)
|
if (fDependsWait)
|
||||||
waitingOnDependants.push_back(&(*it));
|
waitingOnDependants.push_back(&(*it));
|
||||||
else {
|
else {
|
||||||
CValidationState state;
|
CheckInputsAndUpdateCoins(tx, mempoolDuplicate, spendheight);
|
||||||
CAmount txfee = 0;
|
|
||||||
bool fCheckResult = tx.IsCoinBase() ||
|
|
||||||
Consensus::CheckTxInputs(tx, state, mempoolDuplicate, spendheight, txfee);
|
|
||||||
assert(fCheckResult);
|
|
||||||
UpdateCoins(tx, mempoolDuplicate, 1000000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unsigned int stepsSinceLastRemove = 0;
|
unsigned int stepsSinceLastRemove = 0;
|
||||||
|
@ -722,11 +726,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
|
||||||
stepsSinceLastRemove++;
|
stepsSinceLastRemove++;
|
||||||
assert(stepsSinceLastRemove < waitingOnDependants.size());
|
assert(stepsSinceLastRemove < waitingOnDependants.size());
|
||||||
} else {
|
} else {
|
||||||
CAmount txfee = 0;
|
CheckInputsAndUpdateCoins(entry->GetTx(), mempoolDuplicate, spendheight);
|
||||||
bool fCheckResult = entry->GetTx().IsCoinBase() ||
|
|
||||||
Consensus::CheckTxInputs(entry->GetTx(), state, mempoolDuplicate, spendheight, txfee);
|
|
||||||
assert(fCheckResult);
|
|
||||||
UpdateCoins(entry->GetTx(), mempoolDuplicate, 1000000);
|
|
||||||
stepsSinceLastRemove = 0;
|
stepsSinceLastRemove = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue