20#include <xrpld/app/tx/detail/CreateTicket.h>
22#include <xrpl/basics/Log.h>
23#include <xrpl/protocol/Feature.h>
24#include <xrpl/protocol/Indexes.h>
25#include <xrpl/protocol/TxFlags.h>
49 auto const id = ctx.
tx[sfAccount];
57 (*sleAccountRoot)[~sfTicketCount].value_or(0u);
87 sleAccountRoot->getFieldU32(sfOwnerCount) + ticketCount);
99 std::uint32_t const firstTicketSeq = (*sleAccountRoot)[sfSequence];
104 txSeq != 0 && txSeq != (firstTicketSeq - 1))
113 sleTicket->setAccountID(sfAccount,
account_);
114 sleTicket->setFieldU32(sfTicketSequence, curTicketSeq);
123 <<
": " << (page ?
"success" :
"failure");
128 sleTicket->setFieldU64(sfOwnerNode, *page);
133 (*(sleAccountRoot))[~sfTicketCount].value_or(0u);
135 sleAccountRoot->setFieldU32(sfTicketCount, oldTicketCount + ticketCount);
142 sleAccountRoot->setFieldU32(sfSequence, firstTicketSeq + ticketCount);
A generic endpoint for log messages.
Stream trace() const
Severity stream access functions.
virtual beast::Journal journal(std::string const &name)=0
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.
static TxConsequences makeTxConsequences(PreflightContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
static constexpr std::uint32_t maxValidCount
static TER preclaim(PreclaimContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
static constexpr std::uint32_t maxTicketThreshold
TER doApply() override
Precondition: fee collection is likely.
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
SeqProxy getSeqProxy() const
constexpr bool isTicket() const
Class describing the consequences to the account of applying a transaction if the transaction consume...
Keylet account(AccountID const &id) noexcept
AccountID root.
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
static ticket_t const ticket
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
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)
@ tecINSUFFICIENT_RESERVE
std::string to_string(base_uint< Bits, Tag > const &a)
XRPAmount accountReserve(std::size_t ownerCount) const
Returns the account reserve given the owner count, in drops.
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.