20#include <xrpld/app/tx/detail/ApplyContext.h>
21#include <xrpld/app/tx/detail/InvariantCheck.h>
23#include <xrpl/basics/Log.h>
24#include <xrpl/beast/utility/instrumentation.h>
25#include <xrpl/json/to_string.h>
40 , preclaimResult(preclaimResult_)
45 , parentBatchId_(parentBatchId)
49 "Parent Batch ID should be set if batch apply flag is set");
112 (..., std::get<Is>(checkers).visitEntry(isDelete, before,
after));
121 {std::get<Is>(checkers).finalize(
126 finalizers.cbegin(), finalizers.cend(), [](
auto const& b) {
131 <<
"Transaction has failed one or more invariants: "
140 <<
"Transaction caused an exception in an invariant"
141 <<
", ex: " << ex.
what()
155 "ripple::ApplyContext::checkInvariants : is tesSUCCESS or tecCLAIM");
A generic endpoint for log messages.
void visit(std::function< void(uint256 const &key, bool isDelete, std::shared_ptr< SLE const > const &before, std::shared_ptr< SLE const > const &after)> const &func)
Visit unapplied changes.
std::optional< TxMeta > apply(TER)
Apply the transaction result to the base.
ApplyContext(Application &app, OpenView &base, std::optional< uint256 const > const &parentBatchId, STTx const &tx, TER preclaimResult, XRPAmount baseFee, ApplyFlags flags, beast::Journal journal=beast::Journal{beast::Journal::getNullSink()})
void discard()
Discard changes and start fresh.
TER failInvariantCheck(TER const result)
beast::Journal const journal
std::size_t size()
Get the number of unapplied changes.
std::optional< ApplyViewImpl > view_
TER checkInvariants(TER const result, XRPAmount const fee)
Applies all invariant checkers one by one.
std::optional< uint256 const > parentBatchId_
TER checkInvariantsHelper(TER const result, XRPAmount const fee, std::index_sequence< Is... >)
Writable ledger view that accumulates state and tx changes.
Json::Value getJson(JsonOptions options) const override
Set the expected result code for a JTx The test will fail if the code doesn't match.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool isTesSuccess(TER x) noexcept
std::string to_string(base_uint< Bits, Tag > const &a)
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
InvariantChecks getInvariantChecks()
get a tuple of all invariant checks
bool isTecClaim(TER x) noexcept