From 5ada49d2066eb80852cd92978b71da9bb90afe8d Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sat, 5 May 2012 13:51:08 -0700 Subject: [PATCH] Ledger switch logic. --- src/NetworkOPs.cpp | 11 +++++++++-- src/NetworkOPs.h | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/NetworkOPs.cpp b/src/NetworkOPs.cpp index 1d23cc0811..bb87f4dcbc 100644 --- a/src/NetworkOPs.cpp +++ b/src/NetworkOPs.cpp @@ -256,8 +256,7 @@ void NetworkOPs::checkState() } consensus = acq->getLedger(); } - // WRITEME switchLedgers(currentClosed, consenus, slNETJUMP); - // Function to call Ledger::switchPreviousLedger + switchLastClosedLedger(consensus); } if (mMode == omCONNECTED) @@ -278,3 +277,11 @@ void NetworkOPs::checkState() setStateTimer(10); } + +void NetworkOPs::switchLastClosedLedger(Ledger::pointer newLedger) +{ // set the newledger as our last closed ledger + // FIXME: Must recover transactions + Ledger::pointer openLedger = boost::make_shared(newLedger); + theApp->getMasterLedger().switchLedgers(newLedger, openLedger); + // FIXME: Set close timer +} diff --git a/src/NetworkOPs.h b/src/NetworkOPs.h index e0b175d44f..bef0a4b44a 100644 --- a/src/NetworkOPs.h +++ b/src/NetworkOPs.h @@ -5,6 +5,7 @@ #include "Transaction.h" #include "AccountState.h" +#include "Ledger.h" // Operations that clients may wish to perform against the network // Master operational handler, server sequencer, network tracker @@ -65,6 +66,7 @@ public: // network state machine void checkState(); + void switchLastClosedLedger(Ledger::pointer newLedger); protected: