LCOV - code coverage report
Current view: top level - src/test/util - blockfilter.cpp (source / functions) Coverage Total Hit
Test: test_bitcoin_coverage.info Lines: 100.0 % 9 9
Test Date: 2024-08-28 04:44:32 Functions: 100.0 % 1 1
Branches: 57.1 % 14 8

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2019-2021 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 <primitives/block.h>
      10                 :             : #include <undo.h>
      11                 :             : #include <validation.h>
      12                 :             : 
      13                 :             : using node::BlockManager;
      14                 :             : 
      15                 :         114 : bool ComputeFilter(BlockFilterType filter_type, const CBlockIndex& block_index, BlockFilter& filter, const BlockManager& blockman)
      16                 :             : {
      17                 :         114 :     LOCK(::cs_main);
      18                 :             : 
      19                 :         114 :     CBlock block;
      20   [ +  -  +  - ]:         114 :     if (!blockman.ReadBlockFromDisk(block, block_index.GetBlockPos())) {
      21                 :             :         return false;
      22                 :             :     }
      23                 :             : 
      24                 :         114 :     CBlockUndo block_undo;
      25   [ +  +  +  -  :         114 :     if (block_index.nHeight > 0 && !blockman.UndoReadFromDisk(block_undo, block_index)) {
                   +  - ]
      26                 :             :         return false;
      27                 :             :     }
      28                 :             : 
      29         [ +  - ]:         228 :     filter = BlockFilter(filter_type, block, block_undo);
      30                 :         114 :     return true;
      31         [ +  - ]:         342 : }
        

Generated by: LCOV version 2.0-1