mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
wallet: Avoid use of Chain::Lock in CWallet::ScanForWalletTransactions
This is a step toward removing the Chain::Lock class and reducing cs_main locking. This change affects behavior in a few small ways. - If there's no max_height specified, percentage progress is measured ending at wallet last processed block instead of node tip - More consistent error reporting: Early check to see if start_block is on the active chain is removed, so start_block is always read and the triggers an error if it's unavailable
This commit is contained in:
parent
1be8ff280c
commit
c0d07dc4cb
8 changed files with 65 additions and 42 deletions
|
|
@ -59,6 +59,21 @@ BOOST_AUTO_TEST_CASE(findFirstBlockWithTimeAndHeight)
|
|||
BOOST_CHECK(!chain->findFirstBlockWithTimeAndHeight(/* min_time= */ active.Tip()->GetBlockTimeMax() + 1, /* min_height= */ 0));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(findNextBlock)
|
||||
{
|
||||
auto chain = interfaces::MakeChain(m_node);
|
||||
auto& active = ChainActive();
|
||||
bool reorg;
|
||||
uint256 hash;
|
||||
BOOST_CHECK(chain->findNextBlock(active[20]->GetBlockHash(), 20, FoundBlock().hash(hash), &reorg));
|
||||
BOOST_CHECK_EQUAL(hash, active[21]->GetBlockHash());
|
||||
BOOST_CHECK_EQUAL(reorg, false);
|
||||
BOOST_CHECK(!chain->findNextBlock(uint256(), 20, {}, &reorg));
|
||||
BOOST_CHECK_EQUAL(reorg, true);
|
||||
BOOST_CHECK(!chain->findNextBlock(active.Tip()->GetBlockHash(), active.Height(), {}, &reorg));
|
||||
BOOST_CHECK_EQUAL(reorg, false);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(findAncestorByHeight)
|
||||
{
|
||||
auto chain = interfaces::MakeChain(m_node);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue