Changeset View
Changeset View
Standalone View
Standalone View
src/test/coins_tests.cpp
Show All 11 Lines | |||||
#include "utilstrencodings.h" | #include "utilstrencodings.h" | ||||
#include "validation.h" | #include "validation.h" | ||||
#include <map> | #include <map> | ||||
#include <vector> | #include <vector> | ||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
bool ApplyTxInUndo(const CTxInUndo &undo, CCoinsViewCache &view, | |||||
const COutPoint &out); | |||||
void UpdateCoins(const CTransaction &tx, CCoinsViewCache &inputs, | |||||
CTxUndo &txundo, int nHeight); | |||||
namespace { | namespace { | ||||
//! equality test | //! equality test | ||||
bool operator==(const Coin &a, const Coin &b) { | bool operator==(const Coin &a, const Coin &b) { | ||||
// Empty Coin objects are always equal. | // Empty Coin objects are always equal. | ||||
if (a.IsSpent() && b.IsSpent()) { | if (a.IsSpent() && b.IsSpent()) { | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 381 Lines • ▼ Show 20 Lines | for (unsigned int i = 0; i < NUM_SIMULATION_ITERATIONS; i++) { | ||||
outs->Clear(); | outs->Clear(); | ||||
} | } | ||||
// restore inputs | // restore inputs | ||||
if (!tx.IsCoinBase()) { | if (!tx.IsCoinBase()) { | ||||
const COutPoint &out = tx.vin[0].prevout; | const COutPoint &out = tx.vin[0].prevout; | ||||
const CTxInUndo &undoin = undo.vprevout[0]; | const CTxInUndo &undoin = undo.vprevout[0]; | ||||
ApplyTxInUndo(undoin, *(stack.back()), out); | ApplyTxInUndo(undoin, *(stack.back()), out); | ||||
} | } | ||||
// Store as a candidate for reconnection | // Store as a candidate for reconnection | ||||
disconnectedids.insert(undohash); | disconnectedids.insert(undohash); | ||||
// Update the utxoset | // Update the utxoset | ||||
utxoset.erase(undohash); | utxoset.erase(undohash); | ||||
if (!tx.IsCoinBase()) { | if (!tx.IsCoinBase()) { | ||||
utxoset.insert(tx.vin[0].prevout.hash); | utxoset.insert(tx.vin[0].prevout.hash); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 581 Lines • Show Last 20 Lines |