3#include <xrpl/basics/base_uint.h>
4#include <xrpl/beast/utility/Journal.h>
5#include <xrpl/beast/utility/instrumentation.h>
6#include <xrpl/core/ServiceRegistry.h>
7#include <xrpl/ledger/ApplyView.h>
8#include <xrpl/ledger/ApplyViewImpl.h>
9#include <xrpl/ledger/OpenView.h>
10#include <xrpl/ledger/RawView.h>
11#include <xrpl/protocol/STAmount.h>
12#include <xrpl/protocol/STTx.h>
13#include <xrpl/protocol/TER.h>
14#include <xrpl/protocol/TxMeta.h>
15#include <xrpl/protocol/XRPAmount.h>
54 XRPL_ASSERT((
flags &
TapBatch) == 0,
"Batch apply flag should not be set");
95 view_->deliver(amount);
130 view_->rawDestroyXRP(fee);
148 "xrpl::ApplyContext::getApplyViewContext : view_ emplaced in constructor");
149 return {.view = *
view_, .tx =
tx};
A generic endpoint for log messages.
static Sink & getNullSink()
Returns a Sink which does nothing.
State information when applying a tx.
std::size_t size()
Get the number of unapplied changes.
static TER failInvariantCheck(TER const result)
void destroyXRP(XRPAmount const &fee)
ApplyViewContext getApplyViewContext()
ApplyFlags const & flags() const
void discard()
Discard changes and start fresh.
std::reference_wrapper< ServiceRegistry > registry
void deliver(STAmount const &amount)
Sets the DeliveredAmount field in the metadata.
std::optional< TxMeta > apply(TER)
Apply the transaction result to the base.
std::optional< ApplyViewImpl > view_
beast::Journal const journal
ApplyView const & view() const
TER checkInvariantsHelper(TER const result, XRPAmount const fee, std::index_sequence< Is... >)
void visit(std::function< void(uint256 const &key, bool isDelete, SLE::const_ref before, SLE::const_ref after)> const &func)
Visit unapplied changes.
TER checkInvariants(TER const result, XRPAmount const fee)
Applies all invariant checkers one by one.
std::optional< uint256 const > parentBatchId_
ApplyContext(ServiceRegistry ®istry, OpenView &base, STTx const &tx, TER preclaimResult, XRPAmount baseFee, ApplyFlags flags, beast::Journal journal=beast::Journal{beast::Journal::getNullSink()})
ApplyContext(ServiceRegistry ®istry, 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()})
Writeable view to a ledger, for applying a transaction.
Writable ledger view that accumulates state and tx changes.
Interface for ledger entry changes.
std::shared_ptr< STLedgerEntry const > const & const_ref
Service registry for dependency injection.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
TERSubset< CanCvtToTER > TER
Bundles the mutable ledger view and the transaction being applied.