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

@@ -6,6 +6,7 @@
#include "protocol.h"
#include "util.h"
#include "netbase.h"
#include "main.h"
#ifndef WIN32
# include <arpa/inet.h>
@@ -140,6 +141,11 @@ const char* CInv::GetCommand() const
std::string CInv::ToString() const
{
if (type == MSG_BLOCK)
return strprintf("%s %s", GetCommand(), BlockHashStr(hash).c_str());
if (type == MSG_TX)
return strprintf("%s %s", GetCommand(), hash.ToString().substr(0,10).c_str());
return strprintf("%s %s", GetCommand(), hash.ToString().substr(0,20).c_str());
}