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