From 3a61fc56a0ad6ed58570350dcfd9ed2d10239b48 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Sat, 16 Jul 2022 15:19:03 +0200 Subject: refactor: move CBlockIndex#ToString() from header to implementation which allows dropping tinyformat.h from the header file. --- src/chain.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/chain.cpp') diff --git a/src/chain.cpp b/src/chain.cpp index b8158f7b0b..0f898bafd5 100644 --- a/src/chain.cpp +++ b/src/chain.cpp @@ -4,6 +4,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include +#include #include std::string CBlockFileInfo::ToString() const @@ -11,6 +12,12 @@ std::string CBlockFileInfo::ToString() const return strprintf("CBlockFileInfo(blocks=%u, size=%u, heights=%u...%u, time=%s...%s)", nBlocks, nSize, nHeightFirst, nHeightLast, FormatISO8601Date(nTimeFirst), FormatISO8601Date(nTimeLast)); } +std::string CBlockIndex::ToString() const +{ + return strprintf("CBlockIndex(pprev=%p, nHeight=%d, merkle=%s, hashBlock=%s)", + pprev, nHeight, hashMerkleRoot.ToString(), GetBlockHash().ToString()); +} + void CChain::SetTip(CBlockIndex *pindex) { if (pindex == nullptr) { vChain.clear(); -- cgit v1.2.3