PIVX Core  5.6.99
P2P Digital Currency
Classes | Typedefs | Functions | Variables
coins_tests.cpp File Reference
#include "test/test_pivx.h"
#include "coins.h"
#include "script/standard.h"
#include "uint256.h"
#include "undo.h"
#include "utilstrencodings.h"
#include "random.h"
#include "sapling/incrementalmerkletree.h"
#include <vector>
#include <map>
#include <boost/test/unit_test.hpp>
Include dependency graph for coins_tests.cpp:

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, bool fSkipInvalid=false)
 
template<typename Tree >
bool GetAnchorAt (const CCoinsViewCache &cache, const uint256 &rt, Tree &tree)
 
template<>
bool GetAnchorAt (const CCoinsViewCache &cache, const uint256 &rt, SaplingMerkleTree &tree)
 
void checkNullifierCache (const CCoinsViewCache &cache, const TxWithNullifiers &txWithNullifiers, bool shouldBeInCache)
 
 BOOST_AUTO_TEST_CASE (nullifier_regression_test)
 
template<typename Tree >
void anchorPopRegressionTestImpl ()
 
 BOOST_AUTO_TEST_CASE (anchor_pop_regression_test)
 
template<typename Tree >
void anchorRegressionTestImpl ()
 
 BOOST_AUTO_TEST_CASE (anchor_regression_test)
 
 BOOST_AUTO_TEST_CASE (nullifiers_test)
 
template<typename Tree >
void anchorsFlushImpl ()
 
 BOOST_AUTO_TEST_CASE (anchors_flush_test)
 
template<typename Tree >
void anchorsTestImpl ()
 
 BOOST_AUTO_TEST_CASE (anchors_test)
 
 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)
 
void SetCoinsValue (CAmount value, Coin &coin)
 
size_t InsertCoinsMapEntry (CCoinsMap &map, CAmount value, char flags)
 
void GetCoinsMapEntry (const CCoinsMap &map, CAmount &value, char &flags)
 
void WriteCoinsViewEntry (CCoinsView &view, CAmount value, char flags)
 
void CheckAccessCoin (CAmount base_value, CAmount cache_value, CAmount expected_value, char cache_flags, char expected_flags)
 
 BOOST_AUTO_TEST_CASE (ccoins_access)
 
void CheckSpendCoins (CAmount base_value, CAmount cache_value, CAmount expected_value, char cache_flags, char expected_flags)
 
 BOOST_AUTO_TEST_CASE (ccoins_spend)
 
void CheckAddCoinBase (CAmount base_value, CAmount cache_value, CAmount modify_value, CAmount expected_value, char cache_flags, char expected_flags)
 
template<typename... Args>
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)
 

Variables

UtxoData utxoData
 

Typedef Documentation

◆ UtxoData

typedef std::map<COutPoint, std::tuple<CTransaction,CTxUndo,Coin> > UtxoData

Definition at line 761 of file coins_tests.cpp.

Function Documentation

◆ anchorPopRegressionTestImpl()

template<typename Tree >
void anchorPopRegressionTestImpl ( )

Definition at line 316 of file coins_tests.cpp.

Here is the call graph for this function:

◆ anchorRegressionTestImpl()

template<typename Tree >
void anchorRegressionTestImpl ( )

Definition at line 394 of file coins_tests.cpp.

Here is the call graph for this function:

◆ anchorsFlushImpl()

template<typename Tree >
void anchorsFlushImpl ( )

Definition at line 504 of file coins_tests.cpp.

Here is the call graph for this function:

◆ anchorsTestImpl()

template<typename Tree >
void anchorsTestImpl ( )
Todo:
: These tests should be more methodical.

Definition at line 539 of file coins_tests.cpp.

Here is the call graph for this function:

◆ ApplyTxInUndo()

int ApplyTxInUndo ( Coin &&  undo,
CCoinsViewCache view,
const COutPoint out 
)

Restore the UTXO in a Coin at a given COutPoint.

Parameters
undoThe Coin to be restored.
viewThe coins view to which to apply the changes.
outThe out point that corresponds to the tx input.
Returns
A DisconnectResult as an int

Definition at line 1255 of file validation.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [1/13]

BOOST_AUTO_TEST_CASE ( anchor_pop_regression_test  )

Definition at line 389 of file coins_tests.cpp.

◆ BOOST_AUTO_TEST_CASE() [2/13]

BOOST_AUTO_TEST_CASE ( anchor_regression_test  )

Definition at line 476 of file coins_tests.cpp.

◆ BOOST_AUTO_TEST_CASE() [3/13]

BOOST_AUTO_TEST_CASE ( anchors_flush_test  )

Definition at line 534 of file coins_tests.cpp.

◆ BOOST_AUTO_TEST_CASE() [4/13]

