diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-11-04 08:16:25 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-11-04 08:16:54 -0500 |
commit | 5933c6d9245d820cf9a8f93426d1cdc52ece537e (patch) | |
tree | 72532c452e53271c9f840636fe3be5b2f0143200 /src/test/blockfilter_index_tests.cpp | |
parent | 73b26e38d7a174d5409dda8aa1fe9804e7779a1f (diff) | |
parent | fa0a731d007a8e76d2740a2e6ead2289de77e475 (diff) | |
download | bitcoin-5933c6d9245d820cf9a8f93426d1cdc52ece537e.tar.xz |
Merge #17228: test: Add RegTestingSetup to setup_common
fa0a731d007a8e76d2740a2e6ead2289de77e475 test: Add RegTestingSetup to setup_common (MarcoFalke)
fa54b3e2485f701aa420c37f09a2859a5b805161 test: move-only ComputeFilter to src/test/lib/blockfilter (MarcoFalke)
Pull request description:
The default chain for `TestingSetup` is the main chain. However, any test that wants to mine blocks on demand needs to switch to regtest. This is done manually and in-line right now.
Fix that by creating an explicit `RegTestingSetup` and use it where appropriate.
Also, add a move-only commit to move `ComputeFilter` into the newly created unit test library.
Both commits are part of #15845, but split up because they are useful on their own.
ACKs for top commit:
practicalswift:
ACK fa0a731d007a8e76d2740a2e6ead2289de77e475 -- diff looks correct
Tree-SHA512: 02b9765580b355ed8d1be555f8ae11fa6e3d575f5cb177bbdda0319378837e29de5555c126c477dc8a1e8a5be47335afdcff152cf2dea2fbdd1a988ddde3689b
Diffstat (limited to 'src/test/blockfilter_index_tests.cpp')
-rw-r--r-- | src/test/blockfilter_index_tests.cpp | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/src/test/blockfilter_index_tests.cpp b/src/test/blockfilter_index_tests.cpp index 4a15bf0c77..acc6d6a21b 100644 --- a/src/test/blockfilter_index_tests.cpp +++ b/src/test/blockfilter_index_tests.cpp @@ -8,8 +8,9 @@ #include <index/blockfilterindex.h> #include <miner.h> #include <pow.h> -#include <test/setup_common.h> #include <script/standard.h> +#include <test/lib/blockfilter.h> +#include <test/setup_common.h> #include <util/time.h> #include <validation.h> @@ -17,23 +18,6 @@ BOOST_AUTO_TEST_SUITE(blockfilter_index_tests) -static bool ComputeFilter(BlockFilterType filter_type, const CBlockIndex* block_index, - BlockFilter& filter) -{ - CBlock block; - if (!ReadBlockFromDisk(block, block_index->GetBlockPos(), Params().GetConsensus())) { - return false; - } - - CBlockUndo block_undo; - if (block_index->nHeight > 0 && !UndoReadFromDisk(block_undo, block_index)) { - return false; - } - - filter = BlockFilter(filter_type, block, block_undo); - return true; -} - static bool CheckFilterLookups(BlockFilterIndex& filter_index, const CBlockIndex* block_index, uint256& last_header) { |