mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-04 19:25:51 +00:00
Remove tapENABLE_TESTING.
This commit is contained in:
committed by
Edward Hennis
parent
749b4adc7c
commit
0fca91c6c1
@@ -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<Validity, std::string>
|
||||
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<Validity, std::string>
|
||||
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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -34,8 +34,14 @@ namespace ripple {
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
std::pair<Validity, std::string>
|
||||
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<Validity, std::string>
|
||||
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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -144,7 +144,7 @@ static Json::Value checkPayment(
|
||||
AccountID const& srcAddressID,
|
||||
Role const role,
|
||||
Application& app,
|
||||
std::shared_ptr<ReadView const>& ledger,
|
||||
std::shared_ptr<ReadView const> 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<ReadView const> ledger)
|
||||
std::shared_ptr<ReadView const> const& ledger)
|
||||
{
|
||||
auto j = app.journal ("RPCHandler");
|
||||
|
||||
@@ -515,7 +515,7 @@ transactionPreProcessImpl (
|
||||
static
|
||||
std::pair <Json::Value, Transaction::pointer>
|
||||
transactionConstructImpl (std::shared_ptr<STTx const> const& stpTrans,
|
||||
Rules const& rules, Application& app, ApplyFlags flags)
|
||||
Rules const& rules, Application& app)
|
||||
{
|
||||
std::pair <Json::Value, Transaction::pointer> ret;
|
||||
|
||||
@@ -547,7 +547,7 @@ transactionConstructImpl (std::shared_ptr<STTx const> const& stpTrans,
|
||||
// Check the signature if that's called for.
|
||||
auto sttxNew = std::make_shared<STTx const> (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<ReadView const>& ledger)
|
||||
std::shared_ptr<ReadView const> 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<ReadView const> ledger,
|
||||
ApplyFlags flags)
|
||||
std::shared_ptr<ReadView const> const& ledger)
|
||||
{
|
||||
using namespace detail;
|
||||
|
||||
@@ -716,7 +715,7 @@ Json::Value transactionSign (
|
||||
// Make sure the STTx makes a legitimate Transaction.
|
||||
std::pair <Json::Value, Transaction::pointer> 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<ReadView const> ledger,
|
||||
ProcessTransactionFn const& processTransaction,
|
||||
ApplyFlags flags)
|
||||
std::shared_ptr<ReadView const> 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 <Json::Value, Transaction::pointer> 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<ReadView const> ledger,
|
||||
ApplyFlags flags)
|
||||
std::shared_ptr<ReadView const> 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 <Json::Value, Transaction::pointer> 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<ReadView const> ledger,
|
||||
ProcessTransactionFn const& processTransaction,
|
||||
ApplyFlags flags)
|
||||
std::shared_ptr<ReadView const> 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 <Json::Value, Transaction::pointer> txn =
|
||||
transactionConstructImpl (stpTrans, ledger->rules(), app, flags);
|
||||
transactionConstructImpl (stpTrans, ledger->rules(), app);
|
||||
|
||||
if (!txn.second)
|
||||
return txn.first;
|
||||
|
||||
@@ -66,7 +66,7 @@ Json::Value checkFee (
|
||||
bool doAutoFill,
|
||||
Config const& config,
|
||||
LoadFeeTrack const& feeTrack,
|
||||
std::shared_ptr<ReadView const>& ledger);
|
||||
std::shared_ptr<ReadView const> 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<ReadView const> ledger,
|
||||
ApplyFlags flags = tapNONE);
|
||||
std::shared_ptr<ReadView const> 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<ReadView const> ledger,
|
||||
ProcessTransactionFn const& processTransaction,
|
||||
ApplyFlags flags = tapNONE);
|
||||
std::shared_ptr<ReadView const> 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<ReadView const> ledger,
|
||||
ApplyFlags flags = tapNONE);
|
||||
std::shared_ptr<ReadView const> 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<ReadView const> ledger,
|
||||
ProcessTransactionFn const& processTransaction,
|
||||
ApplyFlags flags = tapNONE);
|
||||
std::shared_ptr<ReadView const> const& ledger,
|
||||
ProcessTransactionFn const& processTransaction);
|
||||
|
||||
} // RPC
|
||||
} // ripple
|
||||
|
||||
@@ -1826,8 +1826,7 @@ public:
|
||||
Role role,
|
||||
std::chrono::seconds validatedLedgerAge,
|
||||
Application& app,
|
||||
std::shared_ptr<ReadView const> ledger,
|
||||
ApplyFlags flags);
|
||||
std::shared_ptr<ReadView const> 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<ReadView const> ledger,
|
||||
ProcessTransactionFn const& processTransaction,
|
||||
ApplyFlags flags);
|
||||
std::shared_ptr<ReadView const> const& ledger,
|
||||
ProcessTransactionFn const& processTransaction);
|
||||
|
||||
using TestStuff =
|
||||
std::tuple <signFunc, submitFunc, char const*, unsigned int>;
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user