mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +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:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/app/misc/NetworkOPs.h>
|
||||
#include <ripple/core/JobQueue.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <test/jtx.h>
|
||||
@@ -91,6 +92,7 @@ struct Transaction_ordering_test : public beast::unit_test::suite
|
||||
env(tx2, ter(terPRE_SEQ));
|
||||
BEAST_EXPECT(env.seq(alice) == aliceSequence);
|
||||
env(tx1);
|
||||
BEAST_EXPECT(env.app().getOPs().transactionBatch(false));
|
||||
env.app().getJobQueue().rendezvous();
|
||||
BEAST_EXPECT(env.seq(alice) == aliceSequence + 2);
|
||||
|
||||
@@ -143,6 +145,8 @@ struct Transaction_ordering_test : public beast::unit_test::suite
|
||||
}
|
||||
|
||||
env(tx[0]);
|
||||
// Apply until no more deferred/held transactions.
|
||||
BEAST_EXPECT(env.app().getOPs().transactionBatch(true));
|
||||
env.app().getJobQueue().rendezvous();
|
||||
BEAST_EXPECT(env.seq(alice) == aliceSequence + 5);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user