From e9928ecc203ef4d2d9e61d8b0538ad411b2d6ed3 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 18 Jan 2012 14:17:28 -0800 Subject: [PATCH] Change name of mAccountSeq to make it clear that it's the family sequence not the transaction sequence --- Wallet.cpp | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/Wallet.cpp b/Wallet.cpp index e9d29542c7..620110e77d 100644 --- a/Wallet.cpp +++ b/Wallet.cpp @@ -18,9 +18,9 @@ #define CHECK_NEW_FAMILIES 500 #endif -LocalAccount::LocalAccount(boost::shared_ptr family, int accountSeq) : - mPublicKey(family->getPublicKey(accountSeq)), mFamily(family), mAccountSeq(accountSeq), - mLgrBalance(0), mTxnDelta(0), mTxnSeq(0) +LocalAccount::LocalAccount(boost::shared_ptr family, int familySeq) : + mPublicKey(family->getPublicKey(familySeq)), mFamily(family), mAccountFSeq(familySeq), + mLgrBalance(0), mTxnDelta(0), mTxnSeq(0) { mAcctID=mPublicKey->GetAddress().GetHash160(); if(theApp!=NULL) mPublicKey=theApp->getPubKeyCache().store(mAcctID, mPublicKey); @@ -33,7 +33,7 @@ std::string LocalAccount::getAccountName() const std::string LocalAccount::getLocalAccountName() const { - return NewcoinAddress(mFamily->getFamily()).GetString() + ":" + boost::lexical_cast(mAccountSeq); + return NewcoinAddress(mFamily->getFamily()).GetString() + ":" + boost::lexical_cast(mAccountFSeq); } LocalAccountFamily::LocalAccountFamily(const uint160& family, const EC_GROUP* group, const EC_POINT* pubKey) : @@ -104,13 +104,8 @@ CKey::pointer LocalAccountFamily::getPublicKey(int seq) CKey::pointer LocalAccountFamily::getPrivateKey(int seq) { - if(!mRootPrivateKey) - { -#ifdef DEBUG - std::cerr << "Cannot get private key from loced family" << std::endl; -#endif - return CKey::pointer(); - } + if(!mRootPrivateKey) return CKey::pointer(); + std::cerr << "PrivKey(" << mFamily.GetHex() << "," << seq << ")" << std::endl; return CKey::pointer(new CKey(mFamily, mRootPrivateKey, seq)); } @@ -359,7 +354,7 @@ std::string LocalAccount::getShortName() const ret=mFamily->getFamily().GetHex(); ret.append(":"); if(mName.empty()) - ret.append(boost::lexical_cast(mAccountSeq)); + ret.append(boost::lexical_cast(mAccountFSeq)); else ret.append(mName); return ret; } @@ -368,7 +363,7 @@ std::string LocalAccount::getFullName() const { std::string ret(mFamily->getFamily().GetHex()); ret.append(":"); - ret.append(boost::lexical_cast(mAccountSeq)); + ret.append(boost::lexical_cast(mAccountFSeq)); return ret; } @@ -395,7 +390,7 @@ Json::Value LocalAccount::getJson() const uint64 eb=getEffectiveBalance(); if(eb!=0) ret["Balance"]=boost::lexical_cast(eb); - uint32 sq=getAcctSeq(); + uint32 sq=getTxnSeq(); if(sq!=0) ret["TxnSeq"]=boost::lexical_cast(sq); return ret; @@ -403,12 +398,12 @@ Json::Value LocalAccount::getJson() const bool LocalAccount::isIssued() const { - return mAccountSeq < mFamily->getSeq(); + return mAccountFSeq < mFamily->getSeq(); } CKey::pointer LocalAccount::getPrivateKey() { - return mFamily->getPrivateKey(mAccountSeq); + return mFamily->getPrivateKey(mAccountFSeq); } void Wallet::getFamilies(std::vector& familyIDs)