From 60f70620c28a53782ce9c55d6ba29ea56b1edd11 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Fri, 7 Dec 2018 10:26:35 +0100 Subject: [PATCH] Define block signatures, active IFF g_signed_blocks active --- src/primitives/block.cpp | 10 ++++++-- src/primitives/block.h | 55 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 5 deletions(-) diff --git a/src/primitives/block.cpp b/src/primitives/block.cpp index 09639351a8..42e7e3f6eb 100644 --- a/src/primitives/block.cpp +++ b/src/primitives/block.cpp @@ -13,6 +13,12 @@ bool g_con_blockheightinheader = false; bool g_signed_blocks = false; +std::string CProof::ToString() const +{ + return strprintf("CProof(challenge=%s, solution=%s)", + HexStr(challenge), HexStr(solution)); +} + uint256 CBlockHeader::GetHash() const { return SerializeHash(*this); @@ -21,12 +27,12 @@ uint256 CBlockHeader::GetHash() const 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", + s << strprintf("CBlock(hash=%s, ver=0x%08x, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, proof=%u, vtx=%u)\n", GetHash().ToString(), nVersion, hashPrevBlock.ToString(), hashMerkleRoot.ToString(), - nTime, nBits, nNonce, + nTime, nBits, nNonce, proof.ToString(), vtx.size()); for (const auto& tx : vtx) { s << " " << tx->ToString() << "\n"; diff --git a/src/primitives/block.h b/src/primitives/block.h index 0e04a8ed60..0a48e316ef 100644 --- a/src/primitives/block.h +++ b/src/primitives/block.h @@ -7,10 +7,48 @@ #define BITCOIN_PRIMITIVES_BLOCK_H #include +#include