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>
58 auto const id = ctx.
tx[sfAccount];
66 (*sleAccountRoot)[~sfTicketCount].value_or(0u);
96 sleAccountRoot->getFieldU32(sfOwnerCount) + ticketCount);
108 std::uint32_t const firstTicketSeq = (*sleAccountRoot)[sfSequence];
113 txSeq != 0 && txSeq != (firstTicketSeq - 1))
120 SLE::pointer sleTicket = std::make_shared<SLE>(ticketKeylet);
122 sleTicket->setAccountID(sfAccount,
account_);
123 sleTicket->setFieldU32(sfTicketSequence, curTicketSeq);
132 <<
": " << (page ?
"success" :
"failure");
137 sleTicket->setFieldU64(sfOwnerNode, *page);
142 (*(sleAccountRoot))[~sfTicketCount].value_or(0u);
144 sleAccountRoot->setFieldU32(sfTicketCount, oldTicketCount + ticketCount);
151 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.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
std::uint32_t getFlags() const
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.
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
static bool adjustOwnerCount(ApplyContext &ctx, int count)
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
@ tecINSUFFICIENT_RESERVE
std::string to_string(base_uint< Bits, Tag > const &a)
constexpr std::uint32_t tfUniversalMask
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.