wallet refactor: Avoid use of Chain::Lock in CWallet::RescanFromTime

This is a step toward removing the Chain::Lock class and reducing cs_main
locking.

This change has no effect on behavior.
This commit is contained in:
Russell Yanofsky
2020-01-21 15:55:19 -05:00
parent f7ba881bc6
commit 3cb85ac594
4 changed files with 27 additions and 7 deletions

View File

@@ -47,6 +47,18 @@ BOOST_AUTO_TEST_CASE(findBlock)
BOOST_CHECK(!chain->findBlock({}, FoundBlock()));
}
BOOST_AUTO_TEST_CASE(findFirstBlockWithTimeAndHeight)
{
auto chain = interfaces::MakeChain(m_node);
auto& active = ChainActive();
uint256 hash;
int height;
BOOST_CHECK(chain->findFirstBlockWithTimeAndHeight(/* min_time= */ 0, /* min_height= */ 5, FoundBlock().hash(hash).height(height)));
BOOST_CHECK_EQUAL(hash, active[5]->GetBlockHash());
BOOST_CHECK_EQUAL(height, 5);
BOOST_CHECK(!chain->findFirstBlockWithTimeAndHeight(/* min_time= */ active.Tip()->GetBlockTimeMax() + 1, /* min_height= */ 0));
}
BOOST_AUTO_TEST_CASE(findAncestorByHeight)
{
auto chain = interfaces::MakeChain(m_node);