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:
@@ -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