mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-11 01:26:10 +01:00
The type is only ever set, but never read via GetType(), so remove it. Also, remove SerializeHash to avoid silent merge conflicts and use the already existing GetHash() boilerplate consistently.
30 lines
887 B
C++
30 lines
887 B
C++
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
|
// Copyright (c) 2009-2019 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include <primitives/block.h>
|
|
|
|
#include <hash.h>
|
|
#include <tinyformat.h>
|
|
|
|
uint256 CBlockHeader::GetHash() const
|
|
{
|
|
return (CHashWriter{PROTOCOL_VERSION} << *this).GetHash();
|
|
}
|
|
|
|
std::string CBlock::ToString() const
|
|
{
|
|
std::stringstream s;
|
|
s << strprintf("CBlock(hash=%s, ver=0x%08x, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%u)\n",
|
|
GetHash().ToString(),
|
|
nVersion,
|
|
hashPrevBlock.ToString(),
|
|
hashMerkleRoot.ToString(),
|
|
nTime, nBits, nNonce,
|
|
vtx.size());
|
|
for (const auto& tx : vtx) {
|
|
s << " " << tx->ToString() << "\n";
|
|
}
|
|
return s.str();
|
|
}
|