2#include <test/jtx/CheckMessageLogs.h>
4#include <xrpld/app/ledger/LedgerHistory.h>
5#include <xrpld/app/ledger/LedgerMaster.h>
7#include <xrpl/beast/insight/NullCollector.h>
8#include <xrpl/beast/unit_test.h>
9#include <xrpl/ledger/OpenView.h>
10#include <xrpl/tx/apply.h>
42 env.
app().config().FEES.toFees(),
50 OpenView accum(&*res);
54 res->updateSkipList();
64 res->header().closeTime,
65 res->header().closeTimeResolution,
83 auto const genesis =
makeLedger({}, env, lh, 0s);
85 lh.builtLedger(genesis, dummyTxHash, {});
86 lh.validatedLedger(genesis, dummyTxHash);
99 auto const genesis =
makeLedger({}, env, lh, 0s);
100 auto const ledgerA =
makeLedger(genesis, env, lh, 4s);
101 auto const ledgerB =
makeLedger(genesis, env, lh, 40s);
104 lh.builtLedger(ledgerA, dummyTxHash, {});
105 lh.validatedLedger(ledgerB, dummyTxHash);
118 auto const genesis =
makeLedger({}, env, lh, 0s);
119 auto const ledgerA =
makeLedger(genesis, env, lh, 4s);
120 auto const ledgerB =
makeLedger(genesis, env, lh, 40s);
121 auto const ledgerAC =
makeLedger(ledgerA, env, lh, 4s);
122 auto const ledgerBD =
makeLedger(ledgerB, env, lh, 4s);
125 lh.builtLedger(ledgerAC, dummyTxHash, {});
126 lh.validatedLedger(ledgerBD, dummyTxHash);
133 for (
bool const txBug : {
true,
false})
135 std::string const msg = txBug ?
"MISMATCH with same consensus transaction set"
136 :
"MISMATCH on consensus transaction set";
143 env.
fund(
XRP(1000), alice, bob);
149 auto const ledgerA =
makeLedger(ledgerBase, env, lh, 4s, txAlice.
stx);
152 auto const ledgerB =
makeLedger(ledgerBase, env, lh, 4s, txBob.
stx);
158 ledgerB, txBug ? txAlice.
stx->getTransactionID() : txBob.
stx->getTransactionID());
static std::shared_ptr< Collector > New()
testcase_t testcase
Memberspace for declaring test cases.
Retains historical ledgers.
void validatedLedger(std::shared_ptr< Ledger const > const &, std::optional< uint256 > const &consensusHash)
Report that we have validated a particular ledger.
bool insert(std::shared_ptr< Ledger const > const &ledger, bool validated)
Track a ledger.
void builtLedger(std::shared_ptr< Ledger const > const &, uint256 const &consensusHash, Json::Value)
Report that we have locally built a particular ledger.
std::shared_ptr< Ledger const > getClosedLedger()
Rules controlling protocol behavior.
virtual LedgerMaster & getLedgerMaster()=0
virtual Family & getNodeFamily()=0
static std::shared_ptr< Ledger > makeLedger(std::shared_ptr< Ledger const > const &prev, jtx::Env &env, LedgerHistory &lh, NetClock::duration closeOffset, std::shared_ptr< STTx const > stx={})
Generate a new ledger by hand, applying a specific close time offset and optionally inserting a trans...
void run() override
Runs the suite.
void testHandleMismatch()
Immutable cryptographic account descriptor.
A transaction testing environment.
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
JTx jt(JsonValue &&jv, FN const &... fN)
Create a JTx from parameters.
beast::Journal const journal
XRP_t const XRP
Converts to XRP Issue or STAmount.
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
ApplyTransactionResult applyTransaction(ServiceRegistry ®istry, OpenView &view, STTx const &tx, bool retryAssured, ApplyFlags flags, beast::Journal journal)
Transaction application helper.
create_genesis_t const create_genesis
Execution context for applying a JSON transaction.
std::shared_ptr< STTx const > stx