Abstract block hash substr extraction (for debug.log) into BlockHashStr inline

This commit is contained in:
Luke Dashjr
2012-08-13 07:02:44 +00:00
parent f2b12807d0
commit f3a84c3a6b
5 changed files with 38 additions and 27 deletions

View File

@@ -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;
}