1#include <xrpld/app/tx/detail/DID.h> 
    2#include <xrpld/app/tx/detail/DelegateSet.h> 
    3#include <xrpld/app/tx/detail/DeleteAccount.h> 
    4#include <xrpld/app/tx/detail/DeleteOracle.h> 
    5#include <xrpld/app/tx/detail/DepositPreauth.h> 
    6#include <xrpld/app/tx/detail/NFTokenUtils.h> 
    7#include <xrpld/app/tx/detail/SetSignerList.h> 
    9#include <xrpl/basics/Log.h> 
   10#include <xrpl/basics/mulDiv.h> 
   11#include <xrpl/beast/utility/instrumentation.h> 
   12#include <xrpl/ledger/CredentialHelpers.h> 
   13#include <xrpl/ledger/View.h> 
   14#include <xrpl/protocol/Feature.h> 
   15#include <xrpl/protocol/Indexes.h> 
   16#include <xrpl/protocol/Protocol.h> 
   17#include <xrpl/protocol/TxFlags.h> 
   18#include <xrpl/protocol/Units.h> 
   38    if (ctx.
tx[sfAccount] == ctx.
tx[sfDestination])
 
 
   58using DeleterFuncPtr = 
TER (*)(
 
   92removeTicketFromLedger(
 
  104removeDepositPreauthFromLedger(
 
  116removeNFTokenOfferFromLedger(
 
  143removeOracleFromLedger(
 
  155removeCredentialFromLedger(
 
  167removeDelegateFromLedger(
 
  191            return removeTicketFromLedger;
 
  192        case ltDEPOSIT_PREAUTH:
 
  193            return removeDepositPreauthFromLedger;
 
  194        case ltNFTOKEN_OFFER:
 
  195            return removeNFTokenOfferFromLedger;
 
  197            return removeDIDFromLedger;
 
  199            return removeOracleFromLedger;
 
  201            return removeCredentialFromLedger;
 
  203            return removeDelegateFromLedger;
 
  245        sleAccount, 
"ripple::DeleteAccount::preclaim : non-null account");
 
  251    if ((*sleAccount)[~sfMintedNFTokens] != (*sleAccount)[~sfBurnedNFTokens])
 
  271    if ((*sleAccount)[sfSequence] + seqDelta > ctx.
view.
seq())
 
  285    if ((*sleAccount)[~sfFirstNFTokenSequence].value_or(0) +
 
  286            (*sleAccount)[~sfMintedNFTokens].value_or(0) + seqDelta >
 
  297    unsigned int uDirEntry{0};
 
  303            ctx.
view, ownerDirKeylet.key, sleDirNode, uDirEntry, dirEntry))
 
  317                << 
"DeleteAccount: directory node in ledger " << ctx.
view.
seq()
 
  318                << 
" has index to object that is missing: " 
  325            safe_cast<LedgerEntryType>((*sleItem)[sfLedgerEntryType])};
 
  327        if (!nonObligationDeleter(nodeType))
 
  336        ctx.
view, ownerDirKeylet.key, sleDirNode, uDirEntry, dirEntry));
 
 
  346        src, 
"ripple::DeleteAccount::doApply : non-null source account");
 
  348    auto const dstID = 
ctx_.
tx[sfDestination];
 
  351        dst, 
"ripple::DeleteAccount::doApply : non-null destination account");
 
  372            if (
auto deleter = nonObligationDeleter(nodeType))
 
  382                "ripple::DeleteAccount::doApply : undeletable item not found " 
  384            JLOG(
j_.
error()) << 
"DeleteAccount undeletable item not " 
  385                                "found in preclaim.";
 
  400        "ripple::DeleteAccount::doApply : source balance is zero");
 
  404    if (
view().exists(ownerDirKeylet) && !
view().emptyDirDelete(ownerDirKeylet))
 
  406        JLOG(
j_.
error()) << 
"DeleteAccount cannot delete root dir node of " 
 
A generic endpoint for log messages.
 
beast::Journal const journal
 
