Local accounts now have their balances and sequences managed from the active

ledger, not from the wallet.
This commit is contained in:
JoelKatz
2012-04-24 04:24:14 -07:00
parent f36d1fdc08
commit 0392d8ddcb
6 changed files with 42 additions and 70 deletions

View File

@@ -14,6 +14,9 @@
Transaction::Transaction(LocalAccount::pointer fromLocalAccount, const NewcoinAddress& toAccount, uint64 amount,
uint32 ident, uint32 ledger) : mInLedger(0), mStatus(NEW)
{
AccountState::pointer accountState = fromLocalAccount->getAccountState();
if (!accountState) throw std::runtime_error("transaction on non-existent account");
mAccountFrom = fromLocalAccount->getAddress();
mTransaction = boost::make_shared<SerializedTransaction>(ttMAKE_PAYMENT);
@@ -22,8 +25,9 @@ Transaction::Transaction(LocalAccount::pointer fromLocalAccount, const NewcoinAd
assert(mFromPubKey);
mTransaction->setSigningAccount(mFromPubKey->GetPubKey());
mTransaction->setSequence(fromLocalAccount->getTxnSeq());
mTransaction->setSequence(accountState->getSeq());
assert(mTransaction->getSequence() != 0);
mTransaction->setTransactionFee(100); // for now
mTransaction->setITFieldAccount(sfDestination, toAccount);