#include <addresstype.h>
#include <clientversion.h>
#include <coins.h>
#include <streams.h>
#include <test/util/poolresourcetester.h>
#include <test/util/random.h>
#include <test/util/setup_common.h>
#include <txdb.h>
#include <uint256.h>
#include <undo.h>
#include <util/strencodings.h>
#include <map>
#include <string>
#include <variant>
#include <vector>
#include <boost/test/unit_test.hpp>
Go to the source code of this file.
|
int | ApplyTxInUndo (Coin &&undo, CCoinsViewCache &view, const COutPoint &out) |
| Restore the UTXO in a Coin at a given COutPoint. More...
|
|
void | UpdateCoins (const CTransaction &tx, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight) |
|
| BOOST_FIXTURE_TEST_CASE (coins_cache_simulation_test, CacheTest) |
|
| BOOST_FIXTURE_TEST_CASE (updatecoins_simulation_test, UpdateTest) |
|
| BOOST_AUTO_TEST_CASE (ccoins_serialization) |
|
static void | SetCoinsValue (const CAmount value, Coin &coin) |
|
static size_t | InsertCoinsMapEntry (CCoinsMap &map, CoinsCachePair &sentinel, const CoinEntry &cache_coin) |
|
static MaybeCoin | GetCoinsMapEntry (const CCoinsMap &map, const COutPoint &outp=OUTPOINT) |
|
static void | WriteCoinsViewEntry (CCoinsView &view, const MaybeCoin &cache_coin) |
|
static void | CheckAccessCoin (const CAmount base_value, const MaybeCoin &cache_coin, const MaybeCoin &expected) |
|
| BOOST_AUTO_TEST_CASE (ccoins_access) |
|
static void | CheckSpendCoins (const CAmount base_value, const MaybeCoin &cache_coin, const MaybeCoin &expected) |
|
| BOOST_AUTO_TEST_CASE (ccoins_spend) |
|
static void | CheckAddCoin (const CAmount base_value, const MaybeCoin &cache_coin, const CAmount modify_value, const CoinOrError &expected, const bool coinbase) |
|
| BOOST_AUTO_TEST_CASE (ccoins_add) |
|
static void | CheckWriteCoins (const MaybeCoin &parent, const MaybeCoin &child, const CoinOrError &expected) |
|
| BOOST_AUTO_TEST_CASE (ccoins_write) |
|
| BOOST_FIXTURE_TEST_CASE (ccoins_flush_behavior, FlushTest) |
|
| BOOST_AUTO_TEST_CASE (coins_resource_is_used) |
|
|
static const unsigned int | NUM_SIMULATION_ITERATIONS = 40000 |
|
static const COutPoint | OUTPOINT |
|
constexpr CAmount | SPENT {-1} |
|
constexpr CAmount | ABSENT {-2} |
|
constexpr CAmount | VALUE1 {100} |
|
constexpr CAmount | VALUE2 {200} |
|
constexpr CAmount | VALUE3 {300} |
|
constexpr MaybeCoin | MISSING {std::nullopt} |
|
constexpr MaybeCoin | SPENT_DIRTY {{SPENT, CoinEntry::State::DIRTY}} |
|
constexpr MaybeCoin | SPENT_DIRTY_FRESH {{SPENT, CoinEntry::State::DIRTY_FRESH}} |
|
constexpr MaybeCoin | SPENT_FRESH {{SPENT, CoinEntry::State::FRESH}} |
|
constexpr MaybeCoin | SPENT_CLEAN {{SPENT, CoinEntry::State::CLEAN}} |
|
constexpr MaybeCoin | VALUE1_DIRTY {{VALUE1, CoinEntry::State::DIRTY}} |
|
constexpr MaybeCoin | VALUE1_DIRTY_FRESH {{VALUE1, CoinEntry::State::DIRTY_FRESH}} |
|
constexpr MaybeCoin | VALUE1_FRESH {{VALUE1, CoinEntry::State::FRESH}} |
|
constexpr MaybeCoin | VALUE1_CLEAN {{VALUE1, CoinEntry::State::CLEAN}} |
|
constexpr MaybeCoin | VALUE2_DIRTY {{VALUE2, CoinEntry::State::DIRTY}} |
|
constexpr MaybeCoin | VALUE2_DIRTY_FRESH {{VALUE2, CoinEntry::State::DIRTY_FRESH}} |
|
constexpr MaybeCoin | VALUE2_FRESH {{VALUE2, CoinEntry::State::FRESH}} |
|
constexpr MaybeCoin | VALUE2_CLEAN {{VALUE2, CoinEntry::State::CLEAN}} |
|
constexpr MaybeCoin | VALUE3_DIRTY {{VALUE3, CoinEntry::State::DIRTY}} |
|
constexpr MaybeCoin | VALUE3_DIRTY_FRESH {{VALUE3, CoinEntry::State::DIRTY_FRESH}} |
|
constexpr auto | EX_OVERWRITE_UNSPENT {"Attempted to overwrite an unspent coin (when possible_overwrite is false)"} |
|
constexpr auto | EX_FRESH_MISAPPLIED {"FRESH flag misapplied to coin that exists in parent cache"} |
|
◆ CoinOrError
◆ MaybeCoin
◆ ApplyTxInUndo()
Restore the UTXO in a Coin at a given COutPoint.
- Parameters
-
undo | The Coin to be restored. |
view | The coins view to which to apply the changes. |
out | The out point that corresponds to the tx input. |
- Returns
- A DisconnectResult as an int
Definition at line 2266 of file validation.cpp.
◆ BOOST_AUTO_TEST_CASE() [1/6]
BOOST_AUTO_TEST_CASE |
( |
ccoins_access |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [2/6]
BOOST_AUTO_TEST_CASE |
( |
ccoins_add |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [3/6]
BOOST_AUTO_TEST_CASE |
( |
ccoins_serialization |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [4/6]
BOOST_AUTO_TEST_CASE |
( |
ccoins_spend |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [5/6]
BOOST_AUTO_TEST_CASE |
( |
ccoins_write |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [6/6]
BOOST_AUTO_TEST_CASE |
( |
coins_resource_is_used |
| ) |
|
◆ BOOST_FIXTURE_TEST_CASE() [1/3]
BOOST_FIXTURE_TEST_CASE |
( |
ccoins_flush_behavior |
, |
|
|
FlushTest |
|
|
) |
| |
◆ BOOST_FIXTURE_TEST_CASE() [2/3]
BOOST_FIXTURE_TEST_CASE |
( |
coins_cache_simulation_test |
, |
|
|
CacheTest |
|
|
) |
| |
◆ BOOST_FIXTURE_TEST_CASE() [3/3]
BOOST_FIXTURE_TEST_CASE |
( |
updatecoins_simulation_test |
, |
|
|
UpdateTest |
|
|
) |
| |
◆ CheckAccessCoin()
◆ CheckAddCoin()
◆ CheckSpendCoins()
◆ CheckWriteCoins()
◆ GetCoinsMapEntry()
◆ InsertCoinsMapEntry()
◆ SetCoinsValue()
static void SetCoinsValue |
( |
const CAmount |
value, |
|
|
Coin & |
coin |
|
) |
| |
|
static |
◆ UpdateCoins()
◆ WriteCoinsViewEntry()
◆ ABSENT
◆ EX_FRESH_MISAPPLIED
constexpr auto EX_FRESH_MISAPPLIED {"FRESH flag misapplied to coin that exists in parent cache"} |
|
constexpr |
◆ EX_OVERWRITE_UNSPENT
constexpr auto EX_OVERWRITE_UNSPENT {"Attempted to overwrite an unspent coin (when possible_overwrite is false)"} |
|
constexpr |
◆ MISSING
◆ NUM_SIMULATION_ITERATIONS
const unsigned int NUM_SIMULATION_ITERATIONS = 40000 |
|
static |
◆ OUTPOINT
◆ SPENT
◆ SPENT_CLEAN
◆ SPENT_DIRTY
◆ SPENT_DIRTY_FRESH
◆ SPENT_FRESH
◆ VALUE1
◆ VALUE1_CLEAN
◆ VALUE1_DIRTY
◆ VALUE1_DIRTY_FRESH
◆ VALUE1_FRESH
◆ VALUE2
◆ VALUE2_CLEAN
◆ VALUE2_DIRTY
◆ VALUE2_DIRTY_FRESH
◆ VALUE2_FRESH
◆ VALUE3
◆ VALUE3_DIRTY
◆ VALUE3_DIRTY_FRESH