From 0622e4fd44eb895641a9d6b6e3eb23f7d324b200 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Thu, 15 Oct 2015 15:26:08 -0700 Subject: [PATCH] Process batch during OpenLedger::modify --- src/ripple/app/misc/NetworkOPs.cpp | 34 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp index a1bb1215c0..482799efc4 100644 --- a/src/ripple/app/misc/NetworkOPs.cpp +++ b/src/ripple/app/misc/NetworkOPs.cpp @@ -832,25 +832,25 @@ void NetworkOPsImp::apply (std::unique_lock& batchLock) std::lock_guard lock ( m_ledgerMaster.peekMutex()); - for (TransactionStatus& e : transactions) + app_.openLedger().modify( + [&](OpenView& view, beast::Journal j) { - ApplyFlags flags = tapNONE; - // All code paths to this point are gated by validity checks. - flags = flags | tapNO_CHECK_SIGN; - if (e.admin) - flags = flags | tapADMIN; + bool changed = false; + for (TransactionStatus& e : transactions) + { + // we check before addingto the batch + ApplyFlags flags = tapNO_CHECK_SIGN; + if (e.admin) + flags = flags | tapADMIN; - // VFALCO Should do the loop inside modify() - app_.openLedger().modify( - [&](OpenView& view, beast::Journal j) - { - auto const result = ripple::apply(app_, view, - *e.transaction->getSTransaction(), flags, j); - e.result = result.first; - e.applied = result.second; - return result.second; - }); - } + auto const result = ripple::apply(app_, view, + *e.transaction->getSTransaction(), flags, j); + e.result = result.first; + e.applied = result.second; + changed = changed || result.second; + } + return changed; + }); } auto newOL = app_.openLedger().current();