20#include <xrpld/app/ledger/Ledger.h>
21#include <xrpld/app/tx/detail/CancelCheck.h>
22#include <xrpld/ledger/ApplyView.h>
24#include <xrpl/basics/Log.h>
25#include <xrpl/protocol/Feature.h>
26#include <xrpl/protocol/Indexes.h>
27#include <xrpl/protocol/TER.h>
28#include <xrpl/protocol/TxFlags.h>
45 JLOG(ctx.
j.
warn()) <<
"Malformed transaction: Invalid flags set.";
58 JLOG(ctx.
j.
warn()) <<
"Check does not exist.";
64 auto const optExpiry = (*sleCheck)[~sfExpiration];
75 AccountID const acctId{ctx.tx[sfAccount]};
76 if (acctId != (*sleCheck)[sfAccount] &&
77 acctId != (*sleCheck)[sfDestination])
79 JLOG(ctx.j.warn()) <<
"Check is not expired and canceler is "
80 "neither check source nor destination.";
90 auto const sleCheck = view().peek(keylet::check(ctx_.tx[sfCheckID]));
94 JLOG(j_.
warn()) <<
"Check does not exist.";
98 AccountID const srcId{sleCheck->getAccountID(sfAccount)};
99 AccountID const dstId{sleCheck->getAccountID(sfDestination)};
100 auto viewJ = ctx_.app.journal(
"View");
107 if (!view().dirRemove(
108 keylet::ownerDir(dstId), page, sleCheck->
key(),
true))
110 JLOG(j_.
fatal()) <<
"Unable to delete check from destination.";
116 if (!view().dirRemove(
117 keylet::ownerDir(srcId), page, sleCheck->
key(),
true))
119 JLOG(j_.
fatal()) <<
"Unable to delete check from owner.";
125 auto const sleSrc = view().peek(keylet::account(srcId));
129 view().erase(sleCheck);
static TER preclaim(PreclaimContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
std::chrono::time_point< NetClock > time_point
std::chrono::duration< rep, period > duration
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
NetClock::time_point parentCloseTime() const
Returns the close time of the previous ledger.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
std::uint32_t getFlags() const
Keylet check(AccountID const &id, std::uint32_t seq) noexcept
A Check.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
void adjustOwnerCount(ApplyView &view, std::shared_ptr< SLE > const &sle, std::int32_t amount, beast::Journal j)
Adjust the owner count up or down.
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
bool isTesSuccess(TER x) noexcept
constexpr std::uint32_t tfUniversalMask
TERSubset< CanCvtToTER > TER
TERSubset< CanCvtToNotTEC > NotTEC
State information when determining if a tx is likely to claim a fee.
State information when preflighting a tx.