20 #include <ripple/app/tx/impl/DeleteAccount.h>
21 #include <ripple/app/tx/impl/DepositPreauth.h>
22 #include <ripple/app/tx/impl/SetSignerList.h>
23 #include <ripple/basics/FeeUnits.h>
24 #include <ripple/basics/Log.h>
25 #include <ripple/basics/mulDiv.h>
26 #include <ripple/ledger/View.h>
27 #include <ripple/protocol/Feature.h>
28 #include <ripple/protocol/Indexes.h>
29 #include <ripple/protocol/TxFlags.h>
30 #include <ripple/protocol/st.h>
62 mulDiv(fees.increment, safe_cast<FeeUnit64>(fees.units), fees.base)};
63 if (mulDivResult.first)
64 return mulDivResult.second;
73 using DeleterFuncPtr =
TER (*)(
107 removeTicketFromLedger(
119 removeDepositPreauthFromLedger(
143 return removeTicketFromLedger;
145 return removeDepositPreauthFromLedger;
197 unsigned int uDirEntry{0};
201 ctx.
view, ownerDirKeylet.key, sleDirNode, uDirEntry, dirEntry))
216 <<
"DeleteAccount: directory node in ledger " << ctx.
view.
seq()
217 <<
" has index to object that is missing: "
225 if (!nonObligationDeleter(nodeType))
234 ctx.
view, ownerDirKeylet.key, sleDirNode, uDirEntry, dirEntry));
254 unsigned int uDirEntry{0};
257 if (
view().exists(ownerDirKeylet) &&
258 dirFirst(
view(), ownerDirKeylet.key, sleDirNode, uDirEntry, dirEntry))
268 <<
"DeleteAccount: Directory node in ledger "
269 <<
view().
seq() <<
" has index to object that is missing: "
277 if (
auto deleter = nonObligationDeleter(nodeType))
287 assert(!
"Undeletable entry should be found in preclaim.");
289 <<
"DeleteAccount undeletable item not found in preclaim.";
309 assert(uDirEntry == 1);
313 <<
"DeleteAccount iterator re-validation failed.";
319 view(), ownerDirKeylet.key, sleDirNode, uDirEntry, dirEntry));
331 if (
view().exists(ownerDirKeylet) && !
view().emptyDirDelete(ownerDirKeylet))
333 JLOG(
j_.
error()) <<
"DeleteAccount cannot delete root dir node of "
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
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.
bool dirNext(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
@ ltTICKET
A ledger object which describes a ticket.
A pair of SHAMap key and LedgerEntryType.
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
const SF_ACCOUNT sfDestination
const SF_UINT32 sfSequence
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.
@ ltSIGNER_LIST
A ledger object which contains a signer list for an account.
const uint256 featureDepositAuth
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
static NotTEC preflight(PreflightContext const &ctx)
Keylet child(uint256 const &key) noexcept
Any item that can be in an owner dir.
virtual void update(std::shared_ptr< SLE > const &sle)=0
Indicate changes to a peeked SLE.
static TER preclaim(PreclaimContext const &ctx)
static TER ticketDelete(ApplyView &view, AccountID const &account, uint256 const &ticketIndex, beast::Journal j)
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
Writeable view to a ledger, for applying a transaction.
const uint256 featureDeletableAccounts
static FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
static TER removeFromLedger(Application &app, ApplyView &view, uint256 const &delIndex, beast::Journal j)
@ ltOFFER
A ledger object which describes an offer on the DEX.
Reflects the fee settings for a particular ledger.
Keylet account(AccountID const &id) noexcept
AccountID root.
TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
TERSubset< CanCvtToTER > TER
static constexpr std::int32_t maxDeletableDirEntries
@ ltDEPOSIT_PREAUTH
A ledger object which describes a deposit preauthorization.
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
std::uint32_t getFlags() const
static TER removeFromLedger(Application &app, ApplyView &view, AccountID const &account, beast::Journal j)
static FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
void deliver(STAmount const &amount)
Sets the DeliveredAmount field in the metadata.
A generic endpoint for log messages.
bool enabled(uint256 const &id) const
Returns true if a feature is enabled.
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
State information when determining if a tx is likely to claim a fee.
bool dirIsEmpty(ReadView const &view, Keylet const &k)
Returns true if the directory is empty.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool dirFirst(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
const SF_UINT16 sfLedgerEntryType
LedgerEntryType
Identifiers for on-ledger objects.
LedgerIndex seq() const
Returns the sequence number of the base ledger.
virtual Rules const & rules() const =0
Returns the tx processing rules.
const SF_UINT32 sfDestinationTag
const SF_AMOUNT sfBalance
static TER removeSignersFromLedger(Application &app, ApplyView &view, Keylet const &accountKeylet, Keylet const &ownerDirKeylet, Keylet const &signerListKeylet, beast::Journal j)
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
const SF_ACCOUNT sfAccount
std::pair< bool, Dest > mulDiv(Source1 value, Dest mul, Source2 div)
const std::uint32_t tfUniversalMask
State information when preflighting a tx.
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.
Keylet depositPreauth(AccountID const &owner, AccountID const &preauthorized) noexcept
A DepositPreauth.
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
TERSubset< CanCvtToNotTEC > NotTEC