Merge #7976: Remove obsolete reference to CValidationState from UpdateCoins.

c8b9248 Remove obsolete reference to CValidationState from UpdateCoins. (21E14)
This commit is contained in:
Wladimir J. van der Laan 2016-05-09 11:57:16 +02:00 committed by Alexander Block
parent 93be53e34e
commit 5222e9377d
4 changed files with 9 additions and 10 deletions

View File

@ -18,7 +18,7 @@
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
int ApplyTxInUndo(Coin&& undo, CCoinsViewCache& view, const COutPoint& out); int ApplyTxInUndo(Coin&& undo, CCoinsViewCache& view, const COutPoint& out);
void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache& inputs, CTxUndo &txundo, int nHeight); void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, CTxUndo &txundo, int nHeight);
namespace namespace
{ {
@ -378,8 +378,7 @@ BOOST_AUTO_TEST_CASE(updatecoins_simulation_test)
// Call UpdateCoins on the top cache // Call UpdateCoins on the top cache
CTxUndo undo; CTxUndo undo;
CValidationState dummy; UpdateCoins(tx, *(stack.back()), undo, height);
UpdateCoins(tx, dummy, *(stack.back()), undo, height);
// Update the utxo set for future spends // Update the utxo set for future spends
utxoset.insert(outpoint); utxoset.insert(outpoint);

View File

@ -856,7 +856,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
else { else {
CValidationState state; CValidationState state;
assert(CheckInputs(tx, state, mempoolDuplicate, false, 0, false, NULL)); assert(CheckInputs(tx, state, mempoolDuplicate, false, 0, false, NULL));
UpdateCoins(tx, state, mempoolDuplicate, 1000000); UpdateCoins(tx, mempoolDuplicate, 1000000);
} }
} }
unsigned int stepsSinceLastRemove = 0; unsigned int stepsSinceLastRemove = 0;
@ -870,7 +870,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
assert(stepsSinceLastRemove < waitingOnDependants.size()); assert(stepsSinceLastRemove < waitingOnDependants.size());
} else { } else {
assert(CheckInputs(entry->GetTx(), state, mempoolDuplicate, false, 0, false, NULL)); assert(CheckInputs(entry->GetTx(), state, mempoolDuplicate, false, 0, false, NULL));
UpdateCoins(entry->GetTx(), state, mempoolDuplicate, 1000000); UpdateCoins(entry->GetTx(), mempoolDuplicate, 1000000);
stepsSinceLastRemove = 0; stepsSinceLastRemove = 0;
} }
} }

View File

@ -1424,7 +1424,7 @@ void static InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state
} }
} }
void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight) void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, CTxUndo &txundo, int nHeight)
{ {
// mark inputs spent // mark inputs spent
if (!tx.IsCoinBase()) { if (!tx.IsCoinBase()) {
@ -1439,10 +1439,10 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach
AddCoins(inputs, tx, nHeight); AddCoins(inputs, tx, nHeight);
} }
void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, int nHeight) void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, int nHeight)
{ {
CTxUndo txundo; CTxUndo txundo;
UpdateCoins(tx, state, inputs, txundo, nHeight); UpdateCoins(tx, inputs, txundo, nHeight);
} }
bool CScriptCheck::operator()() { bool CScriptCheck::operator()() {
@ -2206,7 +2206,7 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd
if (i > 0) { if (i > 0) {
blockundo.vtxundo.push_back(CTxUndo()); blockundo.vtxundo.push_back(CTxUndo());
} }
UpdateCoins(tx, state, view, i == 0 ? undoDummy : blockundo.vtxundo.back(), pindex->nHeight); UpdateCoins(tx, view, i == 0 ? undoDummy : blockundo.vtxundo.back(), pindex->nHeight);
vPos.push_back(std::make_pair(tx.GetHash(), pos)); vPos.push_back(std::make_pair(tx.GetHash(), pos));
pos.nTxOffset += ::GetSerializeSize(tx, SER_DISK, CLIENT_VERSION); pos.nTxOffset += ::GetSerializeSize(tx, SER_DISK, CLIENT_VERSION);

View File

@ -357,7 +357,7 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi
unsigned int flags, bool cacheStore, std::vector<CScriptCheck> *pvChecks = NULL); unsigned int flags, bool cacheStore, std::vector<CScriptCheck> *pvChecks = NULL);
/** Apply the effects of this transaction on the UTXO set represented by view */ /** Apply the effects of this transaction on the UTXO set represented by view */
void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, int nHeight); void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, int nHeight);
/** Context-independent validity checks */ /** Context-independent validity checks */
bool CheckTransaction(const CTransaction& tx, CValidationState& state); bool CheckTransaction(const CTransaction& tx, CValidationState& state);