Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <wallet/wallet.h>
#include <iostream>
#include <memory>
#include <set>
#include <stdint.h>
#include <utility>
#include <vector>
#include <consensus/validation.h>
#include <rpc/server.h>
#include <test/test_dash.h>
#include <validation.h>
#include <wallet/coincontrol.h>
#include <wallet/test/wallet_test_fixture.h>
#include <boost/test/unit_test.hpp>
#include <univalue.h>
Go to the source code of this file.
Classes | |
class | ListCoinsTestingSetup |
class | CreateTransactionTestSetup |
Macros | |
#define | RUN_TESTS 100 |
#define | RANDOM_REPEATS 5 |
Typedefs | |
typedef std::set< CInputCoin > | CoinSet |
Functions | |
UniValue | importmulti (const JSONRPCRequest &request) |
UniValue | dumpwallet (const JSONRPCRequest &request) |
UniValue | importwallet (const JSONRPCRequest &request) |
UniValue | getnewaddress (const JSONRPCRequest &request) |
static void | add_coin (const CAmount &nValue, int nAge=6 *24, bool fIsFromMe=false, int nInput=0) |
static void | empty_wallet (void) |
static bool | equal_sets (CoinSet a, CoinSet b) |
BOOST_AUTO_TEST_CASE (coin_selection_tests) | |
BOOST_AUTO_TEST_CASE (ApproximateBestSubset) | |
static void | AddKey (CWallet &wallet, const CKey &key) |
BOOST_FIXTURE_TEST_CASE (rescan, TestChain100Setup) | |
BOOST_FIXTURE_TEST_CASE (importwallet_rescan, TestChain100Setup) | |
BOOST_FIXTURE_TEST_CASE (coin_mark_dirty_immature_credit, TestChain100Setup) | |
static int64_t | AddTx (CWallet &wallet, uint32_t lockTime, int64_t mockTime, int64_t blockTime) |
BOOST_AUTO_TEST_CASE (ComputeTimeSmart) | |
BOOST_AUTO_TEST_CASE (LoadReceiveRequests) | |
BOOST_FIXTURE_TEST_CASE (ListCoins, ListCoinsTestingSetup) | |
BOOST_FIXTURE_TEST_CASE (CreateTransactionTest, CreateTransactionTestSetup) | |
Variables | |
std::vector< std::unique_ptr< CWalletTx > > | wtxn |
static const CWallet | testWallet ("dummy", WalletDatabase::CreateDummy()) |
static std::vector< COutput > | vCoins |
Macro Definition Documentation
◆ RANDOM_REPEATS
#define RANDOM_REPEATS 5 |
Definition at line 34 of file wallet_tests.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
◆ RUN_TESTS
#define RUN_TESTS 100 |
Definition at line 30 of file wallet_tests.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
Typedef Documentation
◆ CoinSet
typedef std::set<CInputCoin> CoinSet |
Definition at line 38 of file wallet_tests.cpp.
Function Documentation
◆ add_coin()
|
static |
Definition at line 45 of file wallet_tests.cpp.
References MakeTransactionRef(), CMutableTransaction::nLockTime, testWallet, vCoins, CMutableTransaction::vin, CMutableTransaction::vout, and wtxn.
Referenced by BOOST_AUTO_TEST_CASE().
◆ AddKey()
Definition at line 368 of file wallet_tests.cpp.
References CWallet::AddKeyPubKey(), CWallet::cs_wallet, CKey::GetPubKey(), and LOCK.
Referenced by BOOST_FIXTURE_TEST_CASE(), CreateTransactionTestSetup::CreateTransactionTestSetup(), and ListCoinsTestingSetup::ListCoinsTestingSetup().
◆ AddTx()
|
static |
Definition at line 537 of file wallet_tests.cpp.
References CWallet::AddToWallet(), cs_main, CWallet::cs_wallet, CMerkleTx::GetHash(), GetRandHash(), LOCK, MakeTransactionRef(), mapBlockIndex, CWallet::mapWallet, CMutableTransaction::nLockTime, CBlockIndex::nTime, CBlockIndex::phashBlock, CMerkleTx::SetMerkleBranch(), and SetMockTime().
Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_FIXTURE_TEST_CASE().
◆ BOOST_AUTO_TEST_CASE() [1/4]
BOOST_AUTO_TEST_CASE | ( | coin_selection_tests | ) |
Definition at line 80 of file wallet_tests.cpp.
References add_coin(), BOOST_CHECK, BOOST_CHECK_EQUAL, CENT, COIN, CWallet::cs_wallet, empty_wallet(), equal_sets(), LOCK, MIN_CHANGE, RANDOM_REPEATS, RUN_TESTS, CWallet::SelectCoinsMinConf(), testWallet, and vCoins.
◆ BOOST_AUTO_TEST_CASE() [2/4]
BOOST_AUTO_TEST_CASE | ( | ApproximateBestSubset | ) |
Definition at line 347 of file wallet_tests.cpp.
References add_coin(), BOOST_CHECK, BOOST_CHECK_EQUAL, COIN, CWallet::cs_wallet, empty_wallet(), LOCK, CWallet::SelectCoinsMinConf(), testWallet, and vCoins.
◆ BOOST_AUTO_TEST_CASE() [3/4]
BOOST_AUTO_TEST_CASE | ( | ComputeTimeSmart | ) |
Definition at line 564 of file wallet_tests.cpp.
References AddTx(), BOOST_CHECK_EQUAL, and SetMockTime().
◆ BOOST_AUTO_TEST_CASE() [4/4]
BOOST_AUTO_TEST_CASE | ( | LoadReceiveRequests | ) |
Definition at line 590 of file wallet_tests.cpp.
References BOOST_CHECK_EQUAL, and LOCK.
◆ BOOST_FIXTURE_TEST_CASE() [1/5]
BOOST_FIXTURE_TEST_CASE | ( | rescan | , |
TestChain100Setup | |||
) |
Definition at line 374 of file wallet_tests.cpp.
References AddKey(), AddWallet(), BOOST_CHECK_EQUAL, chainActive, UniValue::clear(), COIN, BerkeleyDatabase::CreateDummy(), cs_main, GetBlockFileInfo(), CBlockIndex::GetBlockPos(), CBlockIndex::GetBlockTimeMax(), CWallet::GetImmatureBalance(), CKey::GetPubKey(), GetScriptForRawPubKey(), HexStr(), importmulti(), LOCK, CKey::MakeNewKey(), MAX_BLOCKFILE_SIZE, CDiskBlockPos::nFile, JSONRPCRequest::params, PruneOneBlockFile(), UniValue::push_back(), UniValue::pushKV(), RemoveWallet(), WalletRescanReserver::reserve(), CWallet::ScanForWalletTransactions(), UniValue::setArray(), UniValue::setObject(), strprintf, TIMESTAMP_WINDOW, CChain::Tip(), UnlinkPrunedFiles(), and UniValue::write().
◆ BOOST_FIXTURE_TEST_CASE() [2/5]
BOOST_FIXTURE_TEST_CASE | ( | importwallet_rescan | , |
TestChain100Setup | |||
) |
Definition at line 455 of file wallet_tests.cpp.
References CWallet::AddKeyPubKey(), AddWallet(), BOOST_CHECK_EQUAL, chainActive, BerkeleyDatabase::CreateDummy(), cs_main, CWallet::cs_wallet, dumpwallet(), CBlockIndex::GetBlockTimeMax(), GetScriptForRawPubKey(), CWallet::GetWalletTx(), importwallet(), LOCK, CWallet::mapKeyMetadata, CWallet::mapWallet, JSONRPCRequest::params, UniValue::push_back(), RemoveWallet(), UniValue::setArray(), SetMockTime(), and CChain::Tip().
◆ BOOST_FIXTURE_TEST_CASE() [3/5]
BOOST_FIXTURE_TEST_CASE | ( | coin_mark_dirty_immature_credit | , |
TestChain100Setup | |||
) |
Definition at line 518 of file wallet_tests.cpp.
References CWallet::AddKeyPubKey(), BOOST_CHECK_EQUAL, chainActive, COIN, BerkeleyDatabase::CreateDummy(), cs_main, CWallet::cs_wallet, CBlockIndex::GetBlockHash(), CWalletTx::GetImmatureCredit(), CMerkleTx::hashBlock, LOCK2, MakeTransactionRef(), CWalletTx::MarkDirty(), CMerkleTx::nIndex, and CChain::Tip().
◆ BOOST_FIXTURE_TEST_CASE() [4/5]
BOOST_FIXTURE_TEST_CASE | ( | ListCoins | , |
ListCoinsTestingSetup | |||
) |
Definition at line 652 of file wallet_tests.cpp.
References AddTx(), BOOST_CHECK_EQUAL, COIN, GetScriptForRawPubKey(), and LOCK.
◆ BOOST_FIXTURE_TEST_CASE() [5/5]
BOOST_FIXTURE_TEST_CASE | ( | CreateTransactionTest | , |
CreateTransactionTestSetup | |||
) |
Definition at line 847 of file wallet_tests.cpp.
References BOOST_CHECK, COIN, cs_main, DEFAULT_FALLBACK_FEE, DEFAULT_MIN_RELAY_TX_FEE, LOCK, LOCK2, minRelayTxFee, ONLY_FULLY_MIXED, ONLY_NONDENOMINATED, and strprintf.
◆ dumpwallet()
UniValue dumpwallet | ( | const JSONRPCRequest & | request | ) |
Definition at line 817 of file rpcdump.cpp.
References _(), prevector< N, T, Size, Diff >::begin(), chainActive, CLIENT_BUILD, CHDChain::CountAccounts(), cs_main, CWallet::cs_wallet, EncodeDestination(), EncodeDumpString(), EncodeDumpTime(), prevector< N, T, Size, Diff >::end(), EnsureWalletIsAvailable(), EnsureWalletIsUnlocked(), JSONRPCRequest::fHelp, UniValue::get_str(), CHDChain::GetAccount(), CWallet::GetAllReserveKeys(), CBlockIndex::GetBlockHash(), CBlockIndex::GetBlockTime(), CBasicKeyStore::GetCScript(), CBasicKeyStore::GetCScripts(), CWallet::GetDecryptedHDChain(), CCryptoKeyStore::GetHDChain(), CWallet::GetKey(), CWallet::GetKeyBirthTimes(), CHDChain::GetMnemonic(), CHDChain::GetSeed(), GetTime(), GetWalletForJSONRPCRequest(), CChain::Height(), HelpExampleCli(), HelpExampleRpc(), HexStr(), JSONRPCError(), LOCK2, CWallet::m_script_metadata, CWallet::mapAddressBook, CWallet::mapHdPubKeys, CExtKey::Neuter(), CHDAccount::nExternalChainCounter, CHDAccount::nInternalChainCounter, NullUniValue, Pair(), JSONRPCRequest::params, UniValue::push_back(), RPC_INTERNAL_ERROR, RPC_INVALID_PARAMETER, CBitcoinExtKeyBase< K, Size, Type >::SetKey(), CExtKey::SetMaster(), UniValue::size(), strprintf, CChain::Tip(), base_blob< BITS >::ToString(), CBase58Data::ToString(), and UniValue::VOBJ.
Referenced by BOOST_FIXTURE_TEST_CASE().
◆ empty_wallet()
|
static |
Definition at line 68 of file wallet_tests.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
◆ equal_sets()
Definition at line 74 of file wallet_tests.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
◆ getnewaddress()
UniValue getnewaddress | ( | const JSONRPCRequest & | request | ) |
Definition at line 134 of file rpcwallet.cpp.
References AccountFromValue(), cs_main, CWallet::cs_wallet, EncodeDestination(), EnsureWalletIsAvailable(), JSONRPCRequest::fHelp, CPubKey::GetID(), CWallet::GetKeyFromPool(), GetWalletForJSONRPCRequest(), HelpExampleCli(), HelpExampleRpc(), CCryptoKeyStore::IsLocked(), UniValue::isNull(), JSONRPCError(), LOCK2, NullUniValue, JSONRPCRequest::params, RPC_WALLET_KEYPOOL_RAN_OUT, CWallet::SetAddressBook(), UniValue::size(), and CWallet::TopUpKeyPool().
Referenced by CreateTransactionTestSetup::GetRecipients().
◆ importmulti()
UniValue importmulti | ( | const JSONRPCRequest & | request | ) |
Definition at line 1306 of file rpcdump.cpp.
References chainActive, UniValue::clear(), cs_main, CWallet::cs_wallet, EnsureWalletIsAvailable(), EnsureWalletIsUnlocked(), UniValue::exists(), JSONRPCRequest::fHelp, UniValue::get_bool(), CBlockIndex::GetBlockTime(), GetImportTimestamp(), CBlockIndex::GetMedianTimePast(), UniValue::getValues(), GetWalletForJSONRPCRequest(), HelpExampleCli(), UniValue::isNull(), JSONRPCError(), LOCK2, NullUniValue, JSONRPCRequest::params, ProcessImport(), UniValue::push_back(), UniValue::pushKV(), CWallet::ReacceptWalletTransactions(), CWallet::RescanFromTime(), WalletRescanReserver::reserve(), RPC_MISC_ERROR, RPC_WALLET_ERROR, RPCTypeCheck(), UniValue::setArray(), UniValue::size(), strprintf, TIMESTAMP_WINDOW, CChain::Tip(), UniValue::VARR, and UniValue::VOBJ.
Referenced by BOOST_FIXTURE_TEST_CASE().
◆ importwallet()
UniValue importwallet | ( | const JSONRPCRequest & | request | ) |
Definition at line 468 of file rpcdump.cpp.
References _(), CWallet::AddCScript(), CWallet::AddKeyPubKey(), chainActive, cs_main, CWallet::cs_wallet, DecodeDumpString(), DecodeDumpTime(), EncodeDestination(), EnsureWalletIsAvailable(), EnsureWalletIsUnlocked(), JSONRPCRequest::fHelp, fPruneMode, UniValue::get_str(), CBlockIndex::GetBlockTime(), CPubKey::GetID(), CBitcoinSecret::GetKey(), CKey::GetPubKey(), GetWalletForJSONRPCRequest(), CBasicKeyStore::HaveCScript(), CWallet::HaveKey(), HelpExampleCli(), HelpExampleRpc(), IsHex(), JSONRPCError(), LOCK2, LogPrintf, CWallet::m_script_metadata, CWallet::mapKeyMetadata, CWallet::MarkDirty(), NullUniValue, JSONRPCRequest::params, ParseHex(), CWallet::RescanFromTime(), WalletRescanReserver::reserve(), RPC_INVALID_PARAMETER, RPC_WALLET_ERROR, CWallet::SetAddressBook(), CBitcoinSecret::SetString(), CWallet::ShowProgress, UniValue::size(), CChain::Tip(), CWallet::UpdateTimeFirstKey(), and CKey::VerifyPubKey().
Referenced by BOOST_FIXTURE_TEST_CASE().
Variable Documentation
◆ testWallet
|
static |
Referenced by add_coin(), and BOOST_AUTO_TEST_CASE().
◆ vCoins
|
static |
Definition at line 43 of file wallet_tests.cpp.
Referenced by add_coin(), addCoin(), CWallet::AvailableCoins(), BOOST_AUTO_TEST_CASE(), CoinSelection(), empty_wallet(), CWallet::GetAvailableBalance(), CWallet::GetCollateralTxDSIn(), CWallet::HasCollateralInputs(), CWallet::SelectCoins(), CWallet::SelectCoinsMinConf(), CWallet::SelectDenominatedAmounts(), and CWallet::SelectPSInOutPairsByDenominations().
◆ wtxn
std::vector<std::unique_ptr<CWalletTx> > wtxn |
Definition at line 36 of file wallet_tests.cpp.
Referenced by add_coin(), and empty_wallet().