Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/wallet_tests.cpp
Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | // and new block files. | ||||
BOOST_CHECK_EQUAL(result.last_scanned_block, newTip->GetBlockHash()); | BOOST_CHECK_EQUAL(result.last_scanned_block, newTip->GetBlockHash()); | ||||
BOOST_CHECK_EQUAL(*result.last_scanned_height, newTip->nHeight); | BOOST_CHECK_EQUAL(*result.last_scanned_height, newTip->nHeight); | ||||
BOOST_CHECK_EQUAL(wallet.GetBalance().m_mine_immature, 100 * COIN); | BOOST_CHECK_EQUAL(wallet.GetBalance().m_mine_immature, 100 * COIN); | ||||
} | } | ||||
// Prune the older block file. | // Prune the older block file. | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
Assert(m_node.chainman)->PruneOneBlockFile(oldTip->GetBlockPos().nFile); | Assert(m_node.chainman) | ||||
->m_blockman.PruneOneBlockFile(oldTip->GetBlockPos().nFile); | |||||
} | } | ||||
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(chain.get(), WalletLocation(), | CWallet wallet(chain.get(), WalletLocation(), | ||||
CreateDummyWalletDatabase()); | CreateDummyWalletDatabase()); | ||||
Show All 13 Lines | // file. | ||||
BOOST_CHECK_EQUAL(result.last_scanned_block, newTip->GetBlockHash()); | BOOST_CHECK_EQUAL(result.last_scanned_block, newTip->GetBlockHash()); | ||||
BOOST_CHECK_EQUAL(*result.last_scanned_height, newTip->nHeight); | BOOST_CHECK_EQUAL(*result.last_scanned_height, newTip->nHeight); | ||||
BOOST_CHECK_EQUAL(wallet.GetBalance().m_mine_immature, 50 * COIN); | BOOST_CHECK_EQUAL(wallet.GetBalance().m_mine_immature, 50 * COIN); | ||||
} | } | ||||
// Prune the remaining block file. | // Prune the remaining block file. | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
Assert(m_node.chainman)->PruneOneBlockFile(newTip->GetBlockPos().nFile); | Assert(m_node.chainman) | ||||
->m_blockman.PruneOneBlockFile(newTip->GetBlockPos().nFile); | |||||
} | } | ||||
UnlinkPrunedFiles({newTip->GetBlockPos().nFile}); | UnlinkPrunedFiles({newTip->GetBlockPos().nFile}); | ||||
// Verify ScanForWalletTransactions scans no blocks. | // Verify ScanForWalletTransactions scans no blocks. | ||||
{ | { | ||||
CWallet wallet(chain.get(), WalletLocation(), | CWallet wallet(chain.get(), WalletLocation(), | ||||
CreateDummyWalletDatabase()); | CreateDummyWalletDatabase()); | ||||
{ | { | ||||
Show All 23 Lines | BOOST_FIXTURE_TEST_CASE(importmulti_rescan, TestChain100Setup) { | ||||
CBlockIndex *newTip = ::ChainActive().Tip(); | CBlockIndex *newTip = ::ChainActive().Tip(); | ||||
NodeContext node; | NodeContext node; | ||||
auto chain = interfaces::MakeChain(node, Params()); | auto chain = interfaces::MakeChain(node, Params()); | ||||
// Prune the older block file. | // Prune the older block file. | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
Assert(m_node.chainman)->PruneOneBlockFile(oldTip->GetBlockPos().nFile); | Assert(m_node.chainman) | ||||
->m_blockman.PruneOneBlockFile(oldTip->GetBlockPos().nFile); | |||||
} | } | ||||
UnlinkPrunedFiles({oldTip->GetBlockPos().nFile}); | UnlinkPrunedFiles({oldTip->GetBlockPos().nFile}); | ||||
// Verify importmulti RPC returns failure for a key whose creation time is | // Verify importmulti RPC returns failure for a key whose creation time is | ||||
// before the missing block, and success for a key whose creation time is | // before the missing block, and success for a key whose creation time is | ||||
// after. | // after. | ||||
{ | { | ||||
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>( | std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>( | ||||
▲ Show 20 Lines • Show All 658 Lines • Show Last 20 Lines |