20 #include <ripple/app/tx/applySteps.h>
21 #include <ripple/app/tx/impl/ApplyContext.h>
22 #include <ripple/app/tx/impl/CancelCheck.h>
23 #include <ripple/app/tx/impl/CancelOffer.h>
24 #include <ripple/app/tx/impl/CancelTicket.h>
25 #include <ripple/app/tx/impl/CashCheck.h>
26 #include <ripple/app/tx/impl/Change.h>
27 #include <ripple/app/tx/impl/CreateCheck.h>
28 #include <ripple/app/tx/impl/CreateOffer.h>
29 #include <ripple/app/tx/impl/CreateTicket.h>
30 #include <ripple/app/tx/impl/DeleteAccount.h>
31 #include <ripple/app/tx/impl/DepositPreauth.h>
32 #include <ripple/app/tx/impl/Escrow.h>
33 #include <ripple/app/tx/impl/PayChan.h>
34 #include <ripple/app/tx/impl/Payment.h>
35 #include <ripple/app/tx/impl/SetAccount.h>
36 #include <ripple/app/tx/impl/SetRegularKey.h>
37 #include <ripple/app/tx/impl/SetSignerList.h>
38 #include <ripple/app/tx/impl/SetTrust.h>
108 if (
id != beast::zero)
110 TER result = T::checkSeq(ctx);
120 result = T::checkSign(ctx);
126 return T::preclaim(ctx);
132 switch (ctx.tx.getTxnType())
135 return invoke_preclaim<SetAccount>(ctx);
137 return invoke_preclaim<CancelCheck>(ctx);
139 return invoke_preclaim<CashCheck>(ctx);
141 return invoke_preclaim<CreateCheck>(ctx);
143 return invoke_preclaim<DepositPreauth>(ctx);
145 return invoke_preclaim<CancelOffer>(ctx);
147 return invoke_preclaim<CreateOffer>(ctx);
149 return invoke_preclaim<EscrowCreate>(ctx);
151 return invoke_preclaim<EscrowFinish>(ctx);
153 return invoke_preclaim<EscrowCancel>(ctx);
155 return invoke_preclaim<PayChanClaim>(ctx);
157 return invoke_preclaim<PayChanCreate>(ctx);
159 return invoke_preclaim<PayChanFund>(ctx);
161 return invoke_preclaim<Payment>(ctx);
163 return invoke_preclaim<SetRegularKey>(ctx);
165 return invoke_preclaim<SetSignerList>(ctx);
167 return invoke_preclaim<CancelTicket>(ctx);
169 return invoke_preclaim<CreateTicket>(ctx);
171 return invoke_preclaim<SetTrust>(ctx);
173 return invoke_preclaim<DeleteAccount>(ctx);
176 return invoke_preclaim<Change>(ctx);
238 static TxConsequences
241 auto const category = T::affectsSubsequentTransactionAuth(tx)
244 auto const feePaid = T::calculateFeePaid(tx);
245 auto const maxSpend = T::calculateMaxSpend(tx);
247 return {category, feePaid, maxSpend};
250 static TxConsequences
253 switch (tx.getTxnType())
256 return invoke_calculateConsequences<SetAccount>(tx);
258 return invoke_calculateConsequences<CancelCheck>(tx);
260 return invoke_calculateConsequences<CashCheck>(tx);
262 return invoke_calculateConsequences<CreateCheck>(tx);
264 return invoke_calculateConsequences<DepositPreauth>(tx);
266 return invoke_calculateConsequences<CancelOffer>(tx);
268 return invoke_calculateConsequences<CreateOffer>(tx);
270 return invoke_calculateConsequences<EscrowCreate>(tx);
272 return invoke_calculateConsequences<EscrowFinish>(tx);
274 return invoke_calculateConsequences<EscrowCancel>(tx);
276 return invoke_calculateConsequences<PayChanClaim>(tx);
278 return invoke_calculateConsequences<PayChanCreate>(tx);
280 return invoke_calculateConsequences<PayChanFund>(tx);
282 return invoke_calculateConsequences<Payment>(tx);
284 return invoke_calculateConsequences<SetRegularKey>(tx);
286 return invoke_calculateConsequences<SetSignerList>(tx);
288 return invoke_calculateConsequences<CancelTicket>(tx);
290 return invoke_calculateConsequences<CreateTicket>(tx);
292 return invoke_calculateConsequences<SetTrust>(tx);
294 return invoke_calculateConsequences<DeleteAccount>(tx);
418 JLOG(j.
fatal()) <<
"apply: " << e.
what();
429 boost::optional<PreclaimContext const> ctx;
436 preflightResult.
flags,
453 preflightResult.
flags,
459 return {*ctx, ctx->preflightResult};
464 JLOG(ctx->j.fatal()) <<
"apply: " << e.
what();
499 return {preclaimResult.
ter,
false};
506 preclaimResult.
flags,
512 JLOG(preclaimResult.
j.
fatal()) <<
"apply: " << e.
what();
TxType getTxnType() const
static NotTEC preflight(PreflightContext const &ctx)
static FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
ReadView const & view
From the input - the ledger view.
const beast::Journal j
From the input - the journal.
FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
Compute only the expected base fee for a transaction.
static FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
static NotTEC preflight(PreflightContext const &ctx)
static NotTEC invoke_preflight(PreflightContext const &ctx)
Writable ledger view that accumulates state and tx changes.
static NotTEC preflight(PreflightContext const &ctx)
const SF_Account sfAccount(access, STI_ACCOUNT, 1, "Account")
static FeeUnit64 invoke_calculateBaseFee(ReadView const &view, STTx const &tx)
@ normal
Moves currency around, creates offers, etc.
static NotTEC preflight(PreflightContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
STTx const & tx
From the input - the transaction.
static NotTEC preflight(PreflightContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
PreflightResult preflight(Application &app, Rules const &rules, STTx const &tx, ApplyFlags flags, beast::Journal j)
Gate a transaction based on static information.
static NotTEC preflight(PreflightContext const &ctx)
const bool likelyToClaimFee
Success flag - whether the transaction is likely to claim a fee.
const TER ter
Intermediate transaction result.
See the README.md for an overview of the SetSignerList transaction that this class implements.
static FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
std::pair< TER, bool > doApply(PreclaimResult const &preclaimResult, Application &app, OpenView &view)
Apply a prechecked transaction to an OpenView.
Describes the results of the preflight check.
const Rules rules
From the input - the rules.
AccountID getAccountID(SField const &field) const
const NotTEC ter
Intermediate transaction result.
TERSubset< CanCvtToTER > TER
static FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
State information when applying a tx.
static NotTEC preflight(PreflightContext const &ctx)
A generic endpoint for log messages.
Transactor specialized for creating offers in the ledger.
static TxConsequences invoke_calculateConsequences(STTx const &tx)
static NotTEC preflight(PreflightContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
static std::pair< TER, bool > invoke_apply(ApplyContext &ctx)
State information when determining if a tx is likely to claim a fee.
PreclaimResult preclaim(PreflightResult const &preflightResult, Application &app, OpenView const &view)
Gate a transaction based on static ledger information.
static NotTEC preflight(PreflightContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
static TER invoke_preclaim(PreclaimContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
TxConsequences calculateConsequences(PreflightResult const &preflightResult)
Determine the XRP balance consequences if a transaction consumes the maximum XRP allowed.
static NotTEC preflight(PreflightContext const &ctx)
LedgerIndex seq() const
Returns the sequence number of the base ledger.
FeeUnit< std::uint64_t > FeeUnit64
static NotTEC preflight(PreflightContext const &ctx)
static FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
Describes the results of the preclaim check.
Rules controlling protocol behavior.
static NotTEC preflight(PreflightContext const &ctx)
const ApplyFlags flags
From the input - the flags.
const ApplyFlags flags
From the input - the flags.
static NotTEC preflight(PreflightContext const &ctx)
State information when preflighting a tx.
static XRPAmount calculateFeePaid(STTx const &tx)
static NotTEC preflight(PreflightContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
@ blocker
Affects the ability of subsequent transactions to claim a fee.
Rules const & rules() const override
Returns the tx processing rules.
static NotTEC preflight(PreflightContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
STTx const & tx
From the input - the transaction.
const beast::Journal j
From the input - the journal.
TERSubset< CanCvtToNotTEC > NotTEC