diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2020-01-16 16:38:30 -0500 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2020-03-31 08:36:02 -0500 |
commit | c1694ce6bb7e19a8722d5583cd85ad17da40bb67 (patch) | |
tree | 21e0b8bdd3d8cba56623e3f63696f31a9d6a6517 /src/test/interfaces_tests.cpp | |
parent | ade5f87971211bc67753f14a0d49e020142efc7c (diff) | |
download | bitcoin-c1694ce6bb7e19a8722d5583cd85ad17da40bb67.tar.xz |
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.
Diffstat (limited to 'src/test/interfaces_tests.cpp')
-rw-r--r-- | src/test/interfaces_tests.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/interfaces_tests.cpp b/src/test/interfaces_tests.cpp index e3d1738c7f..caa988df0d 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() |