From 25a2d6f15165b583c1cecb607fc1e87823f556b0 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 8 May 2012 19:53:54 -0700 Subject: [PATCH] Cosmetic fixes. --- src/LocalAccount.h | 4 ++-- src/Wallet.cpp | 27 ++++++++++++++------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/LocalAccount.h b/src/LocalAccount.h index ee292625d..9e677c7bd 100644 --- a/src/LocalAccount.h +++ b/src/LocalAccount.h @@ -16,7 +16,7 @@ public: protected: // core account information CKey::pointer mPublicKey; - NewcoinAddress mAcctID; + NewcoinAddress mAccount; std::string mComment; // family information @@ -32,7 +32,7 @@ public: bool updateName(); // writes changed name/comment bool updateBalance(); // writes changed balance/seq - const NewcoinAddress& getAddress() const { return mAcctID; } + const NewcoinAddress& getAddress() const { return mAccount; } int getAcctFSeq() const { return mAccountFSeq; } std::string getFullName() const; diff --git a/src/Wallet.cpp b/src/Wallet.cpp index dcc0fe9cb..a0897a8bb 100644 --- a/src/Wallet.cpp +++ b/src/Wallet.cpp @@ -28,8 +28,8 @@ LocalAccount::LocalAccount(boost::shared_ptr family, int familySeq) : mPublicKey(family->getPublicKey(familySeq)), mFamily(family), mAccountFSeq(familySeq) { - mAcctID.setAccountPublic(mPublicKey->GetPubKey()); - if(theApp!=NULL) mPublicKey = theApp->getPubKeyCache().store(mAcctID, mPublicKey); + mAccount.setAccountPublic(mPublicKey->GetPubKey()); + if (theApp != NULL) mPublicKey = theApp->getPubKeyCache().store(mAccount, mPublicKey); } std::string LocalAccount::getFullName() const @@ -52,7 +52,7 @@ std::string LocalAccount::getFamilyName() const AccountState::pointer LocalAccount::getAccountState() const { - return theApp->getOPs().getAccountState(mAcctID); + return theApp->getOPs().getAccountState(mAccount); } uint64 LocalAccount::getEffectiveBalance() const @@ -73,12 +73,13 @@ Json::Value LocalAccount::getJson() const ret["IsLocked"] = mFamily->isLocked(); AccountState::pointer as = getAccountState(); - if (!as) ret["Account"] = "None"; + if (!as) ret["State"] = "None"; else { + assert(as->getAccountID().getAccountID() == mAccount.getAccountID()); Json::Value acct(Json::objectValue); as->addJson(acct); - ret["Account"] = acct; + ret["State"] = acct; } return ret; @@ -484,17 +485,17 @@ void Wallet::load() LocalAccount::pointer Wallet::getNewLocalAccount(const NewcoinAddress& family) { boost::recursive_mutex::scoped_lock sl(mLock); - std::map::iterator fit=mFamilies.find(family); - if(fit==mFamilies.end()) return LocalAccount::pointer(); + std::map::iterator fit = mFamilies.find(family); + if (fit == mFamilies.end()) return LocalAccount::pointer(); - uint32 seq=fit->second->getSeq(); - NewcoinAddress acct=fit->second->getAccount(seq, true); - fit->second->setSeq(seq+1); // FIXME: writeout new seq + uint32 seq = fit->second->getSeq(); + NewcoinAddress acct = fit->second->getAccount(seq, true); + fit->second->setSeq(seq + 1); // FIXME: writeout new seq - std::map::iterator ait=mAccounts.find(acct); - if(ait!=mAccounts.end()) return ait->second; + std::map::iterator ait = mAccounts.find(acct); + if (ait != mAccounts.end()) return ait->second; - LocalAccount::pointer lac=boost::make_shared(fit->second, seq); + LocalAccount::pointer lac = boost::make_shared(fit->second, seq); mAccounts.insert(std::make_pair(acct, lac)); sl.unlock();