diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-09-20 14:02:16 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-10-30 13:19:30 -0400 |
commit | fa54b3e2485f701aa420c37f09a2859a5b805161 (patch) | |
tree | 159154904464839d6e550b1954fa0cbfb8ecbb98 /src/test | |
parent | 341e8d355d1a74aadb3a88a12a58cfda6ca262bc (diff) | |
download | bitcoin-fa54b3e2485f701aa420c37f09a2859a5b805161.tar.xz |
test: move-only ComputeFilter to src/test/lib/blockfilter
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/blockfilter_index_tests.cpp | 20 | ||||
-rw-r--r-- | src/test/lib/blockfilter.cpp | 26 | ||||
-rw-r--r-- | src/test/lib/blockfilter.h | 13 |
3 files changed, 41 insertions, 18 deletions
diff --git a/src/test/blockfilter_index_tests.cpp b/src/test/blockfilter_index_tests.cpp index ba293b7836..fc2848f922 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) { diff --git a/src/test/lib/blockfilter.cpp b/src/test/lib/blockfilter.cpp new file mode 100644 index 0000000000..ddcee85d7e --- /dev/null +++ b/src/test/lib/blockfilter.cpp @@ -0,0 +1,26 @@ +// Copyright (c) 2019 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include <test/lib/blockfilter.h> + +#include <chainparams.h> +#include <validation.h> + + +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; +} + diff --git a/src/test/lib/blockfilter.h b/src/test/lib/blockfilter.h new file mode 100644 index 0000000000..392dacbe80 --- /dev/null +++ b/src/test/lib/blockfilter.h @@ -0,0 +1,13 @@ +// Copyright (c) 2019 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_TEST_LIB_BLOCKFILTER_H +#define BITCOIN_TEST_LIB_BLOCKFILTER_H + +#include <blockfilter.h> +class CBlockIndex; + +bool ComputeFilter(BlockFilterType filter_type, const CBlockIndex* block_index, BlockFilter& filter); + +#endif // BITCOIN_TEST_LIB_BLOCKFILTER_H |