PIVX Core  5.6.99
P2P Digital Currency
Macros | Typedefs | Functions | Variables
wallet_tests.cpp File Reference
#include "wallet/test/wallet_test_fixture.h"
#include "consensus/merkle.h"
#include "rpc/server.h"
#include "txmempool.h"
#include "validation.h"
#include "wallet/wallet.h"
#include "wallet/walletutil.h"
#include <set>
#include <utility>
#include <vector>
#include <boost/test/unit_test.hpp>
#include <univalue.h>
Include dependency graph for wallet_tests.cpp:

Go to the source code of this file.

Macros

#define RUN_TESTS   100
 
#define RANDOM_REPEATS   5
 

Typedefs

typedef std::set< std::pair< const CWalletTx *, unsigned int > > CoinSet
 

Functions

UniValue importmulti (const JSONRPCRequest &request)
 
UniValue dumpwallet (const JSONRPCRequest &request)
 
UniValue importwallet (const JSONRPCRequest &request)
 
 BOOST_AUTO_TEST_CASE (coin_selection_tests)
 
 BOOST_FIXTURE_TEST_CASE (rescan, TestChain100Setup)
 
 BOOST_FIXTURE_TEST_CASE (importwallet_rescan, TestChain100Setup)
 
void removeTxFromMempool (CWalletTx &wtx)
 
CBlockIndexSimpleFakeMine (CWalletTx &wtx, CWallet &wallet, CBlockIndex *pprev=nullptr)
 Mimic block creation. More...
 
void fakeMempoolInsertion (const CTransactionRef &wtxCredit)
 
CWalletTxBuildAndLoadTxToWallet (const std::vector< CTxIn > &vin, const std::vector< CTxOut > &vout, CWallet &wallet)
 
CWalletTxReceiveBalanceWith (const std::vector< CTxOut > &vout, CWallet &wallet)
 
void CheckBalances (const CWalletTx &tx, const CAmount &nCreditAll, const CAmount &nCreditSpendable, const CAmount &nAvailableCredit, const CAmount &nDebitAll, const CAmount &nDebitSpendable)
 
 BOOST_AUTO_TEST_CASE (cached_balances_tests)
 Validates the correct behaviour of the CWalletTx "standard" balance methods. More...
 

Variables

std::vector< std::unique_ptr< CWalletTx > > wtxn
 

Macro Definition Documentation

◆ RANDOM_REPEATS

#define RANDOM_REPEATS   5

Definition at line 31 of file wallet_tests.cpp.

◆ RUN_TESTS

#define RUN_TESTS   100

Definition at line 27 of file wallet_tests.cpp.

Typedef Documentation

◆ CoinSet

typedef std::set<std::pair<const CWalletTx*,unsigned int> > CoinSet

Definition at line 35 of file wallet_tests.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

BOOST_AUTO_TEST_CASE ( cached_balances_tests  )

Validates the correct behaviour of the CWalletTx "standard" balance methods.

(where "standard" is defined by direct P2PKH scripts, no P2CS contracts nor other types)

1) CWalletTx::GetCredit. 2) CWalletTx::GetDebit. 4) CWalletTx::GetAvailableCredit 3) CWallet::GetUnconfirmedBalance.

Definition at line 569 of file wallet_tests.cpp.

◆ BOOST_AUTO_TEST_CASE() [2/2]

BOOST_AUTO_TEST_CASE ( coin_selection_tests  )

Definition at line 75 of file wallet_tests.cpp.

◆ BOOST_FIXTURE_TEST_CASE() [1/2]

BOOST_FIXTURE_TEST_CASE ( importwallet_rescan  ,
TestChain100Setup   
)

Definition at line 426 of file wallet_tests.cpp.

Here is the call graph for this function:

◆ BOOST_FIXTURE_TEST_CASE() [2/2]

BOOST_FIXTURE_TEST_CASE ( rescan  ,
TestChain100Setup   
)
Todo:
: Prune the older block file.
Todo:
: after pruning, check that the rescan for the first key fails.

Definition at line 348 of file wallet_tests.cpp.

Here is the call graph for this function:

◆ BuildAndLoadTxToWallet()

CWalletTx& BuildAndLoadTxToWallet ( const std::vector< CTxIn > &  vin,
const std::vector< CTxOut > &  vout,
CWallet wallet 
)

Definition at line 522 of file wallet_tests.cpp.

Here is the caller graph for this function:

◆ CheckBalances()

void CheckBalances ( const CWalletTx tx,
const CAmount nCreditAll,
const CAmount nCreditSpendable,
const CAmount nAvailableCredit,
const CAmount nDebitAll,
const CAmount nDebitSpendable 
)

Definition at line 543 of file wallet_tests.cpp.

Here is the call graph for this function:

◆ dumpwallet()

UniValue dumpwallet ( const JSONRPCRequest request)

Definition at line 497 of file rpcdump.cpp.

Here is the call graph for this function:

◆ fakeMempoolInsertion()

void fakeMempoolInsertion ( const CTransactionRef wtxCredit)

Definition at line 515 of file wallet_tests.cpp.

◆ importmulti()

UniValue importmulti ( const JSONRPCRequest request)

Definition at line 960 of file rpcdump.cpp.

Here is the call graph for this function:

◆ importwallet()

UniValue importwallet ( const JSONRPCRequest request)
Todo:
: Needs further review over the HD flow, staking addresses and multisig import.
Todo:
: This is not entirely true.. needs to be reviewed properly.

Definition at line 330 of file rpcdump.cpp.

Here is the call graph for this function:

◆ ReceiveBalanceWith()

CWalletTx& ReceiveBalanceWith ( const std::vector< CTxOut > &  vout,
CWallet wallet 
)

Definition at line 535 of file wallet_tests.cpp.

Here is the call graph for this function:

◆ removeTxFromMempool()

void removeTxFromMempool ( CWalletTx wtx)

Definition at line 482 of file wallet_tests.cpp.

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

◆ SimpleFakeMine()

CBlockIndex* SimpleFakeMine ( CWalletTx wtx,
CWallet wallet,
CBlockIndex pprev = nullptr 
)

Mimic block creation.

Definition at line 496 of file wallet_tests.cpp.

Here is the call graph for this function:

Variable Documentation

◆ wtxn

std::vector<std::unique_ptr<CWalletTx> > wtxn

Definition at line 33 of file wallet_tests.cpp.