aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-09-13 14:17:39 +0200
committerMacroFake <falke.marco@gmail.com>2022-09-13 14:18:18 +0200
commit141540a71f510f26e8aa8b551139a978dae2be84 (patch)
tree0f622aa68004ba5ebf8e481fbad7ea09b118e3e6 /src/test
parent94d17845d04e71e189c59d65b8bbc3df1efbc59a (diff)
parentfaa3d38ec6f2999740486c6c66cd062e74c769fb (diff)
downloadbitcoin-141540a71f510f26e8aa8b551139a978dae2be84.tar.xz
Merge bitcoin/bitcoin#25222: refactor: Pass reference to LookUpStats
faa3d38ec6f2999740486c6c66cd062e74c769fb refactor: Pass reference to LookUpStats (MacroFake) Pull request description: I find it confusing to have an interface that accepts nullptr, but immediately crashes the program when someone does pass nullptr. Fix that. Also some include fixups. ACKs for top commit: aureleoules: ACK faa3d38ec6f2999740486c6c66cd062e74c769fb Tree-SHA512: f90b649e9991e137b83a9899258ee73605719c081a6b789ac27fe7fe73eb70fbb41d89479bcd536d5c3ad788a5795de8451bc1b94e5c9267dcf9636d9e4a1109
Diffstat (limited to 'src/test')
-rw-r--r--src/test/coinstatsindex_tests.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/test/coinstatsindex_tests.cpp b/src/test/coinstatsindex_tests.cpp
index 132c4e53e7..20858b2adf 100644
--- a/src/test/coinstatsindex_tests.cpp
+++ b/src/test/coinstatsindex_tests.cpp
@@ -5,6 +5,7 @@
#include <chainparams.h>
#include <index/coinstatsindex.h>
#include <interfaces/chain.h>
+#include <kernel/coinstats.h>
#include <test/util/setup_common.h>
#include <test/util/validation.h>
#include <util/time.h>
@@ -38,7 +39,7 @@ BOOST_FIXTURE_TEST_CASE(coinstatsindex_initial_sync, TestChain100Setup)
}
// CoinStatsIndex should not be found before it is started.
- BOOST_CHECK(!coin_stats_index.LookUpStats(block_index));
+ BOOST_CHECK(!coin_stats_index.LookUpStats(*block_index));
// BlockUntilSyncedToCurrentChain should return false before CoinStatsIndex
// is started.
@@ -54,10 +55,10 @@ BOOST_FIXTURE_TEST_CASE(coinstatsindex_initial_sync, TestChain100Setup)
LOCK(cs_main);
genesis_block_index = m_node.chainman->ActiveChain().Genesis();
}
- BOOST_CHECK(coin_stats_index.LookUpStats(genesis_block_index));
+ BOOST_CHECK(coin_stats_index.LookUpStats(*genesis_block_index));
// Check that CoinStatsIndex updates with new blocks.
- BOOST_CHECK(coin_stats_index.LookUpStats(block_index));
+ BOOST_CHECK(coin_stats_index.LookUpStats(*block_index));
const CScript script_pub_key{CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG};
std::vector<CMutableTransaction> noTxns;
@@ -71,7 +72,7 @@ BOOST_FIXTURE_TEST_CASE(coinstatsindex_initial_sync, TestChain100Setup)
LOCK(cs_main);
new_block_index = m_node.chainman->ActiveChain().Tip();
}
- BOOST_CHECK(coin_stats_index.LookUpStats(new_block_index));
+ BOOST_CHECK(coin_stats_index.LookUpStats(*new_block_index));
BOOST_CHECK(block_index != new_block_index);