Fix the account state bug. Rewrite the relationship between families and

accounts. Remove the LocalAccountEntry class and make some huge
simplifications.
 Ledger.cpp     |   14 +++++--
 LocalAccount.h |   80 +++++++++++++++------------------------------
 Wallet.cpp     |  101 +++++++++++++++++++--------------------------------------
This commit is contained in:
JoelKatz
2012-01-18 11:43:25 -08:00
parent 2e0d47f782
commit b2b8caf6b9
3 changed files with 72 additions and 123 deletions

View File

@@ -95,6 +95,7 @@ bool Ledger::updateAccountState(AccountState::pointer state)
bool Ledger::addAccountState(AccountState::pointer state)
{
assert(!mAccepted);
assert( (state->getBalance()==0) || (state->getSeq()>0) );
SHAMapItem::pointer item(new SHAMapItem(state->getAccountID(), state->getRaw()));
return mAccountStateMap->addGiveItem(item);
}
@@ -269,11 +270,16 @@ Ledger::pointer Ledger::closeLedger(uint64 timeStamp)
return Ledger::pointer(new Ledger(*this, timeStamp));
}
void LocalAccount::syncLedger(const uint160& acctID)
void LocalAccount::syncLedger()
{
AccountState::pointer as=theApp->getMasterLedger().getAccountState(acctID);
if(!as) setLedgerBalance(0);
else syncLedger(as->getBalance(), as->getSeq());
AccountState::pointer as=theApp->getMasterLedger().getAccountState(getAddress());
if(!as) mLgrBalance=0;
else
{
mLgrBalance=as->getBalance();
if( (mLgrBalance!=0) && (mAccountSeq==0) ) mAccountSeq=1;
if(mAccountSeq<as->getSeq()) mAccountSeq=as->getSeq();
}
}
bool Ledger::unitTest()