From 2eec47415e57df97a97f323385e2b73a467711ca Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Tue, 30 Jun 2015 11:33:38 -0700 Subject: [PATCH] Add enableTesting flag to applyTransactions --- src/ripple/app/ledger/LedgerConsensus.h | 6 +++--- src/ripple/app/ledger/impl/LedgerConsensusImp.cpp | 13 +++++++++---- src/ripple/app/ledger/impl/LedgerConsensusImp.h | 1 + 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/ripple/app/ledger/LedgerConsensus.h b/src/ripple/app/ledger/LedgerConsensus.h index 70534d124..adab4590a 100644 --- a/src/ripple/app/ledger/LedgerConsensus.h +++ b/src/ripple/app/ledger/LedgerConsensus.h @@ -78,13 +78,13 @@ public: @param retriableTransactions collect failed transactions in this set @param openLgr true if applyLedger is open, else false. */ -void -applyTransactions( +void applyTransactions ( SHAMap const* set, Ledger::ref applyLedger, Ledger::ref checkLedger, CanonicalTXSet& retriableTransactions, - bool openLgr); + bool openLgr, + bool enableTesting = false); } // ripple diff --git a/src/ripple/app/ledger/impl/LedgerConsensusImp.cpp b/src/ripple/app/ledger/impl/LedgerConsensusImp.cpp index 76aa1694d..f9fb55245 100644 --- a/src/ripple/app/ledger/impl/LedgerConsensusImp.cpp +++ b/src/ripple/app/ledger/impl/LedgerConsensusImp.cpp @@ -1724,11 +1724,15 @@ int applyTransaction ( TransactionEngine& engine, std::shared_ptr const& txn, bool openLedger, - bool retryAssured) + bool retryAssured, + bool enableTesting) { // Returns false if the transaction has need not be retried. ViewFlags parms = openLedger ? tapOPEN_LEDGER : tapNONE; + if (enableTesting) + parms = parms | tapENABLE_TESTING; + if (retryAssured) { parms = static_cast (parms | tapRETRY); @@ -1782,7 +1786,8 @@ void applyTransactions ( Ledger::ref applyLedger, Ledger::ref checkLedger, CanonicalTXSet& retriableTransactions, - bool openLgr) + bool openLgr, + bool enableTesting) { TransactionEngine engine (applyLedger); @@ -1802,7 +1807,7 @@ void applyTransactions ( SerialIter sit (item->slice()); auto txn = std::make_shared(sit); - if (applyTransaction (engine, txn, openLgr, true) == LedgerConsensusImp::resultRetry) + if (applyTransaction (engine, txn, openLgr, true, enableTesting) == LedgerConsensusImp::resultRetry) { // On failure, stash the failed transaction for // later retry. @@ -1832,7 +1837,7 @@ void applyTransactions ( try { switch (applyTransaction (engine, it->second, - openLgr, certainRetry)) + openLgr, certainRetry, enableTesting)) { case LedgerConsensusImp::resultSuccess: it = retriableTransactions.erase (it); diff --git a/src/ripple/app/ledger/impl/LedgerConsensusImp.h b/src/ripple/app/ledger/impl/LedgerConsensusImp.h index b702664a4..91720a4d9 100644 --- a/src/ripple/app/ledger/impl/LedgerConsensusImp.h +++ b/src/ripple/app/ledger/impl/LedgerConsensusImp.h @@ -340,6 +340,7 @@ private: }; //------------------------------------------------------------------------------ + std::shared_ptr make_LedgerConsensus (ConsensusImp& consensus, int previousProposers, int previousConvergeTime, InboundTransactions& inboundTransactions,