void deliver(STAmount const &amount)
Sets the DeliveredAmount field in the metadata.
 
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.
 
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 deleteSLE(ApplyContext &ctx, Keylet sleKeylet, AccountID const owner)
 
static TER deleteDelegate(ApplyView &view, std::shared_ptr< SLE > const &sle, AccountID const &account, beast::Journal j)
 
static NotTEC preflight(PreflightContext const &ctx)
 
static TER preclaim(PreclaimContext const &ctx)
 
static bool checkExtraFeatures(PreflightContext const &ctx)
 
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
 
static TER deleteOracle(ApplyView &view, std::shared_ptr< SLE > const &sle, AccountID const &account, beast::Journal j)
 
static TER removeFromLedger(ApplyView &view, uint256 const &delIndex, beast::Journal j)
 
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
 
virtual std::optional< key_type > succ(key_type const &key, std::optional< key_type > const &last=std::nullopt) const =0
Return the key of the next state item.
 
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
 
LedgerIndex seq() const
Returns the sequence number of the base ledger.
 
virtual Rules const & rules() const =0
Returns the tx processing rules.
 
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
 
bool isFieldPresent(SField const &field) const
 
static TER removeFromLedger(Application &app, ApplyView &view, AccountID const &account, beast::Journal j)
 
static XRPAmount calculateOwnerReserveFee(ReadView const &view, STTx const &tx)
 
static TER ticketDelete(ApplyView &view, AccountID const &account, uint256 const &ticketIndex, beast::Journal j)
 
NotTEC checkFields(STTx const &tx, beast::Journal j)
 
TER deleteSLE(ApplyView &view, std::shared_ptr< SLE > const &sleCredential, beast::Journal j)
 
TER valid(STTx const &tx, ReadView const &view, AccountID const &src, beast::Journal j)
 
Keylet child(uint256 const &key) noexcept
Any item that can be in an owner dir.
 
Keylet account(AccountID const &id) noexcept
AccountID root.
 
Keylet nftpage_min(AccountID const &owner)
NFT page keylets.
 
Keylet nftpage_max(AccountID const &owner)
A keylet for the owner's last possible NFT page.
 
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
 
Keylet depositPreauth(AccountID const &owner, AccountID const &preauthorized) noexcept
A DepositPreauth.
 
bool deleteTokenOffer(ApplyView &view, std::shared_ptr< SLE > const &offer)
Deletes the given token offer.
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
 
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
 
std::size_t constexpr maxDeletableDirEntries
The maximum number of owner directory entries for account to be deletable.
 
static TER removeSignersFromLedger(Application &app, ApplyView &view, Keylet const &accountKeylet, Keylet const &ownerDirKeylet, Keylet const &signerListKeylet, beast::Journal j)
 
TER verifyDepositPreauth(STTx const &tx, ApplyView &view, AccountID const &src, AccountID const &dst, std::shared_ptr< SLE > const &sleDst, beast::Journal j)
 
bool dirIsEmpty(ReadView const &view, Keylet const &k)
Returns true if the directory is empty.
 
TER cleanupOnAccountDelete(ApplyView &view, Keylet const &ownerDirKeylet, EntryDeleter const &deleter, beast::Journal j, std::optional< std::uint16_t > maxNodesToDelete=std::nullopt)
Cleanup owner directory entries on account delete.
 
bool isTesSuccess(TER x) noexcept
 
bool cdirFirst(ReadView const &view, uint256 const &root, std::shared_ptr< SLE const > &page, unsigned int &index, uint256 &entry)
Returns the first entry in the directory, advancing the index.
 
std::string to_string(base_uint< Bits, Tag > const &a)
 
LedgerEntryType
Identifiers for on-ledger objects.
 
bool cdirNext(ReadView const &view, uint256 const &root, std::shared_ptr< SLE const > &page, unsigned int &index, uint256 &entry)
Returns the next entry in the directory, advancing the index.
 
TERSubset< CanCvtToTER > TER
 
TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
 
A pair of SHAMap key and LedgerEntryType.
 
State information when determining if a tx is likely to claim a fee.
 
State information when preflighting a tx.