20#include <xrpld/app/tx/applySteps.h> 
   21#pragma push_macro("TRANSACTION") 
   25#define TRANSACTION(...) 
   26#define TRANSACTION_INCLUDE 1 
   28#include <xrpl/protocol/detail/transactions.macro> 
   31#pragma pop_macro("TRANSACTION") 
   36#include <xrpl/protocol/TxFormats.h> 
   47    UnknownTxnType(
TxType t) : txnType{t}
 
   56with_txn_type(
TxType txnType, F&& f)
 
   60#pragma push_macro("TRANSACTION") 
   63#define TRANSACTION(tag, value, name, ...) \ 
   65        return f.template operator()<name>(); 
   67#include <xrpl/protocol/detail/transactions.macro> 
   70#pragma pop_macro("TRANSACTION") 
   72            throw UnknownTxnType(txnType);
 
  112    return T::makeTxConsequences(ctx);
 
 
  121        return with_txn_type(ctx.
tx.
getTxnType(), [&]<
typename T>() {
 
  122            auto const tec = Transactor::invokePreflight<T>(ctx);
 
  123            return std::make_pair(
 
  125                isTesSuccess(tec) ? consequences_helper<T>(ctx)
 
  126                                  : TxConsequences{tec});
 
  129    catch (UnknownTxnType 
const& e)
 
  134            << 
"Unknown transaction type in preflight: " << e.txnType;
 
  135        UNREACHABLE(
"ripple::invoke_preflight : unknown transaction type");
 
 
  161            auto const id = ctx.tx.getAccountID(sfAccount);
 
  163            if (id != beast::zero)
 
  165                if (NotTEC const preSigResult = [&]() -> NotTEC {
 
  166                        if (NotTEC const result =
 
  167                                T::checkSeqProxy(ctx.view, ctx.tx, ctx.j))
 
  170                        if (NotTEC const result =
 
  171                                T::checkPriorTxAndLastLedger(ctx))
 
  174                        if (NotTEC const result =
 
  175                                T::checkPermission(ctx.view, ctx.tx))
 
  178                        if (NotTEC const result = T::checkSign(ctx))
 
  185                if (TER const result =
 
  186                        T::checkFee(ctx, calculateBaseFee(ctx.view, ctx.tx)))
 
  190            return T::preclaim(ctx);
 
  193    catch (UnknownTxnType 
const& e)
 
  198            << 
"Unknown transaction type in preclaim: " << e.txnType;
 
  199        UNREACHABLE(
"ripple::invoke_preclaim : unknown transaction type");
 
 
  226        return with_txn_type(tx.
getTxnType(), [&]<
typename T>() {
 
  227            return T::calculateBaseFee(view, tx);
 
  230    catch (UnknownTxnType 
const& e)
 
  234            "ripple::invoke_calculateBaseFee : unknown transaction type");
 
 
  240TxConsequences::TxConsequences(
NotTEC pfresult)
 
  243    , potentialSpend_(
beast::zero)
 
  245    , sequencesConsumed_(0)
 
  249        "ripple::TxConsequences::TxConsequences : is not tesSUCCESS");
 
 
  255          tx[sfFee].native() && !tx[sfFee].negative() ? tx[sfFee].xrp()
 
  257    , potentialSpend_(
beast::zero)
 
  258    , seqProx_(tx.getSeqProxy())
 
  259    , sequencesConsumed_(tx.getSeqProxy().isSeq() ? 1 : 0)
 
 
  286        return with_txn_type(ctx.
tx.
getTxnType(), [&]<
typename T>() {
 
  291    catch (UnknownTxnType 
const& e)
 
  296            << 
"Unknown transaction type in apply: " << e.txnType;
 
  297        UNREACHABLE(
"ripple::invoke_apply : unknown transaction type");
 
 
  318        JLOG(j.
fatal()) << 
"apply (preflight): " << e.
what();
 
 
  339        JLOG(j.
fatal()) << 
"apply (preflight): " << e.
what();
 
 
  353        auto secondFlight = [&]() {
 
  360                    preflightResult.
flags,
 
  367                preflightResult.
flags,
 
  377            secondFlight.parentBatchId,
 
  387            preflightResult.
flags,
 
  395            return {*ctx, ctx->preflightResult};
 
  400        JLOG(ctx->j.fatal()) << 
"apply (preclaim): " << e.
what();
 
 
  429            return {preclaimResult.
ter, 
false};
 
  437            preclaimResult.
flags,
 
  443        JLOG(preclaimResult.
j.
fatal()) << 
"apply: " << e.
what();
 
 
A generic endpoint for log messages.
 
State information when applying a tx.
 
beast::Journal const journal
 
Writable ledger view that accumulates state and tx changes.
 
Rules const & rules() const override
Returns the tx processing rules.
 
LedgerIndex seq() const
Returns the sequence number of the base ledger.
 
Rules controlling protocol behavior.
 
TxType getTxnType() const
 
A type that represents either a sequence value or a ticket value.
 
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
 
Class describing the consequences to the account of applying a transaction if the transaction consume...
 
std::uint32_t sequencesConsumed() const
Sequences consumed.
 
TxConsequences(NotTEC pfresult)
 
std::uint32_t sequencesConsumed_
Number of sequences consumed.
 
XRPAmount const & potentialSpend() const
Potential Spend.
 
bool isBlocker_
Describes how the transaction affects subsequent transactions.
 
Category
Describes how the transaction affects subsequent transactions.
 
@ blocker
Affects the ability of subsequent transactions to claim a fee.
 
XRPAmount potentialSpend_
Does NOT include the fee.
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
PreflightResult preflight(Application &app, Rules const &rules, STTx const &tx, ApplyFlags flags, beast::Journal j)
Gate a transaction based on static information.
 
ApplyResult doApply(PreclaimResult const &preclaimResult, Application &app, OpenView &view)
Apply a prechecked transaction to an OpenView.
 
TxType
Transaction type identifiers.
 
XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Compute only the expected base fee for a transaction.
 
static XRPAmount invoke_calculateBaseFee(ReadView const &view, STTx const &tx)
Calculates the base fee for a given transaction.
 
PreclaimResult preclaim(PreflightResult const &preflightResult, Application &app, OpenView const &view)
Gate a transaction based on static ledger information.
 
static std::pair< NotTEC, TxConsequences > invoke_preflight(PreflightContext const &ctx)
 
static TER invoke_preclaim(PreclaimContext const &ctx)
 
bool isTesSuccess(TER x) noexcept
 
static ApplyResult invoke_apply(ApplyContext &ctx)
 
TERSubset< CanCvtToTER > TER
 
TxConsequences consequences_helper(PreflightContext const &ctx)
 
XRPAmount calculateDefaultBaseFee(ReadView const &view, STTx const &tx)
Return the minimum fee that an "ordinary" transaction would pay.
 
State information when determining if a tx is likely to claim a fee.
 
Describes the results of the preclaim check.
 
ApplyFlags const flags
From the input - the flags.
 
TER const ter
Intermediate transaction result.
 
bool const likelyToClaimFee
Success flag - whether the transaction is likely to claim a fee.
 
ReadView const  & view
From the input - the ledger view.
 
beast::Journal const j
From the input - the journal.
 
std::optional< uint256 const  > const parentBatchId
From the input - the batch identifier, if part of a batch.
 
STTx const  & tx
From the input - the transaction.
 
State information when preflighting a tx.
 
Describes the results of the preflight check.
 
Rules const rules
From the input - the rules.
 
ApplyFlags const flags
From the input - the flags.
 
beast::Journal const j
From the input - the journal.
 
NotTEC const ter
Intermediate transaction result.
 
std::optional< uint256 const  > const parentBatchId
From the input - the batch identifier, if part of a batch.
 
STTx const  & tx
From the input - the transaction.