diff --git a/src/ripple/app/tx/apply.h b/src/ripple/app/tx/apply.h index 13d9ed9ce..607ba0eab 100644 --- a/src/ripple/app/tx/apply.h +++ b/src/ripple/app/tx/apply.h @@ -40,20 +40,6 @@ enum class Validity Valid // Signature and local checks are good / passed. }; -/** Checks transaction signature and local checks. Returns - a Validity enum representing how valid the STTx is - and, if not Valid, a reason string. - Results are cached internally, so tests will not be - repeated over repeated calls, unless cache expires. - - @return std::pair, where `.first` is the status, and - `.second` is the reason if appropriate. -*/ -std::pair -checkValidity(HashRouter& router, - STTx const& tx, - bool allowMultiSign); - /** Checks transaction signature and local checks. Returns a Validity enum representing how valid the STTx is and, if not Valid, a reason string. @@ -66,8 +52,7 @@ checkValidity(HashRouter& router, std::pair checkValidity(HashRouter& router, STTx const& tx, Rules const& rules, - Config const& config, - ApplyFlags const& flags = tapNONE); + Config const& config); /** Sets the validity of a given transaction in the cache. diff --git a/src/ripple/app/tx/impl/Transactor.cpp b/src/ripple/app/tx/impl/Transactor.cpp index 50b41c755..19d8e14c3 100644 --- a/src/ripple/app/tx/impl/Transactor.cpp +++ b/src/ripple/app/tx/impl/Transactor.cpp @@ -90,8 +90,7 @@ preflight2 (PreflightContext const& ctx) { if(!( ctx.flags & tapNO_CHECK_SIGN) && checkValidity(ctx.app.getHashRouter(), - ctx.tx, ctx.rules, ctx.app.config(), - ctx.flags).first == Validity::SigBad) + ctx.tx, ctx.rules, ctx.app.config()).first == Validity::SigBad) { JLOG(ctx.j.debug) << "preflight2: bad signature"; return temINVALID; diff --git a/src/ripple/app/tx/impl/apply.cpp b/src/ripple/app/tx/impl/apply.cpp index 50f2a3f54..4aa967196 100644 --- a/src/ripple/app/tx/impl/apply.cpp +++ b/src/ripple/app/tx/impl/apply.cpp @@ -34,8 +34,14 @@ namespace ripple { //------------------------------------------------------------------------------ std::pair -checkValidity(HashRouter& router, STTx const& tx, bool allowMultiSign) +checkValidity(HashRouter& router, + STTx const& tx, Rules const& rules, + Config const& config) { + auto const allowMultiSign = + rules.enabled(featureMultiSign, + config.features); + auto const id = tx.getTransactionID(); auto const flags = router.getFlags(id); if (flags & SF_SIGBAD) @@ -76,19 +82,6 @@ checkValidity(HashRouter& router, STTx const& tx, bool allowMultiSign) return std::make_pair(Validity::Valid, ""); } -std::pair -checkValidity(HashRouter& router, - STTx const& tx, Rules const& rules, - Config const& config, - ApplyFlags const& flags) -{ - auto const allowMultiSign = - rules.enabled(featureMultiSign, - config.features); - - return checkValidity(router, tx, allowMultiSign); -} - void forceValidity(HashRouter& router, uint256 const& txid, Validity validity) diff --git a/src/ripple/ledger/ApplyView.h b/src/ripple/ledger/ApplyView.h index 80147c581..a22479853 100644 --- a/src/ripple/ledger/ApplyView.h +++ b/src/ripple/ledger/ApplyView.h @@ -32,12 +32,6 @@ enum ApplyFlags // Signature already checked tapNO_CHECK_SIGN = 0x01, - // Enable supressed features for testing. - // This lets unit tests exercise code that - // is not turned on for production. - // - tapENABLE_TESTING = 0x02, - // We expect the transaction to have a later // sequence number than the account in the ledger tapPOST_SEQ = 0x04, @@ -47,7 +41,7 @@ enum ApplyFlags tapRETRY = 0x20, // Transaction came from a privileged source - tapUNLIMITED = 0x400, + tapUNLIMITED = 0x400, }; inline diff --git a/src/ripple/rpc/impl/TransactionSign.cpp b/src/ripple/rpc/impl/TransactionSign.cpp index 7c3765c2f..7f79bf30d 100644 --- a/src/ripple/rpc/impl/TransactionSign.cpp +++ b/src/ripple/rpc/impl/TransactionSign.cpp @@ -144,7 +144,7 @@ static Json::Value checkPayment( AccountID const& srcAddressID, Role const role, Application& app, - std::shared_ptr& ledger, + std::shared_ptr const& ledger, bool doPath) { // Only path find for Payments. @@ -339,7 +339,7 @@ transactionPreProcessImpl ( SigningForParams& signingArgs, std::chrono::seconds validatedLedgerAge, Application& app, - std::shared_ptr ledger) + std::shared_ptr const& ledger) { auto j = app.journal ("RPCHandler"); @@ -515,7 +515,7 @@ transactionPreProcessImpl ( static std::pair transactionConstructImpl (std::shared_ptr const& stpTrans, - Rules const& rules, Application& app, ApplyFlags flags) + Rules const& rules, Application& app) { std::pair ret; @@ -547,7 +547,7 @@ transactionConstructImpl (std::shared_ptr const& stpTrans, // Check the signature if that's called for. auto sttxNew = std::make_shared (sit); if (checkValidity(app.getHashRouter(), - *sttxNew, rules, app.config(), flags).first != Validity::Valid) + *sttxNew, rules, app.config()).first != Validity::Valid) { ret.first = RPC::make_error (rpcINTERNAL, "Invalid signature."); @@ -624,7 +624,7 @@ Json::Value checkFee ( bool doAutoFill, Config const& config, LoadFeeTrack const& feeTrack, - std::shared_ptr& ledger) + std::shared_ptr const& ledger) { Json::Value& tx (request[jss::tx_json]); if (tx.isMember (jss::Fee)) @@ -696,8 +696,7 @@ Json::Value transactionSign ( Role role, std::chrono::seconds validatedLedgerAge, Application& app, - std::shared_ptr ledger, - ApplyFlags flags) + std::shared_ptr const& ledger) { using namespace detail; @@ -716,7 +715,7 @@ Json::Value transactionSign ( // Make sure the STTx makes a legitimate Transaction. std::pair txn = transactionConstructImpl ( - preprocResult.second, ledger->rules(), app, flags); + preprocResult.second, ledger->rules(), app); if (!txn.second) return txn.first; @@ -731,9 +730,8 @@ Json::Value transactionSubmit ( Role role, std::chrono::seconds validatedLedgerAge, Application& app, - std::shared_ptr ledger, - ProcessTransactionFn const& processTransaction, - ApplyFlags flags) + std::shared_ptr const& ledger, + ProcessTransactionFn const& processTransaction) { using namespace detail; @@ -752,7 +750,7 @@ Json::Value transactionSubmit ( // Make sure the STTx makes a legitimate Transaction. std::pair txn = transactionConstructImpl ( - preprocResult.second, ledger->rules(), app, flags); + preprocResult.second, ledger->rules(), app); if (!txn.second) return txn.first; @@ -857,8 +855,7 @@ Json::Value transactionSignFor ( Role role, std::chrono::seconds validatedLedgerAge, Application& app, - std::shared_ptr ledger, - ApplyFlags flags) + std::shared_ptr const& ledger) { auto j = app.journal ("RPCHandler"); JLOG (j.debug) << "transactionSignFor: " << jvRequest; @@ -953,8 +950,7 @@ Json::Value transactionSignFor ( // Make sure the STTx makes a legitimate Transaction. std::pair txn = - transactionConstructImpl ( - sttx, ledger->rules(), app, flags); + transactionConstructImpl (sttx, ledger->rules(), app); if (!txn.second) return txn.first; @@ -969,9 +965,8 @@ Json::Value transactionSubmitMultiSigned ( Role role, std::chrono::seconds validatedLedgerAge, Application& app, - std::shared_ptr ledger, - ProcessTransactionFn const& processTransaction, - ApplyFlags flags) + std::shared_ptr const& ledger, + ProcessTransactionFn const& processTransaction) { auto j = app.journal ("RPCHandler"); JLOG (j.debug) @@ -1125,7 +1120,7 @@ Json::Value transactionSubmitMultiSigned ( // Make sure the SerializedTransaction makes a legitimate Transaction. std::pair txn = - transactionConstructImpl (stpTrans, ledger->rules(), app, flags); + transactionConstructImpl (stpTrans, ledger->rules(), app); if (!txn.second) return txn.first; diff --git a/src/ripple/rpc/impl/TransactionSign.h b/src/ripple/rpc/impl/TransactionSign.h index 12806781d..484bdb325 100644 --- a/src/ripple/rpc/impl/TransactionSign.h +++ b/src/ripple/rpc/impl/TransactionSign.h @@ -66,7 +66,7 @@ Json::Value checkFee ( bool doAutoFill, Config const& config, LoadFeeTrack const& feeTrack, - std::shared_ptr& ledger); + std::shared_ptr const& ledger); // Return a std::function<> that calls NetworkOPs::processTransaction. using ProcessTransactionFn = @@ -89,8 +89,7 @@ Json::Value transactionSign ( Role role, std::chrono::seconds validatedLedgerAge, Application& app, - std::shared_ptr ledger, - ApplyFlags flags = tapNONE); + std::shared_ptr const& ledger); /** Returns a Json::objectValue. */ Json::Value transactionSubmit ( @@ -99,9 +98,8 @@ Json::Value transactionSubmit ( Role role, std::chrono::seconds validatedLedgerAge, Application& app, - std::shared_ptr ledger, - ProcessTransactionFn const& processTransaction, - ApplyFlags flags = tapNONE); + std::shared_ptr const& ledger, + ProcessTransactionFn const& processTransaction); /** Returns a Json::objectValue. */ Json::Value transactionSignFor ( @@ -110,8 +108,7 @@ Json::Value transactionSignFor ( Role role, std::chrono::seconds validatedLedgerAge, Application& app, - std::shared_ptr ledger, - ApplyFlags flags = tapNONE); + std::shared_ptr const& ledger); /** Returns a Json::objectValue. */ Json::Value transactionSubmitMultiSigned ( @@ -120,9 +117,8 @@ Json::Value transactionSubmitMultiSigned ( Role role, std::chrono::seconds validatedLedgerAge, Application& app, - std::shared_ptr ledger, - ProcessTransactionFn const& processTransaction, - ApplyFlags flags = tapNONE); + std::shared_ptr const& ledger, + ProcessTransactionFn const& processTransaction); } // RPC } // ripple diff --git a/src/ripple/rpc/tests/JSONRPC.test.cpp b/src/ripple/rpc/tests/JSONRPC.test.cpp index f81b6519b..1965c957e 100644 --- a/src/ripple/rpc/tests/JSONRPC.test.cpp +++ b/src/ripple/rpc/tests/JSONRPC.test.cpp @@ -1826,8 +1826,7 @@ public: Role role, std::chrono::seconds validatedLedgerAge, Application& app, - std::shared_ptr ledger, - ApplyFlags flags); + std::shared_ptr const& ledger); using submitFunc = Json::Value (*) ( Json::Value params, @@ -1835,9 +1834,8 @@ public: Role role, std::chrono::seconds validatedLedgerAge, Application& app, - std::shared_ptr ledger, - ProcessTransactionFn const& processTransaction, - ApplyFlags flags); + std::shared_ptr const& ledger, + ProcessTransactionFn const& processTransaction); using TestStuff = std::tuple ; @@ -1877,8 +1875,7 @@ public: testRole, 1s, env.app(), - ledger, - tapENABLE_TESTING); + ledger); } else { @@ -1891,8 +1888,7 @@ public: 1s, env.app(), ledger, - processTxn, - tapENABLE_TESTING); + processTxn); } std::string errStr; diff --git a/src/ripple/test/jtx/impl/Env.cpp b/src/ripple/test/jtx/impl/Env.cpp index 819efdb56..4af3f3f50 100644 --- a/src/ripple/test/jtx/impl/Env.cpp +++ b/src/ripple/test/jtx/impl/Env.cpp @@ -402,8 +402,6 @@ ApplyFlags Env::applyFlags() const { ApplyFlags flags = tapNONE; - if (testing_) - flags = flags | tapENABLE_TESTING; if (nosig_) flags = flags | tapNO_CHECK_SIGN; return flags;