Some nicer logging.

This commit is contained in:
JoelKatz
2012-10-11 07:01:23 -07:00
parent 55e38c40f7
commit cf6206f19b

View File

@@ -18,6 +18,9 @@
std::string SHAMapNode::getString() const
{
if ((mDepth == 0) && (mNodeID.isZero()))
return "NodeID(root)";
return str(boost::format("NodeID(%s,%s)")
% boost::lexical_cast<std::string>(mDepth)
% mNodeID.GetHex());
@@ -507,4 +510,16 @@ bool SHAMapTreeNode::setChildHash(int m, const uint256 &hash)
return updateHash();
}
std::ostream& operator<<(std::ostream& out, const SHAMapMissingNode& mn)
{
if (mn.getMapType() == smtTRANSACTION)
out << "Missing/TXN(" << mn.getNodeID() << ")";
else if (mn.getMapType() == smtSTATE)
out << "Missing/STA(" << mn.getNodeID() << ")";
else
out << "Missing/" << mn.getNodeID();
}
// vim:ts=4