@@ -611,6 +611,15 @@ void CTxMemPool::clear()
611611 _clear ();
612612}
613613
614+ static void CheckInputsAndUpdateCoins (const CTransaction& tx, CCoinsViewCache& mempoolDuplicate, const int64_t spendheight)
615+ {
616+ CValidationState state;
617+ CAmount txfee = 0 ;
618+ bool fCheckResult = tx.IsCoinBase () || Consensus::CheckTxInputs (tx, state, mempoolDuplicate, spendheight, txfee);
619+ assert (fCheckResult );
620+ UpdateCoins (tx, mempoolDuplicate, 1000000 );
621+ }
622+
614623void CTxMemPool::check (const CCoinsViewCache *pcoins) const
615624{
616625 if (nCheckFrequency == 0 )
@@ -704,12 +713,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
704713 if (fDependsWait )
705714 waitingOnDependants.push_back (&(*it));
706715 else {
707- CValidationState state;
708- CAmount txfee = 0 ;
709- bool fCheckResult = tx.IsCoinBase () ||
710- Consensus::CheckTxInputs (tx, state, mempoolDuplicate, spendheight, txfee);
711- assert (fCheckResult );
712- UpdateCoins (tx, mempoolDuplicate, 1000000 );
716+ CheckInputsAndUpdateCoins (tx, mempoolDuplicate, spendheight);
713717 }
714718 }
715719 unsigned int stepsSinceLastRemove = 0 ;
@@ -722,11 +726,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
722726 stepsSinceLastRemove++;
723727 assert (stepsSinceLastRemove < waitingOnDependants.size ());
724728 } else {
725- CAmount txfee = 0 ;
726- bool fCheckResult = entry->GetTx ().IsCoinBase () ||
727- Consensus::CheckTxInputs (entry->GetTx (), state, mempoolDuplicate, spendheight, txfee);
728- assert (fCheckResult );
729- UpdateCoins (entry->GetTx (), mempoolDuplicate, 1000000 );
729+ CheckInputsAndUpdateCoins (entry->GetTx (), mempoolDuplicate, spendheight);
730730 stepsSinceLastRemove = 0 ;
731731 }
732732 }
0 commit comments