LCOV - code coverage report
Current view: top level - src/kernel - chain.cpp (source / functions) Hit Total Coverage
Test: fuzz_coverage.info Lines: 1 13 7.7 %
Date: 2023-09-26 12:08:55 Functions: 1 2 50.0 %

          Line data    Source code
       1             : // Copyright (c) 2022 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 <chain.h>
       6             : #include <interfaces/chain.h>
       7             : #include <sync.h>
       8             : #include <uint256.h>
       9             : 
      10             : class CBlock;
      11             : 
      12             : namespace kernel {
      13           0 : interfaces::BlockInfo MakeBlockInfo(const CBlockIndex* index, const CBlock* data)
      14             : {
      15           0 :     interfaces::BlockInfo info{index ? *index->phashBlock : uint256::ZERO};
      16           0 :     if (index) {
      17           0 :         info.prev_hash = index->pprev ? index->pprev->phashBlock : nullptr;
      18           0 :         info.height = index->nHeight;
      19           0 :         info.chain_time_max = index->GetBlockTimeMax();
      20           0 :         LOCK(::cs_main);
      21           0 :         info.file_number = index->nFile;
      22           0 :         info.data_pos = index->nDataPos;
      23           0 :     }
      24           0 :     info.data = data;
      25           0 :     return info;
      26             : }
      27             : } // namespace kernel

Generated by: LCOV version 1.14