From 7a114e7d84f81a937a7430d16fad84ebc67e98ec Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sun, 10 Jun 2012 01:05:24 -0700 Subject: [PATCH] Make the account state tag more readable. --- src/Ledger.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Ledger.cpp b/src/Ledger.cpp index 0c5929082e..146ccd1a4b 100644 --- a/src/Ledger.cpp +++ b/src/Ledger.cpp @@ -401,7 +401,16 @@ void Ledger::addJson(Json::Value& ret, int options) SerializedLedgerEntry sle(sit, item->getTag()); state.append(sle.getJson(0)); } - else state.append(item->getTag().GetHex()); + else + { // 16-bit namespace, 160-bit tag, 80-bit index + const uint256& tag = item->getTag(); + uint160 account; + memcpy(account.begin(), tag.begin() + 4, account.size()); + NewcoinAddress naAccount; + naAccount.setAccountID(account); + state.append(strHex(tag.begin(), 4) + ":" + naAccount.humanAccountID() + ":" + + strHex(tag.begin() + 4 + account.size(), tag.size() - (account.size() + 4))); + } } ledger["AccountState"] = state; }