refactor: move CBlockIndex#ToString() from header to implementation

which allows dropping tinyformat.h from the header file.
This commit is contained in:
Jon Atack
2022-07-16 15:19:03 +02:00
parent 57865eb512
commit 3a61fc56a0
2 changed files with 8 additions and 8 deletions

View File

@@ -4,6 +4,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <chain.h> #include <chain.h>
#include <tinyformat.h>
#include <util/time.h> #include <util/time.h>
std::string CBlockFileInfo::ToString() const 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)); 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) { void CChain::SetTip(CBlockIndex *pindex) {
if (pindex == nullptr) { if (pindex == nullptr) {
vChain.clear(); vChain.clear();

View File

@@ -11,7 +11,6 @@
#include <flatfile.h> #include <flatfile.h>
#include <primitives/block.h> #include <primitives/block.h>
#include <sync.h> #include <sync.h>
#include <tinyformat.h>
#include <uint256.h> #include <uint256.h>
#include <vector> #include <vector>
@@ -302,13 +301,7 @@ public:
return pbegin[(pend - pbegin) / 2]; return pbegin[(pend - pbegin) / 2];
} }
std::string ToString() const std::string ToString() const;
{
return strprintf("CBlockIndex(pprev=%p, nHeight=%d, merkle=%s, hashBlock=%s)",
pprev, nHeight,
hashMerkleRoot.ToString(),
GetBlockHash().ToString());
}
//! Check whether this block index entry is valid up to the passed validity level. //! Check whether this block index entry is valid up to the passed validity level.
bool IsValid(enum BlockStatus nUpTo = BLOCK_VALID_TRANSACTIONS) const bool IsValid(enum BlockStatus nUpTo = BLOCK_VALID_TRANSACTIONS) const