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 <validation.h> 9 : 10 : 11 114 : bool ComputeFilter(BlockFilterType filter_type, const CBlockIndex* block_index, BlockFilter& filter) 12 : { 13 114 : CBlock block; 14 114 : if (!ReadBlockFromDisk(block, block_index->GetBlockPos(), Params().GetConsensus())) { 15 0 : return false; 16 : } 17 : 18 114 : CBlockUndo block_undo; 19 114 : if (block_index->nHeight > 0 && !UndoReadFromDisk(block_undo, block_index)) { 20 0 : return false; 21 : } 22 : 23 114 : filter = BlockFilter(filter_type, block, block_undo); 24 114 : return true; 25 114 : } 26 :