Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/wallet_tests.cpp
Show First 20 Lines • Show All 386 Lines • ▼ Show 20 Lines | ListCoinsTestingSetup() { | ||||
::ChainActive().Height()); | ::ChainActive().Height()); | ||||
BOOST_CHECK(result.last_failed_block.IsNull()); | BOOST_CHECK(result.last_failed_block.IsNull()); | ||||
} | } | ||||
~ListCoinsTestingSetup() { wallet.reset(); } | ~ListCoinsTestingSetup() { wallet.reset(); } | ||||
CWalletTx &AddTx(CRecipient recipient) { | CWalletTx &AddTx(CRecipient recipient) { | ||||
CTransactionRef tx; | CTransactionRef tx; | ||||
CReserveKey reservekey(wallet.get()); | ReserveDestination reservedest(wallet.get()); | ||||
Amount fee; | Amount fee; | ||||
int changePos = -1; | int changePos = -1; | ||||
std::string error; | std::string error; | ||||
CCoinControl dummy; | CCoinControl dummy; | ||||
{ | { | ||||
auto locked_chain = m_chain->lock(); | auto locked_chain = m_chain->lock(); | ||||
BOOST_CHECK(wallet->CreateTransaction(*locked_chain, {recipient}, | BOOST_CHECK(wallet->CreateTransaction(*locked_chain, {recipient}, | ||||
tx, reservekey, fee, | tx, reservedest, fee, | ||||
changePos, error, dummy)); | changePos, error, dummy)); | ||||
} | } | ||||
CValidationState state; | CValidationState state; | ||||
BOOST_CHECK(wallet->CommitTransaction(tx, {}, {}, reservekey, state)); | BOOST_CHECK(wallet->CommitTransaction(tx, {}, {}, reservedest, state)); | ||||
CMutableTransaction blocktx; | CMutableTransaction blocktx; | ||||
{ | { | ||||
LOCK(wallet->cs_wallet); | LOCK(wallet->cs_wallet); | ||||
blocktx = | blocktx = | ||||
CMutableTransaction(*wallet->mapWallet.at(tx->GetId()).tx); | CMutableTransaction(*wallet->mapWallet.at(tx->GetId()).tx); | ||||
} | } | ||||
CreateAndProcessBlock({CMutableTransaction(blocktx)}, | CreateAndProcessBlock({CMutableTransaction(blocktx)}, | ||||
GetScriptForRawPubKey(coinbaseKey.GetPubKey())); | GetScriptForRawPubKey(coinbaseKey.GetPubKey())); | ||||
▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines |