diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2020-07-20 09:49:10 -0400 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2020-12-07 09:09:53 -0400 |
commit | 6965f1352d2d7086d308750ce83a84f191a17755 (patch) | |
tree | eed1386a3ed2538645dcf25239d231a6c088ea40 /src/test/interfaces_tests.cpp | |
parent | 3fbbb9a6403a86fbed3d5d9f7939998922593377 (diff) |
refactor: Replace uses ChainActive() in interfaces/chain.cpp
Suggested https://github.com/bitcoin/bitcoin/pull/19425#discussion_r456236407
Diffstat (limited to 'src/test/interfaces_tests.cpp')
-rw-r--r-- | src/test/interfaces_tests.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/test/interfaces_tests.cpp b/src/test/interfaces_tests.cpp index 2e8729736c..b8c4bc8605 100644 --- a/src/test/interfaces_tests.cpp +++ b/src/test/interfaces_tests.cpp @@ -18,7 +18,7 @@ BOOST_FIXTURE_TEST_SUITE(interfaces_tests, TestChain100Setup) BOOST_AUTO_TEST_CASE(findBlock) { auto chain = interfaces::MakeChain(m_node); - auto& active = ChainActive(); + const CChain& active = Assert(m_node.chainman)->ActiveChain(); uint256 hash; BOOST_CHECK(chain->findBlock(active[10]->GetBlockHash(), FoundBlock().hash(hash))); @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(findBlock) BOOST_AUTO_TEST_CASE(findFirstBlockWithTimeAndHeight) { auto chain = interfaces::MakeChain(m_node); - auto& active = ChainActive(); + const CChain& active = Assert(m_node.chainman)->ActiveChain(); uint256 hash; int height; BOOST_CHECK(chain->findFirstBlockWithTimeAndHeight(/* min_time= */ 0, /* min_height= */ 5, FoundBlock().hash(hash).height(height))); @@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE(findFirstBlockWithTimeAndHeight) BOOST_AUTO_TEST_CASE(findAncestorByHeight) { auto chain = interfaces::MakeChain(m_node); - auto& active = ChainActive(); + const CChain& active = Assert(m_node.chainman)->ActiveChain(); uint256 hash; BOOST_CHECK(chain->findAncestorByHeight(active[20]->GetBlockHash(), 10, FoundBlock().hash(hash))); BOOST_CHECK_EQUAL(hash, active[10]->GetBlockHash()); @@ -84,7 +84,7 @@ BOOST_AUTO_TEST_CASE(findAncestorByHeight) BOOST_AUTO_TEST_CASE(findAncestorByHash) { auto chain = interfaces::MakeChain(m_node); - auto& active = ChainActive(); + const CChain& active = Assert(m_node.chainman)->ActiveChain(); int height = -1; BOOST_CHECK(chain->findAncestorByHash(active[20]->GetBlockHash(), active[10]->GetBlockHash(), FoundBlock().height(height))); BOOST_CHECK_EQUAL(height, 10); @@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(findAncestorByHash) BOOST_AUTO_TEST_CASE(findCommonAncestor) { auto chain = interfaces::MakeChain(m_node); - auto& active = ChainActive(); + const CChain& active = Assert(m_node.chainman)->ActiveChain(); auto* orig_tip = active.Tip(); for (int i = 0; i < 10; ++i) { BlockValidationState state; @@ -124,7 +124,7 @@ BOOST_AUTO_TEST_CASE(findCommonAncestor) BOOST_AUTO_TEST_CASE(hasBlocks) { auto chain = interfaces::MakeChain(m_node); - auto& active = ChainActive(); + const CChain& active = Assert(m_node.chainman)->ActiveChain(); // Test ranges BOOST_CHECK(chain->hasBlocks(active.Tip()->GetBlockHash(), 10, 90)); |