diff --git a/src/cpp/ripple/LedgerEntrySet.cpp b/src/cpp/ripple/LedgerEntrySet.cpp index 5d07259086..4c3891637b 100644 --- a/src/cpp/ripple/LedgerEntrySet.cpp +++ b/src/cpp/ripple/LedgerEntrySet.cpp @@ -16,11 +16,13 @@ DECLARE_INSTANCE(LedgerEntrySet) #define DIR_NODE_MAX 32 -void LedgerEntrySet::init(Ledger::ref ledger, const uint256& transactionID, uint32 ledgerID) +void LedgerEntrySet::init(Ledger::ref ledger, const uint256& transactionID, + uint32 ledgerID, TransactionEngineParams params) { mEntries.clear(); mLedger = ledger; mSet.init(transactionID, ledgerID); + mParams = params; mSeq = 0; } diff --git a/src/cpp/ripple/LedgerEntrySet.h b/src/cpp/ripple/LedgerEntrySet.h index 682277592e..32b641e450 100644 --- a/src/cpp/ripple/LedgerEntrySet.h +++ b/src/cpp/ripple/LedgerEntrySet.h @@ -13,6 +13,20 @@ DEFINE_INSTANCE(LedgerEntrySetEntry); DEFINE_INSTANCE(LedgerEntrySet); +enum TransactionEngineParams +{ + tapNONE = 0x00, + + tapNO_CHECK_SIGN = 0x01, // Signature already checked + + tapOPEN_LEDGER = 0x10, // Transaction is running against an open ledger + // true = failures are not forwarded, check transaction fee + // false = debit ledger for consumed funds + + tapRETRY = 0x20, // This is not the transaction's last pass + // Transaction can be retried, soft failures allowed +}; + enum LedgerEntryAction { taaNONE, @@ -39,6 +53,7 @@ protected: Ledger::pointer mLedger; std::map mEntries; // cannot be unordered! TransactionMetaSet mSet; + TransactionEngineParams mParams; int mSeq; LedgerEntrySet(Ledger::ref ledger, const std::map &e, @@ -56,18 +71,19 @@ protected: public: - LedgerEntrySet(Ledger::ref ledger) : mLedger(ledger), mSeq(0) { ; } + LedgerEntrySet(Ledger::ref ledger, TransactionEngineParams tep) : mLedger(ledger), mParams(tep), mSeq(0) { ; } - LedgerEntrySet() : mSeq(0) { ; } + LedgerEntrySet() : mParams(tapNONE), mSeq(0) { ; } // set functions LedgerEntrySet duplicate() const; // Make a duplicate of this set void setTo(const LedgerEntrySet&); // Set this set to have the same contents as another void swapWith(LedgerEntrySet&); // Swap the contents of two sets - int getSeq() const { return mSeq; } - void bumpSeq() { ++mSeq; } - void init(Ledger::ref ledger, const uint256& transactionID, uint32 ledgerID); + int getSeq() const { return mSeq; } + TransactionEngineParams getParams() const { return mParams; } + void bumpSeq() { ++mSeq; } + void init(Ledger::ref ledger, const uint256& transactionID, uint32 ledgerID, TransactionEngineParams params); void clear(); Ledger::pointer& getLedger() { return mLedger; } diff --git a/src/cpp/ripple/NetworkOPs.cpp b/src/cpp/ripple/NetworkOPs.cpp index 55d65dc961..742e630f13 100644 --- a/src/cpp/ripple/NetworkOPs.cpp +++ b/src/cpp/ripple/NetworkOPs.cpp @@ -1780,7 +1780,7 @@ void NetworkOPs::getBookPage(Ledger::pointer lpLedger, const uint160& uTakerPays cLog(lsTRACE) << boost::str(boost::format("getBookPage: uBookEnd=%s") % uBookEnd); cLog(lsTRACE) << boost::str(boost::format("getBookPage: uTipIndex=%s") % uTipIndex); - LedgerEntrySet lesActive(lpLedger); + LedgerEntrySet lesActive(lpLedger, tapNONE); bool bDone = false; bool bDirectAdvance = true; diff --git a/src/cpp/ripple/Pathfinder.cpp b/src/cpp/ripple/Pathfinder.cpp index 5406076c24..be60e664ed 100644 --- a/src/cpp/ripple/Pathfinder.cpp +++ b/src/cpp/ripple/Pathfinder.cpp @@ -117,7 +117,7 @@ bool Pathfinder::bDefaultPath(const STPath& spPath) if (pspCurrent) { bool bDefault; - LedgerEntrySet lesActive(mLedger); + LedgerEntrySet lesActive(mLedger, tapNONE); // Expand the current path. pspCurrent->setExpanded(lesActive, spPath, mDstAccountID, mSrcAccountID); @@ -160,7 +160,7 @@ Pathfinder::Pathfinder(Ledger::ref ledger, // Build the default path. // Later, reject anything that expands to the default path as the default is sufficient. - LedgerEntrySet lesActive(mLedger); + LedgerEntrySet lesActive(mLedger, tapNONE); psDefault->setExpanded(lesActive, STPath(), mDstAccountID, mSrcAccountID); @@ -212,7 +212,7 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax return false; } - LedgerEntrySet lesActive(mLedger); + LedgerEntrySet lesActive(mLedger, tapNONE); boost::unordered_map aiMap; SLE::pointer sleSrc = lesActive.entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(mSrcAccountID)); diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 79f9f8dd54..280a0ccb38 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -1235,7 +1235,7 @@ Json::Value RPCHandler::doRipplePathFind(Json::Value jvRequest, int& cost) cost = rpcCOST_EXPENSIVE; Ledger::pointer lSnapShot = boost::make_shared(boost::ref(*lpLedger), false); - LedgerEntrySet lesSnapshot(lSnapShot); + LedgerEntrySet lesSnapshot(lSnapShot, tapNONE); ScopedUnlock su(theApp->getMasterLock()); // As long as we have a locked copy of the ledger, we can unlock. diff --git a/src/cpp/ripple/TransactionEngine.cpp b/src/cpp/ripple/TransactionEngine.cpp index ec26231f03..a14f9e346f 100644 --- a/src/cpp/ripple/TransactionEngine.cpp +++ b/src/cpp/ripple/TransactionEngine.cpp @@ -73,7 +73,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa cLog(lsTRACE) << "applyTransaction>"; didApply = false; assert(mLedger); - mNodes.init(mLedger, txn.getTransactionID(), mLedger->getLedgerSeq()); + mNodes.init(mLedger, txn.getTransactionID(), mLedger->getLedgerSeq(), params); #ifdef DEBUG if (1) diff --git a/src/cpp/ripple/TransactionEngine.h b/src/cpp/ripple/TransactionEngine.h index 4f421602d7..2ad074efb6 100644 --- a/src/cpp/ripple/TransactionEngine.h +++ b/src/cpp/ripple/TransactionEngine.h @@ -3,6 +3,9 @@ #include #include +#include +#include +#include #include "Ledger.h" #include "SerializedTransaction.h" @@ -11,29 +14,12 @@ #include "TransactionErr.h" #include "InstanceCounter.h" -#include -#include -#include DEFINE_INSTANCE(TransactionEngine); // A TransactionEngine applies serialized transactions to a ledger // It can also, verify signatures, verify fees, and give rejection reasons -enum TransactionEngineParams -{ - tapNONE = 0x00, - - tapNO_CHECK_SIGN = 0x01, // Signature already checked - - tapOPEN_LEDGER = 0x10, // Transaction is running against an open ledger - // true = failures are not forwarded, check transaction fee - // false = debit ledger for consumed funds - - tapRETRY = 0x20, // This is not the transaction's last pass - // Transaction can be retried, soft failures allowed -}; - // One instance per ledger. // Only one transaction applied at a time. class TransactionEngine : private IS_INSTANCE(TransactionEngine)