20 #include <ripple/app/tx/impl/DepositPreauth.h>
21 #include <ripple/basics/Log.h>
22 #include <ripple/ledger/View.h>
23 #include <ripple/protocol/Feature.h>
24 #include <ripple/protocol/Indexes.h>
25 #include <ripple/protocol/TxFlags.h>
26 #include <ripple/protocol/st.h>
44 JLOG(j.trace()) <<
"Malformed transaction: Invalid flags set.";
50 if (
static_cast<bool>(optAuth) ==
static_cast<bool>(optUnauth))
55 <<
"Malformed transaction: "
56 "Invalid Authorize and Unauthorize field combination.";
61 AccountID const target{optAuth ? *optAuth : *optUnauth};
62 if (target == beast::zero)
64 JLOG(j.trace()) <<
"Malformed transaction: Authorized or Unauthorized "
73 <<
"Malformed transaction: Attempting to DepositPreauth self.";
130 auto slePreauth = std::make_shared<SLE>(preauthKeylet);
142 JLOG(
j_.
trace()) <<
"Adding DepositPreauth to owner directory "
144 << (page ?
"success" :
"failure");
178 JLOG(j.
warn()) <<
"Selected DepositPreauth does not exist.";
186 JLOG(j.
fatal()) <<
"Unable to delete DepositPreauth from owner.";
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
const SF_UINT32 sfOwnerCount
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
A pair of SHAMap key and LedgerEntryType.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
const SF_UINT64 sfOwnerNode
Stream trace() const
Severity stream access functions.
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
const uint256 featureDepositPreauth
virtual void erase(std::shared_ptr< SLE > const &sle)=0
Remove a peeked SLE.
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
Writeable view to a ledger, for applying a transaction.
bool dirRemove(Keylet const &directory, std::uint64_t page, uint256 const &key, bool keepRoot)
Remove an entry from a directory.
static TER removeFromLedger(Application &app, ApplyView &view, uint256 const &delIndex, beast::Journal j)
void adjustOwnerCount(ApplyView &view, std::shared_ptr< SLE > const &sle, std::int32_t amount, beast::Journal j)
Adjust the owner count up or down.
static TER preclaim(PreclaimContext const &ctx)
const SF_ACCOUNT sfUnauthorize
Keylet account(AccountID const &id) noexcept
AccountID root.
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
A generic endpoint for log messages.
const SF_ACCOUNT sfAuthorize
State information when determining if a tx is likely to claim a fee.
virtual void insert(std::shared_ptr< SLE > const &sle)=0
Insert a new state SLE.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
virtual beast::Journal journal(std::string const &name)=0
XRPAmount accountReserve(std::size_t ownerCount) const
Returns the account reserve given the owner count, in drops.
bool isFieldPresent(SField const &field) const
@ tecINSUFFICIENT_RESERVE
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
const SF_ACCOUNT sfAccount
State information when preflighting a tx.
std::optional< std::uint64_t > dirInsert(Keylet const &directory, uint256 const &key, std::function< void(std::shared_ptr< SLE > const &)> const &describe)
Insert an entry to a directory.
static NotTEC preflight(PreflightContext const &ctx)
constexpr std::uint32_t tfUniversalMask
Keylet depositPreauth(AccountID const &owner, AccountID const &preauthorized) noexcept
A DepositPreauth.
TERSubset< CanCvtToNotTEC > NotTEC