20#include <xrpld/app/tx/detail/DelegateSet.h>
22#include <xrpl/basics/Log.h>
23#include <xrpl/ledger/View.h>
24#include <xrpl/protocol/Feature.h>
25#include <xrpl/protocol/Indexes.h>
26#include <xrpl/protocol/st.h>
44 if (ctx.
tx[sfAccount] == ctx.
tx[sfAuthorize])
49 for (
auto const& permission : permissions)
51 if (!permissionSet.
insert(permission[sfPermissionValue]).second)
56 permission[sfPermissionValue], ctx.
rules))
73 for (
auto const& permission : permissions)
77 permission[sfPermissionValue], ctx.
view.
rules()))
102 auto const& authAccount =
ctx_.
tx[sfAuthorize];
109 if (permissions.empty())
113 sle->setFieldArray(sfPermissions, permissions);
119 sleOwner->getFieldU32(sfOwnerCount) + 1)};
125 if (!permissions.empty())
128 sle->setAccountID(sfAccount,
account_);
129 sle->setAccountID(sfAuthorize, authAccount);
131 sle->setFieldArray(sfPermissions, permissions);
140 (*sle)[sfOwnerNode] = *page;
162 JLOG(j.
fatal()) <<
"Unable to delete Delegate from owner.";
A generic endpoint for log messages.
beast::Journal const journal
Writeable view to a ledger, for applying a transaction.
virtual void update(std::shared_ptr< SLE > const &sle)=0
Indicate changes to a peeked SLE.
bool dirRemove(Keylet const &directory, std::uint64_t page, uint256 const &key, bool keepRoot)
Remove an entry from a directory.
virtual void insert(std::shared_ptr< SLE > const &sle)=0
Insert a new state SLE.
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.
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
virtual void erase(std::shared_ptr< SLE > const &sle)=0
Remove a peeked SLE.
static TER preclaim(PreclaimContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
static TER deleteDelegate(ApplyView &view, std::shared_ptr< SLE > const &sle, AccountID const &account, beast::Journal j)
static Permission const & getInstance()
bool isDelegatable(std::uint32_t const &permissionValue, Rules const &rules) const
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
virtual Rules const & rules() const =0
Returns the tx processing rules.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
STArray const & getFieldArray(SField const &field) const
Keylet delegate(AccountID const &account, AccountID const &authorizedAccount) noexcept
A keylet for Delegate object.
Keylet account(AccountID const &id) noexcept
AccountID root.
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::size_t constexpr permissionMaxSize
The maximum number of delegate permissions an account can grant.
void adjustOwnerCount(ApplyView &view, std::shared_ptr< SLE > const &sle, std::int32_t amount, beast::Journal j)
Adjust the owner count up or down.
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
@ tecINSUFFICIENT_RESERVE
bool isTesSuccess(TER x) noexcept
TERSubset< CanCvtToNotTEC > NotTEC
XRPAmount accountReserve(std::size_t ownerCount) const
Returns the account reserve given the owner count, in drops.
State information when determining if a tx is likely to claim a fee.
State information when preflighting a tx.