aboutsummaryrefslogtreecommitdiff
path: root/src/protocol.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2012-08-13 07:02:44 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2012-11-13 21:18:32 +0000
commitf3a84c3a6b22cfcf4fdcf187997e87b96a910318 (patch)
treee597626f88495393e88a82ee11cb8fe37046a57e /src/protocol.cpp
parentf2b12807d04e981d0a252cbda6ba80c87a809d6e (diff)
Abstract block hash substr extraction (for debug.log) into BlockHashStr inline
Diffstat (limited to 'src/protocol.cpp')
-rw-r--r--src/protocol.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/protocol.cpp b/src/protocol.cpp
index d6e340e366..23969e5b97 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -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());
}