@@ -611,6 +611,15 @@ void CTxMemPool::clear()
611
611
_clear ();
612
612
}
613
613
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
+
614
623
void CTxMemPool::check (const CCoinsViewCache *pcoins) const
615
624
{
616
625
if (nCheckFrequency == 0 )
@@ -704,12 +713,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
704
713
if (fDependsWait )
705
714
waitingOnDependants.push_back (&(*it));
706
715
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);
713
717
}
714
718
}
715
719
unsigned int stepsSinceLastRemove = 0 ;
@@ -722,11 +726,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
722
726
stepsSinceLastRemove++;
723
727
assert (stepsSinceLastRemove < waitingOnDependants.size ());
724
728
} 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);
730
730
stepsSinceLastRemove = 0 ;
731
731
}
732
732
}
0 commit comments