aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2022-07-16 15:19:03 +0200
committerJon Atack <jon@atack.com>2022-07-22 12:47:13 +0200
commit3a61fc56a0ad6ed58570350dcfd9ed2d10239b48 (patch)
treeefa4ca6dddcc2acb62e8306000a00e930f9e33e5 /src
parent57865eb51288852c3ce99607eff76c61ae5f5365 (diff)
downloadbitcoin-3a61fc56a0ad6ed58570350dcfd9ed2d10239b48.tar.xz
refactor: move CBlockIndex#ToString() from header to implementation
which allows dropping tinyformat.h from the header file.
Diffstat (limited to 'src')
-rw-r--r--src/chain.cpp7
-rw-r--r--src/chain.h9
2 files changed, 8 insertions, 8 deletions
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 <chain.h>
+#include <tinyformat.h>
#include <util/time.h>
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();
diff --git a/src/chain.h b/src/chain.h
index 6b2e4367e9..627a3dfab2 100644
--- a/src/chain.h
+++ b/src/chain.h
@@ -11,7 +11,6 @@
#include <flatfile.h>
#include <primitives/block.h>
#include <sync.h>
-#include <tinyformat.h>
#include <uint256.h>
#include <vector>
@@ -302,13 +301,7 @@ public:
return pbegin[(pend - pbegin) / 2];
}
- std::string ToString() const
- {
- return strprintf("CBlockIndex(pprev=%p, nHeight=%d, merkle=%s, hashBlock=%s)",
- pprev, nHeight,
- hashMerkleRoot.ToString(),
- GetBlockHash().ToString());
- }
+ std::string ToString() const;
//! Check whether this block index entry is valid up to the passed validity level.
bool IsValid(enum BlockStatus nUpTo = BLOCK_VALID_TRANSACTIONS) const