Revert "Apply transaction batches in periodic intervals (#4504)"

This reverts commit b580049ec0.
This commit is contained in:
Elliot Lee
2023-08-30 15:46:12 -07:00
parent 7ca1c644d1
commit d943c58b3d
24 changed files with 167 additions and 402 deletions

View File

@@ -21,7 +21,6 @@
#include <ripple/app/misc/HashRouter.h>
#include <ripple/app/misc/Transaction.h>
#include <ripple/app/tx/apply.h>
#include <ripple/basics/SubmitSync.h>
#include <ripple/net/RPCErr.h>
#include <ripple/protocol/ErrorCodes.h>
#include <ripple/resource/Fees.h>
@@ -49,10 +48,6 @@ doSubmit(RPC::JsonContext& context)
{
context.loadType = Resource::feeMediumBurdenRPC;
auto const sync = RPC::getSubmitSyncMode(context.params);
if (!sync)
return sync.error();
if (!context.params.isMember(jss::tx_blob))
{
auto const failType = getFailHard(context);
@@ -67,8 +62,7 @@ doSubmit(RPC::JsonContext& context)
context.role,
context.ledgerMaster.getValidatedLedgerAge(),
context.app,
RPC::getProcessTxnFn(context.netOps),
*sync);
RPC::getProcessTxnFn(context.netOps));
ret[jss::deprecated] =
"Signing support in the 'submit' command has been "
@@ -137,7 +131,7 @@ doSubmit(RPC::JsonContext& context)
auto const failType = getFailHard(context);
context.netOps.processTransaction(
tpTrans, isUnlimited(context.role), *sync, true, failType);
tpTrans, isUnlimited(context.role), true, failType);
}
catch (std::exception& e)
{

View File

@@ -18,12 +18,10 @@
//==============================================================================
#include <ripple/app/ledger/LedgerMaster.h>
#include <ripple/basics/SubmitSync.h>
#include <ripple/protocol/ErrorCodes.h>
#include <ripple/protocol/Feature.h>
#include <ripple/resource/Fees.h>
#include <ripple/rpc/Context.h>
#include <ripple/rpc/impl/RPCHelpers.h>
#include <ripple/rpc/impl/TransactionSign.h>
namespace ripple {
@@ -39,18 +37,13 @@ doSubmitMultiSigned(RPC::JsonContext& context)
auto const failHard = context.params[jss::fail_hard].asBool();
auto const failType = NetworkOPs::doFailHard(failHard);
auto const sync = RPC::getSubmitSyncMode(context.params);
if (!sync)
return sync.error();
return RPC::transactionSubmitMultiSigned(
context.params,
failType,
context.role,
context.ledgerMaster.getValidatedLedgerAge(),
context.app,
RPC::getProcessTxnFn(context.netOps),
*sync);
RPC::getProcessTxnFn(context.netOps));
}
} // namespace ripple

View File

@@ -1166,26 +1166,5 @@ getLedgerByContext(RPC::JsonContext& context)
return RPC::make_error(
rpcNOT_READY, "findCreate failed to return an inbound ledger");
}
ripple::Expected<RPC::SubmitSync, Json::Value>
getSubmitSyncMode(Json::Value const& params)
{
using enum RPC::SubmitSync;
if (params.isMember(jss::sync_mode))
{
std::string const syncMode = params[jss::sync_mode].asString();
if (syncMode == "async")
return async;
else if (syncMode == "wait")
return wait;
else if (syncMode != "sync")
return Unexpected(RPC::make_error(
rpcINVALID_PARAMS,
"sync_mode parameter must be one of \"sync\", \"async\", or "
"\"wait\"."));
}
return sync;
}
} // namespace RPC
} // namespace ripple

View File

@@ -26,8 +26,6 @@
#include <ripple/app/misc/NetworkOPs.h>
#include <ripple/app/misc/TxQ.h>
#include <ripple/basics/Expected.h>
#include <ripple/basics/SubmitSync.h>
#include <ripple/protocol/SecretKey.h>
#include <ripple/rpc/Context.h>
#include <ripple/rpc/Status.h>
@@ -295,14 +293,6 @@ getAPIVersionNumber(const Json::Value& value, bool betaEnabled);
std::variant<std::shared_ptr<Ledger const>, Json::Value>
getLedgerByContext(RPC::JsonContext& context);
/** Helper to parse submit_mode parameter to RPC submit.
*
* @param params RPC parameters
* @return Either the mode or an error object.
*/
ripple::Expected<RPC::SubmitSync, Json::Value>
getSubmitSyncMode(Json::Value const& params);
} // namespace RPC
} // namespace ripple

View File

@@ -802,8 +802,7 @@ transactionSubmit(
Role role,
std::chrono::seconds validatedLedgerAge,
Application& app,
ProcessTransactionFn const& processTransaction,
RPC::SubmitSync sync)
ProcessTransactionFn const& processTransaction)
{
using namespace detail;
@@ -829,7 +828,8 @@ transactionSubmit(
// Finally, submit the transaction.
try
{
processTransaction(txn.second, isUnlimited(role), sync, failType);
// FIXME: For performance, should use asynch interface
processTransaction(txn.second, isUnlimited(role), true, failType);
}
catch (std::exception&)
{
@@ -1038,8 +1038,7 @@ transactionSubmitMultiSigned(
Role role,
std::chrono::seconds validatedLedgerAge,
Application& app,
ProcessTransactionFn const& processTransaction,
RPC::SubmitSync sync)
ProcessTransactionFn const& processTransaction)
{
auto const& ledger = app.openLedger().current();
auto j = app.journal("RPCHandler");
@@ -1212,7 +1211,7 @@ transactionSubmitMultiSigned(
try
{
// FIXME: For performance, should use asynch interface
processTransaction(txn.second, isUnlimited(role), sync, failType);
processTransaction(txn.second, isUnlimited(role), true, failType);
}
catch (std::exception&)
{

View File

@@ -21,7 +21,6 @@
#define RIPPLE_RPC_TRANSACTIONSIGN_H_INCLUDED
#include <ripple/app/misc/NetworkOPs.h>
#include <ripple/basics/SubmitSync.h>
#include <ripple/ledger/ApplyView.h>
#include <ripple/rpc/Role.h>
@@ -76,7 +75,7 @@ checkFee(
using ProcessTransactionFn = std::function<void(
std::shared_ptr<Transaction>& transaction,
bool bUnlimited,
RPC::SubmitSync sync,
bool bLocal,
NetworkOPs::FailHard failType)>;
inline ProcessTransactionFn
@@ -85,10 +84,9 @@ getProcessTxnFn(NetworkOPs& netOPs)
return [&netOPs](
std::shared_ptr<Transaction>& transaction,
bool bUnlimited,
RPC::SubmitSync sync,
bool bLocal,
NetworkOPs::FailHard failType) {
netOPs.processTransaction(
transaction, bUnlimited, sync, true, failType);
netOPs.processTransaction(transaction, bUnlimited, bLocal, failType);
};
}
@@ -109,8 +107,7 @@ transactionSubmit(
Role role,
std::chrono::seconds validatedLedgerAge,
Application& app,
ProcessTransactionFn const& processTransaction,
RPC::SubmitSync sync);
ProcessTransactionFn const& processTransaction);
/** Returns a Json::objectValue. */
Json::Value
@@ -129,8 +126,7 @@ transactionSubmitMultiSigned(
Role role,
std::chrono::seconds validatedLedgerAge,
Application& app,
ProcessTransactionFn const& processTransaction,
RPC::SubmitSync sync);
ProcessTransactionFn const& processTransaction);
} // namespace RPC
} // namespace ripple