From c1694ce6bb7e19a8722d5583cd85ad17da40bb67 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Thu, 16 Jan 2020 16:38:30 -0500 Subject: wallet: Avoid use of Chain::Lock in importprunedfunds This is a step toward removing the Chain::Lock class and reducing cs_main locking. This change only affects behavior in the case where wallet last block processed falls behind the chain tip, in which case the "Block not found in chain" error will be stricter and not allow importing data from a blocks between the wallet last processed tip and the current node tip. --- src/test/interfaces_tests.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/test/interfaces_tests.cpp') diff --git a/src/test/interfaces_tests.cpp b/src/test/interfaces_tests.cpp index e3d1738c7..caa988df0 100644 --- a/src/test/interfaces_tests.cpp +++ b/src/test/interfaces_tests.cpp @@ -44,4 +44,14 @@ BOOST_AUTO_TEST_CASE(findBlock) BOOST_CHECK(!chain->findBlock({}, FoundBlock())); } +BOOST_AUTO_TEST_CASE(findAncestorByHash) +{ + auto chain = interfaces::MakeChain(m_node); + auto& active = ChainActive(); + int height = -1; + BOOST_CHECK(chain->findAncestorByHash(active[20]->GetBlockHash(), active[10]->GetBlockHash(), FoundBlock().height(height))); + BOOST_CHECK_EQUAL(height, 10); + BOOST_CHECK(!chain->findAncestorByHash(active[10]->GetBlockHash(), active[20]->GetBlockHash())); +} + BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.3