Cosmetic fixes.

This commit is contained in:
JoelKatz
2012-05-08 19:53:54 -07:00
parent 71b61a633d
commit 25a2d6f151
2 changed files with 16 additions and 15 deletions

View File

@@ -16,7 +16,7 @@ public:
protected: protected:
// core account information // core account information
CKey::pointer mPublicKey; CKey::pointer mPublicKey;
NewcoinAddress mAcctID; NewcoinAddress mAccount;
std::string mComment; std::string mComment;
// family information // family information
@@ -32,7 +32,7 @@ public:
bool updateName(); // writes changed name/comment bool updateName(); // writes changed name/comment
bool updateBalance(); // writes changed balance/seq bool updateBalance(); // writes changed balance/seq
const NewcoinAddress& getAddress() const { return mAcctID; } const NewcoinAddress& getAddress() const { return mAccount; }
int getAcctFSeq() const { return mAccountFSeq; } int getAcctFSeq() const { return mAccountFSeq; }
std::string getFullName() const; std::string getFullName() const;

View File

@@ -28,8 +28,8 @@
LocalAccount::LocalAccount(boost::shared_ptr<LocalAccountFamily> family, int familySeq) : LocalAccount::LocalAccount(boost::shared_ptr<LocalAccountFamily> family, int familySeq) :
mPublicKey(family->getPublicKey(familySeq)), mFamily(family), mAccountFSeq(familySeq) mPublicKey(family->getPublicKey(familySeq)), mFamily(family), mAccountFSeq(familySeq)
{ {
mAcctID.setAccountPublic(mPublicKey->GetPubKey()); mAccount.setAccountPublic(mPublicKey->GetPubKey());
if(theApp!=NULL) mPublicKey = theApp->getPubKeyCache().store(mAcctID, mPublicKey); if (theApp != NULL) mPublicKey = theApp->getPubKeyCache().store(mAccount, mPublicKey);
} }
std::string LocalAccount::getFullName() const std::string LocalAccount::getFullName() const
@@ -52,7 +52,7 @@ std::string LocalAccount::getFamilyName() const
AccountState::pointer LocalAccount::getAccountState() const AccountState::pointer LocalAccount::getAccountState() const
{ {
return theApp->getOPs().getAccountState(mAcctID); return theApp->getOPs().getAccountState(mAccount);
} }
uint64 LocalAccount::getEffectiveBalance() const uint64 LocalAccount::getEffectiveBalance() const
@@ -73,12 +73,13 @@ Json::Value LocalAccount::getJson() const
ret["IsLocked"] = mFamily->isLocked(); ret["IsLocked"] = mFamily->isLocked();
AccountState::pointer as = getAccountState(); AccountState::pointer as = getAccountState();
if (!as) ret["Account"] = "None"; if (!as) ret["State"] = "None";
else else
{ {
assert(as->getAccountID().getAccountID() == mAccount.getAccountID());
Json::Value acct(Json::objectValue); Json::Value acct(Json::objectValue);
as->addJson(acct); as->addJson(acct);
ret["Account"] = acct; ret["State"] = acct;
} }
return ret; return ret;
@@ -484,17 +485,17 @@ void Wallet::load()
LocalAccount::pointer Wallet::getNewLocalAccount(const NewcoinAddress& family) LocalAccount::pointer Wallet::getNewLocalAccount(const NewcoinAddress& family)
{ {
boost::recursive_mutex::scoped_lock sl(mLock); boost::recursive_mutex::scoped_lock sl(mLock);
std::map<NewcoinAddress, LocalAccountFamily::pointer>::iterator fit=mFamilies.find(family); std::map<NewcoinAddress, LocalAccountFamily::pointer>::iterator fit = mFamilies.find(family);
if(fit==mFamilies.end()) return LocalAccount::pointer(); if (fit == mFamilies.end()) return LocalAccount::pointer();
uint32 seq=fit->second->getSeq(); uint32 seq = fit->second->getSeq();
NewcoinAddress acct=fit->second->getAccount(seq, true); NewcoinAddress acct = fit->second->getAccount(seq, true);
fit->second->setSeq(seq+1); // FIXME: writeout new seq fit->second->setSeq(seq + 1); // FIXME: writeout new seq
std::map<NewcoinAddress, LocalAccount::pointer>::iterator ait=mAccounts.find(acct); std::map<NewcoinAddress, LocalAccount::pointer>::iterator ait = mAccounts.find(acct);
if(ait!=mAccounts.end()) return ait->second; if (ait != mAccounts.end()) return ait->second;
LocalAccount::pointer lac=boost::make_shared<LocalAccount>(fit->second, seq); LocalAccount::pointer lac = boost::make_shared<LocalAccount>(fit->second, seq);
mAccounts.insert(std::make_pair(acct, lac)); mAccounts.insert(std::make_pair(acct, lac));
sl.unlock(); sl.unlock();