mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Revert "Apply transaction batches in periodic intervals (#4504)"
This reverts commit b580049ec0.
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/app/misc/NetworkOPs.h>
|
||||
#include <ripple/core/JobQueue.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <test/jtx.h>
|
||||
@@ -92,7 +91,6 @@ 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);
|
||||
|
||||
@@ -145,8 +143,6 @@ 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);
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <optional>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
|
||||
namespace ripple {
|
||||
@@ -901,95 +900,6 @@ public:
|
||||
pass();
|
||||
}
|
||||
|
||||
void
|
||||
testSyncSubmit()
|
||||
{
|
||||
using namespace jtx;
|
||||
Env env(*this);
|
||||
|
||||
auto const alice = Account{"alice"};
|
||||
auto const n = XRP(10000);
|
||||
env.fund(n, alice);
|
||||
BEAST_EXPECT(env.balance(alice) == n);
|
||||
|
||||
// submit only
|
||||
auto applyBlobTxn = [&env](char const* syncMode, auto&&... txnArgs) {
|
||||
auto jt = env.jt(txnArgs...);
|
||||
Serializer s;
|
||||
jt.stx->add(s);
|
||||
|
||||
Json::Value args{Json::objectValue};
|
||||
|
||||
args[jss::tx_blob] = strHex(s.slice());
|
||||
args[jss::fail_hard] = true;
|
||||
args[jss::sync_mode] = syncMode;
|
||||
|
||||
return env.rpc("json", "submit", args.toStyledString());
|
||||
};
|
||||
|
||||
auto jr = applyBlobTxn("sync", noop(alice));
|
||||
BEAST_EXPECT(jr[jss::result][jss::engine_result] == "tesSUCCESS");
|
||||
|
||||
jr = applyBlobTxn("async", noop(alice));
|
||||
BEAST_EXPECT(jr[jss::result][jss::engine_result] == "terSUBMITTED");
|
||||
// Make sure it gets processed before submitting and waiting.
|
||||
env.app().getOPs().transactionBatch(true);
|
||||
|
||||
auto applier = [&env]() {
|
||||
while (!env.app().getOPs().transactionBatch(false))
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
};
|
||||
auto t = std::thread(applier);
|
||||
|
||||
jr = applyBlobTxn("wait", noop(alice));
|
||||
BEAST_EXPECT(jr[jss::result][jss::engine_result] == "tesSUCCESS");
|
||||
t.join();
|
||||
|
||||
jr = applyBlobTxn("scott", noop(alice));
|
||||
BEAST_EXPECT(jr[jss::result][jss::error] == "invalidParams");
|
||||
|
||||
// sign and submit
|
||||
auto applyJsonTxn = [&env](
|
||||
char const* syncMode,
|
||||
std::string const secret,
|
||||
Json::Value const& val) {
|
||||
Json::Value args{Json::objectValue};
|
||||
args[jss::secret] = secret;
|
||||
args[jss::tx_json] = val;
|
||||
args[jss::fail_hard] = true;
|
||||
args[jss::sync_mode] = syncMode;
|
||||
|
||||
return env.rpc("json", "submit", args.toStyledString());
|
||||
};
|
||||
|
||||
Json::Value payment;
|
||||
auto secret = toBase58(generateSeed("alice"));
|
||||
payment = noop("alice");
|
||||
payment[sfSequence.fieldName] = env.seq("alice");
|
||||
payment[sfSetFlag.fieldName] = 0;
|
||||
jr = applyJsonTxn("sync", secret, payment);
|
||||
BEAST_EXPECT(jr[jss::result][jss::engine_result] == "tesSUCCESS");
|
||||
|
||||
payment[sfSequence.fieldName] = env.seq("alice");
|
||||
jr = applyJsonTxn("async", secret, payment);
|
||||
BEAST_EXPECT(jr[jss::result][jss::engine_result] == "terSUBMITTED");
|
||||
|
||||
env.app().getOPs().transactionBatch(true);
|
||||
payment[sfSequence.fieldName] = env.seq("alice");
|
||||
|
||||
auto aSeq = env.seq("alice");
|
||||
t = std::thread(applier);
|
||||
jr = applyJsonTxn("wait", secret, payment);
|
||||
BEAST_EXPECT(jr[jss::result][jss::engine_result] == "tesSUCCESS");
|
||||
t.join();
|
||||
// Ensure the last transaction was processed.
|
||||
BEAST_EXPECT(env.seq("alice") == aSeq + 1);
|
||||
|
||||
payment[sfSequence.fieldName] = env.seq("alice");
|
||||
jr = applyJsonTxn("scott", secret, payment);
|
||||
BEAST_EXPECT(jr[jss::result][jss::error] == "invalidParams");
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
@@ -1015,7 +925,6 @@ public:
|
||||
testSignAndSubmit();
|
||||
testFeatures();
|
||||
testExceptionalShutdown();
|
||||
testSyncSubmit();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#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>
|
||||
@@ -2385,7 +2384,7 @@ public:
|
||||
fakeProcessTransaction(
|
||||
std::shared_ptr<Transaction>&,
|
||||
bool,
|
||||
SubmitSync,
|
||||
bool,
|
||||
NetworkOPs::FailHard)
|
||||
{
|
||||
;
|
||||
@@ -2433,8 +2432,7 @@ public:
|
||||
Role role,
|
||||
std::chrono::seconds validatedLedgerAge,
|
||||
Application & app,
|
||||
ProcessTransactionFn const& processTransaction,
|
||||
RPC::SubmitSync sync);
|
||||
ProcessTransactionFn const& processTransaction);
|
||||
|
||||
using TestStuff =
|
||||
std::tuple<signFunc, submitFunc, char const*, unsigned int>;
|
||||
@@ -2487,8 +2485,7 @@ public:
|
||||
testRole,
|
||||
1s,
|
||||
env.app(),
|
||||
processTxn,
|
||||
RPC::SubmitSync::sync);
|
||||
processTxn);
|
||||
}
|
||||
|
||||
std::string errStr;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/app/misc/NetworkOPs.h>
|
||||
#include <ripple/beast/unit_test.h>
|
||||
#include <ripple/core/JobQueue.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
@@ -89,8 +88,7 @@ public:
|
||||
}
|
||||
BEAST_EXPECT(jv[jss::result][jss::engine_result] == "tefPAST_SEQ");
|
||||
|
||||
// Submit future sequence transaction -- this transaction should be
|
||||
// held until the sequence gap is closed.
|
||||
// Submit future sequence transaction
|
||||
payment[jss::tx_json][sfSequence.fieldName] = env.seq("alice") + 1;
|
||||
jv = wsc->invoke("submit", payment);
|
||||
if (wsc->version() == 2)
|
||||
@@ -116,8 +114,6 @@ 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