From dce82590e605c9d1d28ff3b050dacd47dbe061e8 Mon Sep 17 00:00:00 2001 From: Sunny King Date: Wed, 29 Aug 2012 20:05:36 +0100 Subject: [PATCH] PPCoin: Pretty print txout script in getblock RPC command --- src/main.h | 4 ++-- src/script.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.h b/src/main.h index 34ec560..b673a4b 100644 --- a/src/main.h +++ b/src/main.h @@ -387,7 +387,7 @@ public: std::string ToStringShort() const { - return strprintf(" out amount %s", FormatMoney(nValue).c_str()); + return strprintf(" out %s %s", FormatMoney(nValue).c_str(), scriptPubKey.ToString(true).c_str()); } std::string ToString() const @@ -395,7 +395,7 @@ public: if (IsEmpty()) return "CTxOut(empty)"; if (scriptPubKey.size() < 6) return "CTxOut(error)"; - return strprintf("CTxOut(nValue=%s, scriptPubKey=%s)", FormatMoney(nValue).c_str(), scriptPubKey.ToString().substr(0,30).c_str()); + return strprintf("CTxOut(nValue=%s, scriptPubKey=%s)", FormatMoney(nValue).c_str(), scriptPubKey.ToString().c_str()); } void print() const diff --git a/src/script.h b/src/script.h index 2aa08fe..9a19b63 100644 --- a/src/script.h +++ b/src/script.h @@ -532,7 +532,7 @@ public: printf("CScript(%s)\n", HexStr(begin(), end(), true).c_str()); } - std::string ToString() const + std::string ToString(bool fShort=false) const { std::string str; opcodetype opcode; @@ -548,7 +548,7 @@ public: return str; } if (0 <= opcode && opcode <= OP_PUSHDATA4) - str += ValueString(vch); + str += fShort? ValueString(vch).substr(0, 10) : ValueString(vch); else str += GetOpName(opcode); } -- 1.7.1