diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2012-08-13 07:02:44 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-11-13 21:18:32 +0000 |
commit | f3a84c3a6b22cfcf4fdcf187997e87b96a910318 (patch) | |
tree | e597626f88495393e88a82ee11cb8fe37046a57e /src/main.h | |
parent | f2b12807d04e981d0a252cbda6ba80c87a809d6e (diff) |
Abstract block hash substr extraction (for debug.log) into BlockHashStr inline
Diffstat (limited to 'src/main.h')
-rw-r--r-- | src/main.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main.h b/src/main.h index 0ef192f901..7b368ef2b0 100644 --- a/src/main.h +++ b/src/main.h @@ -174,6 +174,11 @@ CBlockIndex * InsertBlockIndex(uint256 hash); +static inline std::string BlockHashStr(const uint256& hash) +{ + return hash.ToString().substr(0, 20); +} + bool GetWalletFile(CWallet* pwallet, std::string &strWalletFileOut); class CDiskBlockPos @@ -1257,9 +1262,9 @@ public: void print() const { printf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%"PRIszu")\n", - GetHash().ToString().substr(0,20).c_str(), + BlockHashStr(GetHash()).c_str(), nVersion, - hashPrevBlock.ToString().substr(0,20).c_str(), + BlockHashStr(hashPrevBlock).c_str(), hashMerkleRoot.ToString().substr(0,10).c_str(), nTime, nBits, nNonce, vtx.size()); @@ -1570,7 +1575,7 @@ public: return strprintf("CBlockIndex(pprev=%p, pnext=%p, nHeight=%d, merkle=%s, hashBlock=%s)", pprev, pnext, nHeight, hashMerkleRoot.ToString().substr(0,10).c_str(), - GetBlockHash().ToString().substr(0,20).c_str()); + BlockHashStr(GetBlockHash()).c_str()); } void print() const @@ -1651,7 +1656,7 @@ public: str += CBlockIndex::ToString(); str += strprintf("\n hashBlock=%s, hashPrev=%s)", GetBlockHash().ToString().c_str(), - hashPrev.ToString().substr(0,20).c_str()); + BlockHashStr(hashPrev).c_str()); return str; } |