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};
216 auto sleItem = ctx.
view.
read(itemKeylet);
221 <<
"DeleteAccount: directory node in ledger " << ctx.
view.
seq()
222 <<
" has index to object that is missing: "
230 if (!nonObligationDeleter(nodeType))
239 ctx.
view, ownerDirKeylet.key, sleDirNode, uDirEntry, dirEntry, ctx.
j));
259 unsigned int uDirEntry{0};
262 if (
view().exists(ownerDirKeylet) &&
264 view(), ownerDirKeylet.key, sleDirNode, uDirEntry, dirEntry,
j_))
270 auto sleItem =
view().
peek(itemKeylet);
275 <<
"DeleteAccount: Directory node in ledger "
276 <<
view().
seq() <<
" has index to object that is missing: "
284 if (
auto deleter = nonObligationDeleter(nodeType))
294 assert(!
"Undeletable entry should be found in preclaim.");
296 <<
"DeleteAccount undeletable item not found in preclaim.";
316 assert(uDirEntry == 1);
320 <<
"DeleteAccount iterator re-validation failed.";
326 view(), ownerDirKeylet.key, sleDirNode, uDirEntry, dirEntry,
j_));
338 if (
view().exists(ownerDirKeylet) && !
view().emptyDirDelete(ownerDirKeylet))
340 JLOG(
j_.
error()) <<
"DeleteAccount cannot delete root dir node of "
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
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
bool cdirNext(ReadView const &view, uint256 const &uRootIndex, std::shared_ptr< SLE const > &sleNode, unsigned int &uDirEntry, uint256 &uEntryIndex, beast::Journal j)
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.
const uint256 featureDepositAuth
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
static NotTEC preflight(PreflightContext const &ctx)
virtual void update(std::shared_ptr< SLE > const &sle)=0
Indicate changes to a peeked SLE.
std::string to_string(ListDisposition disposition)
bool dirNext(ApplyView &view, uint256 const &uRootIndex, std::shared_ptr< SLE > &sleNode, unsigned int &uDirEntry, uint256 &uEntryIndex, beast::Journal j)
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.
@ ltCHILD
Special type, anything not a directory This is used when the type in the Keylet is unknown,...
const uint256 featureDeletableAccounts
static FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
bool dirFirst(ApplyView &view, uint256 const &uRootIndex, std::shared_ptr< SLE > &sleNode, unsigned int &uDirEntry, uint256 &uEntryIndex, beast::Journal j)
Integers of any length that is a multiple of 32-bits.
static TER removeFromLedger(Application &app, ApplyView &view, uint256 const &delIndex, beast::Journal j)
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
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.
const SF_UINT16 sfLedgerEntryType
LedgerEntryType
Ledger entry types.
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)
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.
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
bool cdirFirst(ReadView const &view, uint256 const &uRootIndex, std::shared_ptr< SLE const > &sleNode, unsigned int &uDirEntry, uint256 &uEntryIndex, beast::Journal j)