PrevUpHomeNext

apply

Apply a transaction to an OpenView.

Synopsis
std::pair< TER, bool >
apply(
    Application& app,
    OpenView& view,
    STTx const& tx,
    ApplyFlags flags,
    beast::Journal journal);
Description

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.

Remarks

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.

Parameters

Name

Description

app

The current running Application.

view

The open ledger that the transaction will attempt to be applied to.

tx

The transaction to be checked.

flags

ApplyFlags describing processing options.

journal

A journal.

See Also

preflight, preclaim, doApply

Return Value

A pair with the TER and a bool indicating whether or not the transaction was applied.

Header

#include <ripple/app/tx/apply.h>


PrevUpHomeNext