18 #include <ripple/core/JobQueue.h>
19 #include <ripple/protocol/ErrorCodes.h>
31 testcase(
"Correct Order");
34 auto const alice =
Account(
"alice");
37 auto const aliceSequence = env.
seq(alice);
39 auto const tx1 = env.
jt(
noop(alice),
seq(aliceSequence));
40 auto const tx2 = env.
jt(
42 seq(aliceSequence + 1),
43 json(R
"({"LastLedgerSequence":7})"));
47 BEAST_EXPECT(env.seq(alice) == aliceSequence + 1);
50 BEAST_EXPECT(env.seq(alice) == aliceSequence + 2);
58 result[
"result"][
"meta"][
"TransactionResult"] ==
"tesSUCCESS");
64 result[
"result"][
"meta"][
"TransactionResult"] ==
"tesSUCCESS");
73 testcase(
"Incorrect order");
76 cfg->FORCE_MULTI_THREAD =
false;
80 auto const alice =
Account(
"alice");
83 auto const aliceSequence = env.
seq(alice);
85 auto const tx1 = env.
jt(
noop(alice),
seq(aliceSequence));
86 auto const tx2 = env.
jt(
88 seq(aliceSequence + 1),
89 json(R
"({"LastLedgerSequence":7})"));
92 BEAST_EXPECT(env.seq(alice) == aliceSequence);
95 BEAST_EXPECT(env.seq(alice) == aliceSequence + 2);
103 result[
"result"][
"meta"][
"TransactionResult"] ==
"tesSUCCESS");
109 result[
"result"][
"meta"][
"TransactionResult"] ==
"tesSUCCESS");
118 testcase(
"Incorrect order multiple intermediaries");
121 cfg->FORCE_MULTI_THREAD =
true;
125 auto const alice =
Account(
"alice");
128 auto const aliceSequence = env.
seq(alice);
131 for (
auto i = 0; i < 5; ++i)
135 seq(aliceSequence + i),
136 json(R
"({"LastLedgerSequence":7})")));
139 for (
auto i = 1; i < 5; ++i)
142 BEAST_EXPECT(env.
seq(alice) == aliceSequence);
147 BEAST_EXPECT(env.
seq(alice) == aliceSequence + 5);
151 for (
auto i = 0; i < 5; ++i)
154 env.
rpc(
"tx",
to_string(tx[i].stx->getTransactionID()));
156 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
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.
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)