LCOV - code coverage report
Current view: top level - src/primitives - block.cpp (source / functions) Coverage Total Hit
Test: fuzz_coverage.info Lines: 100.0 % 16 16
Test Date: 2024-09-01 05:20:30 Functions: 100.0 % 2 2
Branches: 54.2 % 24 13

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2009-2010 Satoshi Nakamoto
       2                 :             : // Copyright (c) 2009-2019 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                 :     4384949 : uint256 CBlockHeader::GetHash() const
      12                 :             : {
      13                 :     4384949 :     return (HashWriter{} << *this).GetHash();
      14                 :             : }
      15                 :             : 
      16                 :         763 : std::string CBlock::ToString() const
      17                 :             : {
      18                 :         763 :     std::stringstream s;
      19   [ +  -  +  - ]:        1526 :     s << strprintf("CBlock(hash=%s, ver=0x%08x, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%u)\n",
      20   [ +  -  +  - ]:         763 :         GetHash().ToString(),
      21                 :         763 :         nVersion,
      22         [ +  - ]:         763 :         hashPrevBlock.ToString(),
      23         [ +  - ]:         763 :         hashMerkleRoot.ToString(),
      24                 :         763 :         nTime, nBits, nNonce,
      25                 :         763 :         vtx.size());
      26         [ +  + ]:      766977 :     for (const auto& tx : vtx) {
      27   [ -  +  -  +  :      766214 :         s << "  " << tx->ToString() << "\n";
             +  -  +  - ]
      28                 :      766214 :     }
      29         [ +  - ]:         763 :     return s.str();
      30                 :         763 : }
        

Generated by: LCOV version 2.0-1