LCOV - code coverage report
Current view: top level - src/primitives - block.cpp (source / functions) Coverage Total Hit
Test: fuzz_coverage.info Lines: 93.3 % 15 14
Test Date: 2026-04-04 04:16:13 Functions: 100.0 % 2 2
Branches: 54.5 % 22 12

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2009-2010 Satoshi Nakamoto
       2                 :             : // Copyright (c) 2009-present The Bitcoin Core developers
       3                 :             : // Distributed under the MIT software license, see the accompanying
       4                 :             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       5                 :             : 
       6                 :             : #include <primitives/block.h>
       7                 :             : 
       8                 :             : #include <hash.h>
       9                 :             : #include <tinyformat.h>
      10                 :             : 
      11                 :             : #include <memory>
      12                 :             : #include <sstream>
      13                 :             : 
      14                 :     3299038 : uint256 CBlockHeader::GetHash() const
      15                 :             : {
      16                 :     3299038 :     return (HashWriter{} << *this).GetHash();
      17                 :             : }
      18                 :             : 
      19                 :         831 : std::string CBlock::ToString() const
      20                 :             : {
      21                 :         831 :     std::stringstream s;
      22         [ +  - ]:        1662 :     s << strprintf("CBlock(hash=%s, ver=0x%08x, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%u)\n",
      23         [ +  - ]:        1662 :         GetHash().ToString(),
      24         [ +  - ]:         831 :         nVersion,
      25         [ +  - ]:        1662 :         hashPrevBlock.ToString(),
      26                 :           0 :         hashMerkleRoot.ToString(),
      27                 :         831 :         nTime, nBits, nNonce,
      28   [ -  +  +  - ]:        1662 :         vtx.size());
      29         [ +  + ]:     1032945 :     for (const auto& tx : vtx) {
      30   [ +  -  +  -  :     3096342 :         s << "  " << tx->ToString() << "\n";
                   +  - ]
      31                 :             :     }
      32         [ +  - ]:        1662 :     return s.str();
      33                 :         831 : }
        

Generated by: LCOV version 2.0-1