rippled
Loading...
Searching...
No Matches
CreateTicket.h
1#pragma once
2
3#include <xrpld/app/tx/detail/Transactor.h>
4
5namespace xrpl {
6
7class CreateTicket : public Transactor
8{
9public:
11
12 constexpr static std::uint32_t minValidCount = 1;
13
14 // A note on how the maxValidCount was determined. The goal is for
15 // a single TicketCreate transaction to not use more compute power than
16 // a single compute-intensive Payment.
17 //
18 // Timing was performed using a MacBook Pro laptop and a release build
19 // with asserts off. 20 measurements were taken of each of the Payment
20 // and TicketCreate transactions and averaged to get timings.
21 //
22 // For the example compute-intensive Payment a Discrepancy unit test
23 // unit test Payment with 3 paths was chosen. With all the latest
24 // amendments enabled, that Payment::doApply() operation took, on
25 // average, 1.25 ms.
26 //
27 // Using that same test set up creating 250 Tickets in a single
28 // CreateTicket::doApply() in a unit test took, on average, 1.21 ms.
29 //
30 // So, for the moment, a single transaction creating 250 Tickets takes
31 // about the same compute time as a single compute-intensive payment.
32 //
33 // October 2018.
34 constexpr static std::uint32_t maxValidCount = 250;
35
36 // The maximum number of Tickets an account may hold. If a
37 // TicketCreate would cause an account to own more than this many
38 // tickets, then the TicketCreate will fail.
39 //
40 // The number was chosen arbitrarily and is an effort toward avoiding
41 // ledger-stuffing with Tickets.
42 constexpr static std::uint32_t maxTicketThreshold = 250;
43
44 explicit CreateTicket(ApplyContext& ctx) : Transactor(ctx)
45 {
46 }
47
48 static TxConsequences
50
52 static NotTEC
53 preflight(PreflightContext const& ctx);
54
56 static TER
57 preclaim(PreclaimContext const& ctx);
58
60 TER
61 doApply() override;
62};
63
65
66} // namespace xrpl
State information when applying a tx.
CreateTicket(ApplyContext &ctx)
static TER preclaim(PreclaimContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
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 minValidCount
static constexpr std::uint32_t maxTicketThreshold
static constexpr std::uint32_t maxValidCount
TER doApply() override
Precondition: fee collection is likely.
static constexpr ConsequencesFactoryType ConsequencesFactory
Class describing the consequences to the account of applying a transaction if the transaction consume...
Definition applySteps.h:37
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
State information when determining if a tx is likely to claim a fee.
Definition Transactor.h:53
State information when preflighting a tx.
Definition Transactor.h:15