Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/wallet_tests.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | |||||
static void AddKey(CWallet &wallet, const CKey &key) { | static void AddKey(CWallet &wallet, const CKey &key) { | ||||
auto spk_man = wallet.GetOrCreateLegacyScriptPubKeyMan(); | auto spk_man = wallet.GetOrCreateLegacyScriptPubKeyMan(); | ||||
LOCK2(wallet.cs_wallet, spk_man->cs_KeyStore); | LOCK2(wallet.cs_wallet, spk_man->cs_KeyStore); | ||||
spk_man->AddKeyPubKey(key, key.GetPubKey()); | spk_man->AddKeyPubKey(key, key.GetPubKey()); | ||||
} | } | ||||
BOOST_FIXTURE_TEST_CASE(scan_for_wallet_transactions, TestChain100Setup) { | BOOST_FIXTURE_TEST_CASE(scan_for_wallet_transactions, TestChain100Setup) { | ||||
// Cap last block file size, and mine new block in a new block file. | // Cap last block file size, and mine new block in a new block file. | ||||
CBlockIndex *oldTip = ::ChainActive().Tip(); | CBlockIndex *oldTip = m_node.chainman->ActiveTip(); | ||||
GetBlockFileInfo(oldTip->GetBlockPos().nFile)->nSize = MAX_BLOCKFILE_SIZE; | GetBlockFileInfo(oldTip->GetBlockPos().nFile)->nSize = MAX_BLOCKFILE_SIZE; | ||||
CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())); | CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())); | ||||
CBlockIndex *newTip = ::ChainActive().Tip(); | CBlockIndex *newTip = m_node.chainman->ActiveTip(); | ||||
// Verify ScanForWalletTransactions fails to read an unknown start block. | // Verify ScanForWalletTransactions fails to read an unknown start block. | ||||
{ | { | ||||
CWallet wallet(m_node.chain.get(), "", CreateDummyWalletDatabase()); | CWallet wallet(m_node.chain.get(), "", CreateDummyWalletDatabase()); | ||||
{ | { | ||||
LOCK(wallet.cs_wallet); | LOCK(wallet.cs_wallet); | ||||
wallet.SetLastBlockProcessed(::ChainActive().Height(), | wallet.SetLastBlockProcessed( | ||||
::ChainActive().Tip()->GetBlockHash()); | m_node.chainman->ActiveHeight(), | ||||
m_node.chainman->ActiveTip()->GetBlockHash()); | |||||
} | } | ||||
AddKey(wallet, coinbaseKey); | AddKey(wallet, coinbaseKey); | ||||
WalletRescanReserver reserver(wallet); | WalletRescanReserver reserver(wallet); | ||||
reserver.reserve(); | reserver.reserve(); | ||||
CWallet::ScanResult result = wallet.ScanForWalletTransactions( | CWallet::ScanResult result = wallet.ScanForWalletTransactions( | ||||
BlockHash() /* start_block */, 0 /* start_height */, | BlockHash() /* start_block */, 0 /* start_height */, | ||||
{} /* max_height */, reserver, false /* update */); | {} /* max_height */, reserver, false /* update */); | ||||
BOOST_CHECK_EQUAL(result.status, CWallet::ScanResult::FAILURE); | BOOST_CHECK_EQUAL(result.status, CWallet::ScanResult::FAILURE); | ||||
BOOST_CHECK(result.last_failed_block.IsNull()); | BOOST_CHECK(result.last_failed_block.IsNull()); | ||||
BOOST_CHECK(result.last_scanned_block.IsNull()); | BOOST_CHECK(result.last_scanned_block.IsNull()); | ||||
BOOST_CHECK(!result.last_scanned_height); | BOOST_CHECK(!result.last_scanned_height); | ||||
BOOST_CHECK_EQUAL(wallet.GetBalance().m_mine_immature, Amount::zero()); | BOOST_CHECK_EQUAL(wallet.GetBalance().m_mine_immature, Amount::zero()); | ||||
} | } | ||||
// Verify ScanForWalletTransactions picks up transactions in both the old | // Verify ScanForWalletTransactions picks up transactions in both the old | ||||
// and new block files. | // and new block files. | ||||
{ | { | ||||
CWallet wallet(m_node.chain.get(), "", CreateDummyWalletDatabase()); | CWallet wallet(m_node.chain.get(), "", CreateDummyWalletDatabase()); | ||||
{ | { | ||||
LOCK(wallet.cs_wallet); | LOCK(wallet.cs_wallet); | ||||
wallet.SetLastBlockProcessed(::ChainActive().Height(), | wallet.SetLastBlockProcessed( | ||||
::ChainActive().Tip()->GetBlockHash()); | m_node.chainman->ActiveHeight(), | ||||
m_node.chainman->ActiveTip()->GetBlockHash()); | |||||
} | } | ||||
AddKey(wallet, coinbaseKey); | AddKey(wallet, coinbaseKey); | ||||
WalletRescanReserver reserver(wallet); | WalletRescanReserver reserver(wallet); | ||||
reserver.reserve(); | reserver.reserve(); | ||||
CWallet::ScanResult result = wallet.ScanForWalletTransactions( | CWallet::ScanResult result = wallet.ScanForWalletTransactions( | ||||
oldTip->GetBlockHash(), oldTip->nHeight, {} /* max_height */, | oldTip->GetBlockHash(), oldTip->nHeight, {} /* max_height */, | ||||
reserver, false /* update */); | reserver, false /* update */); | ||||
BOOST_CHECK_EQUAL(result.status, CWallet::ScanResult::SUCCESS); | BOOST_CHECK_EQUAL(result.status, CWallet::ScanResult::SUCCESS); | ||||
Show All 12 Lines | BOOST_FIXTURE_TEST_CASE(scan_for_wallet_transactions, TestChain100Setup) { | ||||
UnlinkPrunedFiles({oldTip->GetBlockPos().nFile}); | UnlinkPrunedFiles({oldTip->GetBlockPos().nFile}); | ||||
// Verify ScanForWalletTransactions only picks transactions in the new block | // Verify ScanForWalletTransactions only picks transactions in the new block | ||||
// file. | // file. | ||||
{ | { | ||||
CWallet wallet(m_node.chain.get(), "", CreateDummyWalletDatabase()); | CWallet wallet(m_node.chain.get(), "", CreateDummyWalletDatabase()); | ||||
{ | { | ||||
LOCK(wallet.cs_wallet); | LOCK(wallet.cs_wallet); | ||||
wallet.SetLastBlockProcessed(::ChainActive().Height(), | wallet.SetLastBlockProcessed( | ||||
::ChainActive().Tip()->GetBlockHash()); | m_node.chainman->ActiveHeight(), | ||||
m_node.chainman->ActiveTip()->GetBlockHash()); | |||||
} | } | ||||
AddKey(wallet, coinbaseKey); | AddKey(wallet, coinbaseKey); | ||||
WalletRescanReserver reserver(wallet); | WalletRescanReserver reserver(wallet); | ||||
reserver.reserve(); | reserver.reserve(); | ||||
CWallet::ScanResult result = wallet.ScanForWalletTransactions( | CWallet::ScanResult result = wallet.ScanForWalletTransactions( | ||||
oldTip->GetBlockHash(), oldTip->nHeight, {} /* max_height */, | oldTip->GetBlockHash(), oldTip->nHeight, {} /* max_height */, | ||||
reserver, false /* update */); | reserver, false /* update */); | ||||
BOOST_CHECK_EQUAL(result.status, CWallet::ScanResult::FAILURE); | BOOST_CHECK_EQUAL(result.status, CWallet::ScanResult::FAILURE); | ||||
Show All 11 Lines | BOOST_FIXTURE_TEST_CASE(scan_for_wallet_transactions, TestChain100Setup) { | ||||
} | } | ||||
UnlinkPrunedFiles({newTip->GetBlockPos().nFile}); | UnlinkPrunedFiles({newTip->GetBlockPos().nFile}); | ||||
// Verify ScanForWalletTransactions scans no blocks. | // Verify ScanForWalletTransactions scans no blocks. | ||||
{ | { | ||||
CWallet wallet(m_node.chain.get(), "", CreateDummyWalletDatabase()); | CWallet wallet(m_node.chain.get(), "", CreateDummyWalletDatabase()); | ||||
{ | { | ||||
LOCK(wallet.cs_wallet); | LOCK(wallet.cs_wallet); | ||||
wallet.SetLastBlockProcessed(::ChainActive().Height(), | wallet.SetLastBlockProcessed( | ||||
::ChainActive().Tip()->GetBlockHash()); | m_node.chainman->ActiveHeight(), | ||||
m_node.chainman->ActiveTip()->GetBlockHash()); | |||||
} | } | ||||
AddKey(wallet, coinbaseKey); | AddKey(wallet, coinbaseKey); | ||||
WalletRescanReserver reserver(wallet); | WalletRescanReserver reserver(wallet); | ||||
reserver.reserve(); | reserver.reserve(); | ||||
CWallet::ScanResult result = wallet.ScanForWalletTransactions( | CWallet::ScanResult result = wallet.ScanForWalletTransactions( | ||||
oldTip->GetBlockHash(), oldTip->nHeight, {} /* max_height */, | oldTip->GetBlockHash(), oldTip->nHeight, {} /* max_height */, | ||||
reserver, false /* update */); | reserver, false /* update */); | ||||
BOOST_CHECK_EQUAL(result.status, CWallet::ScanResult::FAILURE); | BOOST_CHECK_EQUAL(result.status, CWallet::ScanResult::FAILURE); | ||||
BOOST_CHECK_EQUAL(result.last_failed_block, newTip->GetBlockHash()); | BOOST_CHECK_EQUAL(result.last_failed_block, newTip->GetBlockHash()); | ||||
BOOST_CHECK(result.last_scanned_block.IsNull()); | BOOST_CHECK(result.last_scanned_block.IsNull()); | ||||
BOOST_CHECK(!result.last_scanned_height); | BOOST_CHECK(!result.last_scanned_height); | ||||
BOOST_CHECK_EQUAL(wallet.GetBalance().m_mine_immature, Amount::zero()); | BOOST_CHECK_EQUAL(wallet.GetBalance().m_mine_immature, Amount::zero()); | ||||
} | } | ||||
} | } | ||||
BOOST_FIXTURE_TEST_CASE(importmulti_rescan, TestChain100Setup) { | BOOST_FIXTURE_TEST_CASE(importmulti_rescan, TestChain100Setup) { | ||||
// Cap last block file size, and mine new block in a new block file. | // Cap last block file size, and mine new block in a new block file. | ||||
CBlockIndex *oldTip = ::ChainActive().Tip(); | CBlockIndex *oldTip = m_node.chainman->ActiveTip(); | ||||
GetBlockFileInfo(oldTip->GetBlockPos().nFile)->nSize = MAX_BLOCKFILE_SIZE; | GetBlockFileInfo(oldTip->GetBlockPos().nFile)->nSize = MAX_BLOCKFILE_SIZE; | ||||
CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())); | CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())); | ||||
CBlockIndex *newTip = ::ChainActive().Tip(); | CBlockIndex *newTip = m_node.chainman->ActiveTip(); | ||||
// Prune the older block file. | // Prune the older block file. | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
Assert(m_node.chainman) | Assert(m_node.chainman) | ||||
->m_blockman.PruneOneBlockFile(oldTip->GetBlockPos().nFile); | ->m_blockman.PruneOneBlockFile(oldTip->GetBlockPos().nFile); | ||||
} | } | ||||
UnlinkPrunedFiles({oldTip->GetBlockPos().nFile}); | UnlinkPrunedFiles({oldTip->GetBlockPos().nFile}); | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
// Verify importwallet RPC starts rescan at earliest block with timestamp | // Verify importwallet RPC starts rescan at earliest block with timestamp | ||||
// greater or equal than key birthday. Previously there was a bug where | // greater or equal than key birthday. Previously there was a bug where | ||||
// importwallet RPC would start the scan at the latest block with timestamp less | // importwallet RPC would start the scan at the latest block with timestamp less | ||||
// than or equal to key birthday. | // than or equal to key birthday. | ||||
BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup) { | BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup) { | ||||
// Create two blocks with same timestamp to verify that importwallet rescan | // Create two blocks with same timestamp to verify that importwallet rescan | ||||
// will pick up both blocks, not just the first. | // will pick up both blocks, not just the first. | ||||
const int64_t BLOCK_TIME = ::ChainActive().Tip()->GetBlockTimeMax() + 5; | const int64_t BLOCK_TIME = | ||||
m_node.chainman->ActiveTip()->GetBlockTimeMax() + 5; | |||||
SetMockTime(BLOCK_TIME); | SetMockTime(BLOCK_TIME); | ||||
m_coinbase_txns.emplace_back( | m_coinbase_txns.emplace_back( | ||||
CreateAndProcessBlock({}, | CreateAndProcessBlock({}, | ||||
GetScriptForRawPubKey(coinbaseKey.GetPubKey())) | GetScriptForRawPubKey(coinbaseKey.GetPubKey())) | ||||
.vtx[0]); | .vtx[0]); | ||||
m_coinbase_txns.emplace_back( | m_coinbase_txns.emplace_back( | ||||
CreateAndProcessBlock({}, | CreateAndProcessBlock({}, | ||||
GetScriptForRawPubKey(coinbaseKey.GetPubKey())) | GetScriptForRawPubKey(coinbaseKey.GetPubKey())) | ||||
Show All 18 Lines | // Import key into wallet and call dumpwallet to create backup file. | ||||
auto spk_man = wallet->GetOrCreateLegacyScriptPubKeyMan(); | auto spk_man = wallet->GetOrCreateLegacyScriptPubKeyMan(); | ||||
LOCK2(wallet->cs_wallet, spk_man->cs_KeyStore); | LOCK2(wallet->cs_wallet, spk_man->cs_KeyStore); | ||||
spk_man->mapKeyMetadata[coinbaseKey.GetPubKey().GetID()] | spk_man->mapKeyMetadata[coinbaseKey.GetPubKey().GetID()] | ||||
.nCreateTime = KEY_TIME; | .nCreateTime = KEY_TIME; | ||||
spk_man->AddKeyPubKey(coinbaseKey, coinbaseKey.GetPubKey()); | spk_man->AddKeyPubKey(coinbaseKey, coinbaseKey.GetPubKey()); | ||||
AddWallet(wallet); | AddWallet(wallet); | ||||
wallet->SetLastBlockProcessed( | wallet->SetLastBlockProcessed( | ||||
::ChainActive().Height(), | m_node.chainman->ActiveHeight(), | ||||
::ChainActive().Tip()->GetBlockHash()); | m_node.chainman->ActiveTip()->GetBlockHash()); | ||||
} | } | ||||
JSONRPCRequest request; | JSONRPCRequest request; | ||||
request.params.setArray(); | request.params.setArray(); | ||||
request.params.push_back(backup_file); | request.params.push_back(backup_file); | ||||
::dumpwallet().HandleRequest(GetConfig(), request); | ::dumpwallet().HandleRequest(GetConfig(), request); | ||||
RemoveWallet(wallet, std::nullopt); | RemoveWallet(wallet, std::nullopt); | ||||
} | } | ||||
// Call importwallet RPC and verify all blocks with timestamps >= BLOCK_TIME | // Call importwallet RPC and verify all blocks with timestamps >= BLOCK_TIME | ||||
// were scanned, and no prior blocks were scanned. | // were scanned, and no prior blocks were scanned. | ||||
{ | { | ||||
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>( | std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>( | ||||
m_node.chain.get(), "", CreateDummyWalletDatabase()); | m_node.chain.get(), "", CreateDummyWalletDatabase()); | ||||
LOCK(wallet->cs_wallet); | LOCK(wallet->cs_wallet); | ||||
wallet->SetupLegacyScriptPubKeyMan(); | wallet->SetupLegacyScriptPubKeyMan(); | ||||
JSONRPCRequest request; | JSONRPCRequest request; | ||||
request.params.setArray(); | request.params.setArray(); | ||||
request.params.push_back(backup_file); | request.params.push_back(backup_file); | ||||
AddWallet(wallet); | AddWallet(wallet); | ||||
wallet->SetLastBlockProcessed(::ChainActive().Height(), | wallet->SetLastBlockProcessed( | ||||
::ChainActive().Tip()->GetBlockHash()); | m_node.chainman->ActiveHeight(), | ||||
m_node.chainman->ActiveTip()->GetBlockHash()); | |||||
::importwallet().HandleRequest(GetConfig(), request); | ::importwallet().HandleRequest(GetConfig(), request); | ||||
RemoveWallet(wallet, std::nullopt); | RemoveWallet(wallet, std::nullopt); | ||||
BOOST_CHECK_EQUAL(wallet->mapWallet.size(), 3U); | BOOST_CHECK_EQUAL(wallet->mapWallet.size(), 3U); | ||||
BOOST_CHECK_EQUAL(m_coinbase_txns.size(), 103U); | BOOST_CHECK_EQUAL(m_coinbase_txns.size(), 103U); | ||||
for (size_t i = 0; i < m_coinbase_txns.size(); ++i) { | for (size_t i = 0; i < m_coinbase_txns.size(); ++i) { | ||||
bool found = wallet->GetWalletTx(m_coinbase_txns[i]->GetId()); | bool found = wallet->GetWalletTx(m_coinbase_txns[i]->GetId()); | ||||
bool expected = i >= 100; | bool expected = i >= 100; | ||||
Show All 9 Lines | |||||
// function. Similar tests probably should be written for the other credit and | // function. Similar tests probably should be written for the other credit and | ||||
// debit functions. | // debit functions. | ||||
BOOST_FIXTURE_TEST_CASE(coin_mark_dirty_immature_credit, TestChain100Setup) { | BOOST_FIXTURE_TEST_CASE(coin_mark_dirty_immature_credit, TestChain100Setup) { | ||||
CWallet wallet(m_node.chain.get(), "", CreateDummyWalletDatabase()); | CWallet wallet(m_node.chain.get(), "", CreateDummyWalletDatabase()); | ||||
auto spk_man = wallet.GetOrCreateLegacyScriptPubKeyMan(); | auto spk_man = wallet.GetOrCreateLegacyScriptPubKeyMan(); | ||||
CWalletTx wtx(&wallet, m_coinbase_txns.back()); | CWalletTx wtx(&wallet, m_coinbase_txns.back()); | ||||
LOCK2(wallet.cs_wallet, spk_man->cs_KeyStore); | LOCK2(wallet.cs_wallet, spk_man->cs_KeyStore); | ||||
wallet.SetLastBlockProcessed(::ChainActive().Height(), | wallet.SetLastBlockProcessed(m_node.chainman->ActiveHeight(), | ||||
::ChainActive().Tip()->GetBlockHash()); | m_node.chainman->ActiveTip()->GetBlockHash()); | ||||
CWalletTx::Confirmation confirm(CWalletTx::Status::CONFIRMED, | CWalletTx::Confirmation confirm( | ||||
::ChainActive().Height(), | CWalletTx::Status::CONFIRMED, m_node.chainman->ActiveHeight(), | ||||
::ChainActive().Tip()->GetBlockHash(), 0); | m_node.chainman->ActiveTip()->GetBlockHash(), 0); | ||||
wtx.m_confirm = confirm; | wtx.m_confirm = confirm; | ||||
// Call GetImmatureCredit() once before adding the key to the wallet to | // Call GetImmatureCredit() once before adding the key to the wallet to | ||||
// cache the current immature credit amount, which is 0. | // cache the current immature credit amount, which is 0. | ||||
BOOST_CHECK_EQUAL(wtx.GetImmatureCredit(), Amount::zero()); | BOOST_CHECK_EQUAL(wtx.GetImmatureCredit(), Amount::zero()); | ||||
// Invalidate the cached value, add the key, and make sure a new immature | // Invalidate the cached value, add the key, and make sure a new immature | ||||
// credit amount is calculated. | // credit amount is calculated. | ||||
▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | public: | ||||
ListCoinsTestingSetup() { | ListCoinsTestingSetup() { | ||||
CreateAndProcessBlock({}, | CreateAndProcessBlock({}, | ||||
GetScriptForRawPubKey(coinbaseKey.GetPubKey())); | GetScriptForRawPubKey(coinbaseKey.GetPubKey())); | ||||
wallet = std::make_unique<CWallet>(m_node.chain.get(), "", | wallet = std::make_unique<CWallet>(m_node.chain.get(), "", | ||||
CreateMockWalletDatabase()); | CreateMockWalletDatabase()); | ||||
{ | { | ||||
LOCK2(wallet->cs_wallet, ::cs_main); | LOCK2(wallet->cs_wallet, ::cs_main); | ||||
wallet->SetLastBlockProcessed( | wallet->SetLastBlockProcessed( | ||||
::ChainActive().Height(), | m_node.chainman->ActiveHeight(), | ||||
::ChainActive().Tip()->GetBlockHash()); | m_node.chainman->ActiveTip()->GetBlockHash()); | ||||
} | } | ||||
bool firstRun; | bool firstRun; | ||||
wallet->LoadWallet(firstRun); | wallet->LoadWallet(firstRun); | ||||
AddKey(*wallet, coinbaseKey); | AddKey(*wallet, coinbaseKey); | ||||
WalletRescanReserver reserver(*wallet); | WalletRescanReserver reserver(*wallet); | ||||
reserver.reserve(); | reserver.reserve(); | ||||
CWallet::ScanResult result = wallet->ScanForWalletTransactions( | CWallet::ScanResult result = wallet->ScanForWalletTransactions( | ||||
::ChainActive().Genesis()->GetBlockHash(), 0 /* start_height */, | m_node.chainman->ActiveChain().Genesis()->GetBlockHash(), | ||||
{} /* max_height */, reserver, false /* update */); | 0 /* start_height */, {} /* max_height */, reserver, | ||||
false /* update */); | |||||
BOOST_CHECK_EQUAL(result.status, CWallet::ScanResult::SUCCESS); | BOOST_CHECK_EQUAL(result.status, CWallet::ScanResult::SUCCESS); | ||||
BOOST_CHECK_EQUAL(result.last_scanned_block, | BOOST_CHECK_EQUAL(result.last_scanned_block, | ||||
::ChainActive().Tip()->GetBlockHash()); | m_node.chainman->ActiveTip()->GetBlockHash()); | ||||
BOOST_CHECK_EQUAL(*result.last_scanned_height, | BOOST_CHECK_EQUAL(*result.last_scanned_height, | ||||
::ChainActive().Height()); | m_node.chainman->ActiveHeight()); | ||||
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; | ||||
Amount fee; | Amount fee; | ||||
Show All 10 Lines | CWalletTx &AddTx(CRecipient recipient) { | ||||
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())); | ||||
LOCK(wallet->cs_wallet); | LOCK(wallet->cs_wallet); | ||||
wallet->SetLastBlockProcessed(wallet->GetLastBlockHeight() + 1, | wallet->SetLastBlockProcessed( | ||||
::ChainActive().Tip()->GetBlockHash()); | wallet->GetLastBlockHeight() + 1, | ||||
m_node.chainman->ActiveTip()->GetBlockHash()); | |||||
auto it = wallet->mapWallet.find(tx->GetId()); | auto it = wallet->mapWallet.find(tx->GetId()); | ||||
BOOST_CHECK(it != wallet->mapWallet.end()); | BOOST_CHECK(it != wallet->mapWallet.end()); | ||||
CWalletTx::Confirmation confirm( | CWalletTx::Confirmation confirm( | ||||
CWalletTx::Status::CONFIRMED, ::ChainActive().Height(), | CWalletTx::Status::CONFIRMED, m_node.chainman->ActiveHeight(), | ||||
::ChainActive().Tip()->GetBlockHash(), 1); | m_node.chainman->ActiveTip()->GetBlockHash(), 1); | ||||
it->second.m_confirm = confirm; | it->second.m_confirm = confirm; | ||||
return it->second; | return it->second; | ||||
} | } | ||||
std::unique_ptr<CWallet> wallet; | std::unique_ptr<CWallet> wallet; | ||||
}; | }; | ||||
BOOST_FIXTURE_TEST_CASE(ListCoins, ListCoinsTestingSetup) { | BOOST_FIXTURE_TEST_CASE(ListCoins, ListCoinsTestingSetup) { | ||||
▲ Show 20 Lines • Show All 306 Lines • Show Last 20 Lines |