![]() |
Bitcoin Core
25.99.0
P2P Digital Currency
|
#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 <vector>
#include <boost/test/unit_test.hpp>
Go to the source code of this file.
Classes | |
class | SingleEntryCacheTest |
Typedefs | |
typedef std::map< COutPoint, std::tuple< CTransaction, CTxUndo, Coin > > | UtxoData |
Functions | |
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) |
void | SimulationTest (CCoinsView *base, bool fake_best_block) |
BOOST_AUTO_TEST_CASE (coins_cache_simulation_test) | |
UtxoData::iterator | FindRandomFrom (const std::set< COutPoint > &utxoSet) |
BOOST_AUTO_TEST_CASE (updatecoins_simulation_test) | |
BOOST_AUTO_TEST_CASE (ccoins_serialization) | |
static void | SetCoinsValue (CAmount value, Coin &coin) |
static size_t | InsertCoinsMapEntry (CCoinsMap &map, CAmount value, char flags) |
void | GetCoinsMapEntry (const CCoinsMap &map, CAmount &value, char &flags, const COutPoint &outp=OUTPOINT) |
void | WriteCoinsViewEntry (CCoinsView &view, CAmount value, char flags) |
static void | CheckAccessCoin (CAmount base_value, CAmount cache_value, CAmount expected_value, char cache_flags, char expected_flags) |
BOOST_AUTO_TEST_CASE (ccoins_access) | |
static void | CheckSpendCoins (CAmount base_value, CAmount cache_value, CAmount expected_value, char cache_flags, char expected_flags) |
BOOST_AUTO_TEST_CASE (ccoins_spend) | |
static void | CheckAddCoinBase (CAmount base_value, CAmount cache_value, CAmount modify_value, CAmount expected_value, char cache_flags, char expected_flags, bool coinbase) |
template<typename... Args> | |
static void | CheckAddCoin (Args &&... args) |
BOOST_AUTO_TEST_CASE (ccoins_add) | |
void | CheckWriteCoins (CAmount parent_value, CAmount child_value, CAmount expected_value, char parent_flags, char child_flags, char expected_flags) |
BOOST_AUTO_TEST_CASE (ccoins_write) | |
Coin | MakeCoin () |
void | TestFlushBehavior (CCoinsViewCacheTest *view, CCoinsViewDB &base, std::vector< std::unique_ptr< CCoinsViewCacheTest >> &all_caches, bool do_erasing_flush) |
For CCoinsViewCache instances backed by either another cache instance or leveldb, test cache behavior and flag state (DIRTY/FRESH) by. More... | |
BOOST_AUTO_TEST_CASE (ccoins_flush_behavior) | |
BOOST_AUTO_TEST_CASE (coins_resource_is_used) | |
Variables | |
static const unsigned int | NUM_SIMULATION_ITERATIONS = 40000 |
UtxoData | utxoData |
static const COutPoint | OUTPOINT |
static const CAmount | SPENT = -1 |
static const CAmount | ABSENT = -2 |
static const CAmount | FAIL = -3 |
static const CAmount | VALUE1 = 100 |
static const CAmount | VALUE2 = 200 |
static const CAmount | VALUE3 = 300 |
static const char | DIRTY = CCoinsCacheEntry::DIRTY |
static const char | FRESH = CCoinsCacheEntry::FRESH |
static const char | NO_ENTRY = -1 |
static const auto | FLAGS = {char(0), FRESH, DIRTY, char(DIRTY | FRESH)} |
static const auto | CLEAN_FLAGS = {char(0), FRESH} |
static const auto | ABSENT_FLAGS = {NO_ENTRY} |
typedef std::map<COutPoint, std::tuple<CTransaction,CTxUndo,Coin> > UtxoData |
Definition at line 288 of file coins_tests.cpp.
int ApplyTxInUndo | ( | Coin && | undo, |
CCoinsViewCache & | view, | ||
const COutPoint & | out | ||
) |
Restore the UTXO in a Coin at a given COutPoint.
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. |
Definition at line 1947 of file validation.cpp.
BOOST_AUTO_TEST_CASE | ( | ccoins_access | ) |
BOOST_AUTO_TEST_CASE | ( | ccoins_add | ) |
BOOST_AUTO_TEST_CASE | ( | ccoins_flush_behavior | ) |
BOOST_AUTO_TEST_CASE | ( | ccoins_serialization | ) |
BOOST_AUTO_TEST_CASE | ( | ccoins_spend | ) |
BOOST_AUTO_TEST_CASE | ( | ccoins_write | ) |
BOOST_AUTO_TEST_CASE | ( | coins_cache_simulation_test | ) |
BOOST_AUTO_TEST_CASE | ( | coins_resource_is_used | ) |
BOOST_AUTO_TEST_CASE | ( | updatecoins_simulation_test | ) |
|
static |
Definition at line 636 of file coins_tests.cpp.
|
static |
Definition at line 765 of file coins_tests.cpp.
|
static |
Definition at line 738 of file coins_tests.cpp.
|
static |
Definition at line 687 of file coins_tests.cpp.
void CheckWriteCoins | ( | CAmount | parent_value, |
CAmount | child_value, | ||
CAmount | expected_value, | ||
char | parent_flags, | ||
char | child_flags, | ||
char | expected_flags | ||
) |
Definition at line 801 of file coins_tests.cpp.
UtxoData::iterator FindRandomFrom | ( | const std::set< COutPoint > & | utxoSet | ) |
Definition at line 291 of file coins_tests.cpp.
void GetCoinsMapEntry | ( | const CCoinsMap & | map, |
CAmount & | value, | ||
char & | flags, | ||
const COutPoint & | outp = OUTPOINT |
||
) |
Definition at line 597 of file coins_tests.cpp.
Definition at line 582 of file coins_tests.cpp.
Coin MakeCoin | ( | ) |
Definition at line 887 of file coins_tests.cpp.
Definition at line 570 of file coins_tests.cpp.
void SimulationTest | ( | CCoinsView * | base, |
bool | fake_best_block | ||
) |
Definition at line 118 of file coins_tests.cpp.
void TestFlushBehavior | ( | CCoinsViewCacheTest * | view, |
CCoinsViewDB & | base, | ||
std::vector< std::unique_ptr< CCoinsViewCacheTest >> & | all_caches, | ||
bool | do_erasing_flush | ||
) |
For CCoinsViewCache instances backed by either another cache instance or leveldb, test cache behavior and flag state (DIRTY/FRESH) by.
do_erasing_flush
) Flushing the caches again (with erasing),do_erasing_flush
) Ensure the entry has been written to the parent and is no longer in the cache,Definition at line 907 of file coins_tests.cpp.
void UpdateCoins | ( | const CTransaction & | tx, |
CCoinsViewCache & | inputs, | ||
CTxUndo & | txundo, | ||
int | nHeight | ||
) |
Definition at line 1785 of file validation.cpp.
void WriteCoinsViewEntry | ( | CCoinsView & | view, |
CAmount | value, | ||
char | flags | ||
) |
Definition at line 614 of file coins_tests.cpp.
|
static |
Definition at line 557 of file coins_tests.cpp.
|
static |
Definition at line 568 of file coins_tests.cpp.
|
static |
Definition at line 567 of file coins_tests.cpp.
|
static |
Definition at line 562 of file coins_tests.cpp.
|
static |
Definition at line 558 of file coins_tests.cpp.
Definition at line 566 of file coins_tests.cpp.
|
static |
Definition at line 563 of file coins_tests.cpp.
|
static |
Definition at line 564 of file coins_tests.cpp.
|
static |
Definition at line 102 of file coins_tests.cpp.
|
static |
Definition at line 555 of file coins_tests.cpp.
|
static |
Definition at line 556 of file coins_tests.cpp.
UtxoData utxoData |
Definition at line 289 of file coins_tests.cpp.
|
static |
Definition at line 559 of file coins_tests.cpp.
|
static |
Definition at line 560 of file coins_tests.cpp.
|
static |
Definition at line 561 of file coins_tests.cpp.