18 #include <ripple/app/misc/NetworkOPs.h>
19 #include <ripple/core/JobQueue.h>
20 #include <ripple/protocol/ErrorCodes.h>
32 testcase(
"Correct Order");
35 auto const alice =
Account(
"alice");
38 auto const aliceSequence = env.
seq(alice);
40 auto const tx1 = env.
jt(
noop(alice),
seq(aliceSequence));
41 auto const tx2 = env.
jt(
43 seq(aliceSequence + 1),
44 json(R
"({"LastLedgerSequence":7})"));
48 BEAST_EXPECT(env.seq(alice) == aliceSequence + 1);
51 BEAST_EXPECT(env.seq(alice) == aliceSequence + 2);
59 result[
"result"][
"meta"][
"TransactionResult"] ==
"tesSUCCESS");
65 result[
"result"][
"meta"][
"TransactionResult"] ==
"tesSUCCESS");
74 testcase(
"Incorrect order");
77 cfg->FORCE_MULTI_THREAD =
false;
81 auto const alice =
Account(
"alice");
84 auto const aliceSequence = env.
seq(alice);
86 auto const tx1 = env.
jt(
noop(alice),
seq(aliceSequence));
87 auto const tx2 = env.
jt(
89 seq(aliceSequence + 1),
90 json(R
"({"LastLedgerSequence":7})"));
93 BEAST_EXPECT(env.seq(alice) == aliceSequence);
97 BEAST_EXPECT(env.
seq(alice) == aliceSequence + 2);
105 result[
"result"][
"meta"][
"TransactionResult"] ==
"tesSUCCESS");
111 result[
"result"][
"meta"][
"TransactionResult"] ==
"tesSUCCESS");
120 testcase(
"Incorrect order multiple intermediaries");
123 cfg->FORCE_MULTI_THREAD =
true;
127 auto const alice =
Account(
"alice");
130 auto const aliceSequence = env.
seq(alice);
133 for (
auto i = 0; i < 5; ++i)
137 seq(aliceSequence + i),
138 json(R
"({"LastLedgerSequence":7})")));
141 for (
auto i = 1; i < 5; ++i)
144 BEAST_EXPECT(env.
seq(alice) == aliceSequence);
151 BEAST_EXPECT(env.
seq(alice) == aliceSequence + 5);
155 for (
auto i = 0; i < 5; ++i)
158 env.
rpc(
"tx",
to_string(tx[i].stx->getTransactionID()));
160 result[
"result"][
"meta"][
"TransactionResult"] ==
"tesSUCCESS");
Json::Value noop(Account const &account)
The null transaction.
const XRP_t XRP
Converts to XRP Issue or STAmount.
Set the expected result code for a JTx The test will fail if the code doesn't match.
JTx jt(JsonValue &&jv, FN const &... fN)
Create a JTx from parameters.
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
virtual NetworkOPs & getOPs()=0
void testIncorrectOrder()
virtual JobQueue & getJobQueue()=0
void testIncorrectOrderMultipleIntermediaries()
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
std::uint32_t seq(Account const &account) const
Returns the next sequence number on account.
virtual bool transactionBatch(bool drain)=0
Apply transactions in batches.
void rendezvous()
Block until no jobs running.
Set the sequence number on a JTx.
T emplace_back(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::array< Account, 1+sizeof...(Args)> noripple(Account const &account, Args const &... args)
Designate accounts as no-ripple in Env::fund.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
Immutable cryptographic account descriptor.
A transaction testing environment.
Json::Value rpc(std::unordered_map< std::string, std::string > const &headers, std::string const &cmd, Args &&... args)
Execute an RPC command.
BEAST_DEFINE_TESTSUITE(DeliverMin, app, ripple)