Make debug easier.

This commit is contained in:
JoelKatz
2012-04-26 17:30:32 -07:00
parent d5d0a21801
commit 80efbfb6ee
2 changed files with 13 additions and 2 deletions

View File

@@ -4,6 +4,8 @@
#include <boost/lexical_cast.hpp>
#include <boost/make_shared.hpp>
#include "../json/writer.h"
#include "Ledger.h"
#include "Serializer.h"
@@ -19,7 +21,7 @@ AccountState::AccountState(const NewcoinAddress& id) : mAccountID(id), mValid(fa
AccountState::AccountState(SerializedLedgerEntry::pointer ledgerEntry) : mLedgerEntry(ledgerEntry), mValid(false)
{
if (!mLedgerEntry) return;
if (mLedgerEntry->getType()!=ltACCOUNT_ROOT) return;
if (mLedgerEntry->getType() != ltACCOUNT_ROOT) return;
mAccountID = mLedgerEntry->getValueFieldAccount(sfAccount);
if (mAccountID.isValid()) mValid = true;
}
@@ -27,6 +29,14 @@ AccountState::AccountState(SerializedLedgerEntry::pointer ledgerEntry) : mLedger
void AccountState::addJson(Json::Value& val)
{
val = mLedgerEntry->getJson(0);
if(!mValid) val["Invalid"]=true;
if (!mValid) val["Invalid"] = true;
}
void AccountState::dump()
{
Json::Value j(Json::objectValue);
Json::StyledStreamWriter ssw;
ssw.write(std::cerr, j);
}
// vim:ts=4

View File

@@ -38,6 +38,7 @@ public:
std::vector<unsigned char> getRaw() const;
void addJson(Json::Value& value);
void dump();
};
#endif