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/Payment.h>
34 #include <ripple/app/tx/impl/SetAccount.h>
35 #include <ripple/app/tx/impl/SetRegularKey.h>
36 #include <ripple/app/tx/impl/SetSignerList.h>
37 #include <ripple/app/tx/impl/SetTrust.h>
38 #include <ripple/app/tx/impl/PayChan.h>
89 if (
id != beast::zero)
91 TER result = T::checkSeq(ctx);
96 result = T::checkFee(ctx,
102 result = T::checkSign(ctx);
109 return T::preclaim(ctx);
116 switch(ctx.tx.getTxnType())
120 case ttCHECK_CASH:
return invoke_preclaim<CashCheck>(ctx);
131 case ttPAYMENT:
return invoke_preclaim<Payment>(ctx);
136 case ttTRUST_SET:
return invoke_preclaim<SetTrust>(ctx);
139 case ttFEE:
return invoke_preclaim<Change>(ctx);
187 auto const category = T::affectsSubsequentTransactionAuth(tx) ?
189 auto const feePaid = T::calculateFeePaid(tx);
190 auto const maxSpend = T::calculateMaxSpend(tx);
192 return{ category, feePaid, maxSpend };
199 switch (tx.getTxnType())
201 case ttACCOUNT_SET:
return invoke_calculateConsequences<SetAccount>(tx);
202 case ttCHECK_CANCEL:
return invoke_calculateConsequences<CancelCheck>(tx);
203 case ttCHECK_CASH:
return invoke_calculateConsequences<CashCheck>(tx);
204 case ttCHECK_CREATE:
return invoke_calculateConsequences<CreateCheck>(tx);
206 case ttOFFER_CANCEL:
return invoke_calculateConsequences<CancelOffer>(tx);
207 case ttOFFER_CREATE:
return invoke_calculateConsequences<CreateOffer>(tx);
208 case ttESCROW_CREATE:
return invoke_calculateConsequences<EscrowCreate>(tx);
209 case ttESCROW_FINISH:
return invoke_calculateConsequences<EscrowFinish>(tx);
210 case ttESCROW_CANCEL:
return invoke_calculateConsequences<EscrowCancel>(tx);
211 case ttPAYCHAN_CLAIM:
return invoke_calculateConsequences<PayChanClaim>(tx);
212 case ttPAYCHAN_CREATE:
return invoke_calculateConsequences<PayChanCreate>(tx);
213 case ttPAYCHAN_FUND:
return invoke_calculateConsequences<PayChanFund>(tx);
214 case ttPAYMENT:
return invoke_calculateConsequences<Payment>(tx);
217 case ttTICKET_CANCEL:
return invoke_calculateConsequences<CancelTicket>(tx);
218 case ttTICKET_CREATE:
return invoke_calculateConsequences<CreateTicket>(tx);
219 case ttTRUST_SET:
return invoke_calculateConsequences<SetTrust>(tx);
220 case ttACCOUNT_DELETE:
return invoke_calculateConsequences<DeleteAccount>(tx);
279 "apply: " << e.
what();
288 boost::optional<PreclaimContext const> ctx;
292 preflightResult.
tx, preflightResult.
flags,
294 ctx.emplace(app, view, secondFlight.ter, secondFlight.tx,
295 secondFlight.flags, secondFlight.j);
300 app, view, preflightResult.
ter, preflightResult.
tx,
301 preflightResult.
flags, preflightResult.
j);
306 return { *ctx, ctx->preflightResult };
311 JLOG(ctx->j.fatal()) <<
312 "apply: " << e.
what();
348 return{ preclaimResult.
ter,
false };
350 preclaimResult.
tx, preclaimResult.
ter,
352 preclaimResult.
flags, preclaimResult.
j);
357 JLOG(preclaimResult.
j.
fatal()) <<
358 "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