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:
Mark Travis
2023-09-11 15:47:40 -07:00
committed by GitHub
parent 1d9db1bfdd
commit 002893f280
24 changed files with 398 additions and 163 deletions

View File

@@ -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);