Skip to content

Commit

Permalink
PPCoin: Pretty print txout script in getblock RPC command
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyking committed Aug 29, 2012
1 parent b43972d commit dce8259
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,15 +387,15 @@ class CTxOut

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
{
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
Expand Down
4 changes: 2 additions & 2 deletions src/script.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ class CScript : public std::vector<unsigned char>
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;
Expand All @@ -548,7 +548,7 @@ class CScript : public std::vector<unsigned char>
return str;
}
if (0 <= opcode && opcode <= OP_PUSHDATA4)
str += ValueString(vch);
str += fShort? ValueString(vch).substr(0, 10) : ValueString(vch);
else
str += GetOpName(opcode);
}
Expand Down

0 comments on commit dce8259

Please sign in to comment.