Branch data Line data Source code
# 1 : : // Copyright (c) 2019 The Bitcoin Core developers # 2 : : // Distributed under the MIT software license, see the accompanying # 3 : : // file COPYING or http://www.opensource.org/licenses/mit-license.php. # 4 : : # 5 : : #include <test/util/blockfilter.h> # 6 : : # 7 : : #include <chainparams.h> # 8 : : #include <node/blockstorage.h> # 9 : : #include <validation.h> # 10 : : # 11 : : # 12 : : bool ComputeFilter(BlockFilterType filter_type, const CBlockIndex* block_index, BlockFilter& filter) # 13 : 228 : { # 14 : 228 : CBlock block; # 15 [ - + ]: 228 : if (!ReadBlockFromDisk(block, block_index->GetBlockPos(), Params().GetConsensus())) { # 16 : 0 : return false; # 17 : 0 : } # 18 : : # 19 : 228 : CBlockUndo block_undo; # 20 [ + + ][ - + ]: 228 : if (block_index->nHeight > 0 && !UndoReadFromDisk(block_undo, block_index)) { # 21 : 0 : return false; # 22 : 0 : } # 23 : : # 24 : 228 : filter = BlockFilter(filter_type, block, block_undo); # 25 : 228 : return true; # 26 : 228 : } # 27 : :