2#include <test/jtx/CheckMessageLogs.h>
4#include <xrpld/app/ledger/LedgerHistory.h>
5#include <xrpld/app/ledger/LedgerMaster.h>
6#include <xrpld/app/tx/apply.h>
8#include <xrpl/beast/insight/NullCollector.h>
9#include <xrpl/beast/unit_test.h>
10#include <xrpl/ledger/OpenView.h>
46 *prev, prev->info().closeTime + closeOffset);
55 res->updateSkipList();
65 res->info().closeTime,
66 res->info().closeTimeResolution,
87 auto const genesis =
makeLedger({}, env, lh, 0s);
89 lh.builtLedger(genesis, dummyTxHash, {});
90 lh.validatedLedger(genesis, dummyTxHash);
102 "MISMATCH on close time", &found)};
104 auto const genesis =
makeLedger({}, env, lh, 0s);
105 auto const ledgerA =
makeLedger(genesis, env, lh, 4s);
106 auto const ledgerB =
makeLedger(genesis, env, lh, 40s);
109 lh.builtLedger(ledgerA, dummyTxHash, {});
110 lh.validatedLedger(ledgerB, dummyTxHash);
122 "MISMATCH on prior ledger", &found)};
124 auto const genesis =
makeLedger({}, env, lh, 0s);
125 auto const ledgerA =
makeLedger(genesis, env, lh, 4s);
126 auto const ledgerB =
makeLedger(genesis, env, lh, 40s);
127 auto const ledgerAC =
makeLedger(ledgerA, env, lh, 4s);
128 auto const ledgerBD =
makeLedger(ledgerB, env, lh, 4s);
131 lh.builtLedger(ledgerAC, dummyTxHash, {});
132 lh.validatedLedger(ledgerBD, dummyTxHash);
139 for (
bool const txBug : {
true,
false})
142 ?
"MISMATCH with same consensus transaction set"
143 :
"MISMATCH on consensus transaction set";
153 env.
fund(
XRP(1000), alice, bob);
156 auto const ledgerBase =
164 auto const ledgerB =
makeLedger(ledgerBase, env, lh, 4s, txBob.
stx);
171 txBug ? txAlice.
stx->getTransactionID()
172 : txBob.
stx->getTransactionID());
static std::shared_ptr< Collector > New()
testcase_t testcase
Memberspace for declaring test cases.
virtual Config & config()=0
virtual Family & getNodeFamily()=0
virtual LedgerMaster & getLedgerMaster()=0
Retains historical ledgers.
void builtLedger(std::shared_ptr< Ledger const > const &, uint256 const &consensusHash, Json::Value)
Report that we have locally built a particular ledger.
bool insert(std::shared_ptr< Ledger const > const &ledger, bool validated)
Track a ledger.
void validatedLedger(std::shared_ptr< Ledger const > const &, std::optional< uint256 > const &consensusHash)
Report that we have validated a particular ledger.
std::shared_ptr< Ledger const > getClosedLedger()
Writable ledger view that accumulates state and tx changes.
void run() override
Runs the suite.
void testHandleMismatch()
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...
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.
JTx jt(JsonValue &&jv, FN const &... fN)
Create a JTx from parameters.
beast::Journal const journal
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
XRP_t const XRP
Converts to XRP Issue or STAmount.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
create_genesis_t const create_genesis
ApplyTransactionResult applyTransaction(Application &app, OpenView &view, STTx const &tx, bool retryAssured, ApplyFlags flags, beast::Journal journal)
Transaction application helper.
Execution context for applying a JSON transaction.
std::shared_ptr< STTx const > stx