Coverage Report

Created: 2026-04-29 19:21

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/tmp/bitcoin/src/primitives/block.cpp
Line
Count
Source
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
uint256 CBlockHeader::GetHash() const
15
34.9M
{
16
34.9M
    return (HashWriter{} << *this).GetHash();
17
34.9M
}
18
19
std::string CBlock::ToString() const
20
0
{
21
0
    std::stringstream s;
22
0
    s << strprintf("CBlock(hash=%s, ver=0x%08x, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%u)\n",
23
0
        GetHash().ToString(),
24
0
        nVersion,
25
0
        hashPrevBlock.ToString(),
26
0
        hashMerkleRoot.ToString(),
27
0
        nTime, nBits, nNonce,
28
0
        vtx.size());
29
0
    for (const auto& tx : vtx) {
30
0
        s << "  " << tx->ToString() << "\n";
31
0
    }
32
0
    return s.str();
33
0
}