mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Apply transaction batches in periodic intervals (#4504)
Add new transaction submission API field, "sync", which determines behavior of the server while submitting transactions: 1) sync (default): Process transactions in a batch immediately, and return only once the transaction has been processed. 2) async: Put transaction into the batch for the next processing interval and return immediately. 3) wait: Put transaction into the batch for the next processing interval and return only after it is processed.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <ripple/app/misc/LoadFeeTrack.h>
|
||||
#include <ripple/app/misc/TxQ.h>
|
||||
#include <ripple/basics/SubmitSync.h>
|
||||
#include <ripple/basics/contract.h>
|
||||
#include <ripple/beast/unit_test.h>
|
||||
#include <ripple/core/ConfigSections.h>
|
||||
@@ -2384,7 +2385,7 @@ public:
|
||||
fakeProcessTransaction(
|
||||
std::shared_ptr<Transaction>&,
|
||||
bool,
|
||||
bool,
|
||||
SubmitSync,
|
||||
NetworkOPs::FailHard)
|
||||
{
|
||||
;
|
||||
@@ -2432,7 +2433,8 @@ public:
|
||||
Role role,
|
||||
std::chrono::seconds validatedLedgerAge,
|
||||
Application & app,
|
||||
ProcessTransactionFn const& processTransaction);
|
||||
ProcessTransactionFn const& processTransaction,
|
||||
RPC::SubmitSync sync);
|
||||
|
||||
using TestStuff =
|
||||
std::tuple<signFunc, submitFunc, char const*, unsigned int>;
|
||||
@@ -2485,7 +2487,8 @@ public:
|
||||
testRole,
|
||||
1s,
|
||||
env.app(),
|
||||
processTxn);
|
||||
processTxn,
|
||||
RPC::SubmitSync::sync);
|
||||
}
|
||||
|
||||
std::string errStr;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/app/misc/NetworkOPs.h>
|
||||
#include <ripple/beast/unit_test.h>
|
||||
#include <ripple/core/JobQueue.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
@@ -88,7 +89,8 @@ public:
|
||||
}
|
||||
BEAST_EXPECT(jv[jss::result][jss::engine_result] == "tefPAST_SEQ");
|
||||
|
||||
// Submit future sequence transaction
|
||||
// Submit future sequence transaction -- this transaction should be
|
||||
// held until the sequence gap is closed.
|
||||
payment[jss::tx_json][sfSequence.fieldName] = env.seq("alice") + 1;
|
||||
jv = wsc->invoke("submit", payment);
|
||||
if (wsc->version() == 2)
|
||||
@@ -114,6 +116,8 @@ public:
|
||||
}
|
||||
BEAST_EXPECT(jv[jss::result][jss::engine_result] == "tesSUCCESS");
|
||||
|
||||
// Apply held transactions.
|
||||
env.app().getOPs().transactionBatch(true);
|
||||
// Wait for the jobqueue to process everything
|
||||
env.app().getJobQueue().rendezvous();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user