From 53594f126f353a2fef0044d88dedb2760630589f Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sat, 14 Jul 2012 02:14:50 -0700 Subject: [PATCH] Bugfixes. --- src/Application.cpp | 25 +++++++++++-------------- src/LedgerMaster.cpp | 4 ++-- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/Application.cpp b/src/Application.cpp index afcaca631..42be550c1 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -130,21 +130,18 @@ void Application::run() Log(lsINFO) << "Root account: " << rootAddress.humanAccountID(); { - Ledger::pointer ledger = boost::make_shared(rootAddress, SYSTEM_CURRENCY_START); - assert(!!ledger->getAccountState(rootAddress)); - ledger->updateHash(); - ledger->setClosed(); - ledger->setAccepted(); - mMasterLedger.pushLedger(ledger); + Ledger::pointer firstLedger = boost::make_shared(rootAddress, SYSTEM_CURRENCY_START); + assert(!!firstLedger->getAccountState(rootAddress)); + firstLedger->updateHash(); + firstLedger->setClosed(); + firstLedger->setAccepted(); + mMasterLedger.pushLedger(firstLedger); - for (int i = 0; i < 2; ++i) - { - ledger = boost::make_shared(true, boost::ref(*ledger)); - ledger->setClosed(); - ledger->setAccepted(); - mMasterLedger.pushLedger(ledger); - assert(!!ledger->getAccountState(rootAddress)); - } + Ledger::pointer secondLedger = boost::make_shared(true, boost::ref(*firstLedger)); + secondLedger->setClosed(); + secondLedger->setAccepted(); + mMasterLedger.pushLedger(secondLedger, boost::make_shared(true, boost::ref(*secondLedger))); + assert(!!secondLedger->getAccountState(rootAddress)); } mNetOps.setStateTimer(); diff --git a/src/LedgerMaster.cpp b/src/LedgerMaster.cpp index 7d86d5922..1aa2d6a78 100644 --- a/src/LedgerMaster.cpp +++ b/src/LedgerMaster.cpp @@ -42,8 +42,8 @@ void LedgerMaster::pushLedger(Ledger::pointer newLCL, Ledger::pointer newOL) if (newLCL->isAccepted()) { - mLedgerHistory.addAcceptedLedger(mFinalizedLedger); - Log(lsINFO) << "StashAccepted: " << mFinalizedLedger->getHash().GetHex(); + mLedgerHistory.addAcceptedLedger(newLCL); + Log(lsINFO) << "StashAccepted: " << newLCL->getHash().GetHex(); } mFinalizedLedger = newLCL;