Apply a transaction to an OpenView
.
std::pair< TER, bool > apply( Application& app, OpenView& view, STTx const& tx, ApplyFlags flags, beast::Journal journal);
This function is the canonical way to apply a transaction to a ledger. It rolls the validation and application steps into one function. To do the steps manually, the correct calling order is:
preflight -> preclaim -> doApply
The result of one function must be passed to the next. The preflight
result can be safely cached and
reused asynchronously, but preclaim
and doApply
must be called
in the same thread and with the same view.
Does not throw.
For open ledgers, the Transactor
will catch exceptions and return tefEXCEPTION
.
For closed ledgers, the Transactor
will attempt to only charge a fee, and return tecFAILED_PROCESSING
.
If the Transactor
gets an
exception while trying to charge the fee, it will be caught and turned into
tefEXCEPTION
.
For network health, a Transactor
makes its best effort to at least charge a fee if the ledger is closed.
Name |
Description |
---|---|
|
The current running |
|
The open ledger that the transaction will attempt to be applied to. |
|
The transaction to be checked. |
|
|
|
A journal. |
A pair with the TER
and a
bool
indicating whether or not
the transaction was applied.
#include <ripple/app/tx/apply.h>