aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJorge Timón <jtimon@jtimon.cc>2017-04-18 22:49:47 +0200
committerJorge Timón <jtimon@jtimon.cc>2017-09-20 23:25:56 +0200
commit3e8c91629e646f1ace700fe394f5bbef88b9cd31 (patch)
tree53a051608c170569d221cadf6734fb369a2dce7d /src
parent832e0744cb8b1e1625cdb19b257f97316ac16a90 (diff)
Introduce CheckInputsAndUpdateCoins static wrapper in txmempool.cpp
Diffstat (limited to 'src')
-rw-r--r--src/txmempool.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index ef955a17ea..508658e5d0 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -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
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
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;
}
}