PPCoin: Pretty print txout script in getblock RPC command
authorSunny King <sunnyking9999@gmail.com>
Wed, 29 Aug 2012 19:05:36 +0000 (20:05 +0100)
committerSunny King <sunnyking9999@gmail.com>
Wed, 29 Aug 2012 19:05:36 +0000 (20:05 +0100)
src/main.h
src/script.h

index 34ec560..b673a4b 100644 (file)
@@ -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
index 2aa08fe..9a19b63 100644 (file)
@@ -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);
         }