aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.test.include4
-rw-r--r--src/test/blockfilter_index_tests.cpp20
-rw-r--r--src/test/lib/blockfilter.cpp26
-rw-r--r--src/test/lib/blockfilter.h13
4 files changed, 44 insertions, 19 deletions
diff --git a/src/Makefile.test.include b/src/Makefile.test.include
index c3f0120005..a4cf78d61b 100644
--- a/src/Makefile.test.include
+++ b/src/Makefile.test.include
@@ -56,8 +56,10 @@ RAW_TEST_FILES =
GENERATED_TEST_FILES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h)
BITCOIN_TEST_SUITE = \
- test/lib/transaction_utils.h \
+ test/lib/blockfilter.cpp \
+ test/lib/blockfilter.h \
test/lib/transaction_utils.cpp \
+ test/lib/transaction_utils.h \
test/main.cpp \
test/setup_common.h \
test/setup_common.cpp
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