BOOST_AUTO_TEST_CASE ( anchors_test  )

Definition at line 609 of file coins_tests.cpp.

◆ BOOST_AUTO_TEST_CASE() [5/13]

BOOST_AUTO_TEST_CASE ( ccoins_access  )

Definition at line 1093 of file coins_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/13]

BOOST_AUTO_TEST_CASE ( ccoins_add  )

Definition at line 1215 of file coins_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/13]

BOOST_AUTO_TEST_CASE ( ccoins_serialization  )

Definition at line 938 of file coins_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/13]

BOOST_AUTO_TEST_CASE ( ccoins_spend  )

Definition at line 1144 of file coins_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/13]

BOOST_AUTO_TEST_CASE ( ccoins_write  )

Definition at line 1257 of file coins_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/13]

BOOST_AUTO_TEST_CASE ( coins_cache_simulation_test  )

Definition at line 625 of file coins_tests.cpp.

◆ BOOST_AUTO_TEST_CASE() [11/13]

BOOST_AUTO_TEST_CASE ( nullifier_regression_test  )

Definition at line 228 of file coins_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [12/13]

BOOST_AUTO_TEST_CASE ( nullifiers_test  )

Definition at line 481 of file coins_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [13/13]

BOOST_AUTO_TEST_CASE ( updatecoins_simulation_test  )

Definition at line 778 of file coins_tests.cpp.

◆ CheckAccessCoin()

void CheckAccessCoin ( CAmount  base_value,
CAmount  cache_value,
CAmount  expected_value,
char  cache_flags,
char  expected_flags 
)

Definition at line 1080 of file coins_tests.cpp.

Here is the caller graph for this function:

◆ CheckAddCoin()

template<typename... Args>
void CheckAddCoin ( Args &&...  args)

Definition at line 1209 of file coins_tests.cpp.

Here is the caller graph for this function:

◆ CheckAddCoinBase()

void CheckAddCoinBase ( CAmount  base_value,
CAmount  cache_value,
CAmount  modify_value,
CAmount  expected_value,
char  cache_flags,
char  expected_flags 
)

Definition at line 1182 of file coins_tests.cpp.

◆ checkNullifierCache()

void checkNullifierCache ( const CCoinsViewCache cache,
const TxWithNullifiers &  txWithNullifiers,
bool  shouldBeInCache 
)

Definition at line 222 of file coins_tests.cpp.

Here is the caller graph for this function:

◆ CheckSpendCoins()

void CheckSpendCoins ( CAmount  base_value,
CAmount  cache_value,
CAmount  expected_value,
char  cache_flags,
char  expected_flags 
)

Definition at line 1131 of file coins_tests.cpp.

Here is the caller graph for this function:

◆ CheckWriteCoins()

void CheckWriteCoins ( CAmount  parent_value,
CAmount  child_value,
CAmount  expected_value,
char  parent_flags,
char  child_flags,
char  expected_flags 
)

Definition at line 1238 of file coins_tests.cpp.

Here is the caller graph for this function:

◆ FindRandomFrom()

UtxoData::iterator FindRandomFrom ( const std::set< COutPoint > &  utxoSet)

Definition at line 764 of file coins_tests.cpp.

Here is the call graph for this function:

◆ GetAnchorAt() [1/2]

template<>
bool GetAnchorAt ( const CCoinsViewCache cache,
const uint256 rt,
SaplingMerkleTree tree 
)

Definition at line 218 of file coins_tests.cpp.

Here is the call graph for this function:

◆ GetAnchorAt() [2/2]

template<typename Tree >
bool GetAnchorAt ( const CCoinsViewCache cache,
const uint256 rt,
Tree &  tree 
)
Here is the caller graph for this function:

◆ GetCoinsMapEntry()

void GetCoinsMapEntry ( const CCoinsMap map,
CAmount value,
char &  flags 
)

Definition at line 1040 of file coins_tests.cpp.

◆ InsertCoinsMapEntry()

size_t InsertCoinsMapEntry ( CCoinsMap map,
CAmount  value,
char  flags 
)

Definition at line 1025 of file coins_tests.cpp.

Here is the caller graph for this function:

◆ SetCoinsValue()

void SetCoinsValue ( CAmount  value,
Coin coin 
)

Definition at line 1013 of file coins_tests.cpp.

◆ UpdateCoins()

void UpdateCoins ( const CTransaction tx,
CCoinsViewCache inputs,
CTxUndo txundo,
int  nHeight,
bool  fSkipInvalid = false 
)

Definition at line 1014 of file validation.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteCoinsViewEntry()

void WriteCoinsViewEntry ( CCoinsView view,
CAmount  value,
char  flags 
)

Definition at line 1057 of file coins_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ utxoData

UtxoData utxoData

Definition at line 762 of file coins_tests.cpp.