rippled
Loading...
Searching...
No Matches
xrpld
app
tx
detail
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
7
namespace
ripple
{
8
9
class
CreateTicket
:
public
Transactor
10
{
11
public
:
12
static
constexpr
ConsequencesFactoryType
ConsequencesFactory
{
Custom
};
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
51
makeTxConsequences
(
PreflightContext
const
& ctx);
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
66
using
TicketCreate
=
CreateTicket
;
67
68
}
// namespace ripple
69
70
#endif
ripple::ApplyContext
State information when applying a tx.
Definition
ApplyContext.h:18
ripple::CreateTicket
Definition
CreateTicket.h:10
ripple::CreateTicket::makeTxConsequences
static TxConsequences makeTxConsequences(PreflightContext const &ctx)
Definition
CreateTicket.cpp:11
ripple::CreateTicket::preflight
static NotTEC preflight(PreflightContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
Definition
CreateTicket.cpp:18
ripple::CreateTicket::maxValidCount
static constexpr std::uint32_t maxValidCount
Definition
CreateTicket.h:36
ripple::CreateTicket::preclaim
static TER preclaim(PreclaimContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
Definition
CreateTicket.cpp:28
ripple::CreateTicket::maxTicketThreshold
static constexpr std::uint32_t maxTicketThreshold
Definition
CreateTicket.h:44
ripple::CreateTicket::CreateTicket
CreateTicket(ApplyContext &ctx)
Definition
CreateTicket.h:46
ripple::CreateTicket::ConsequencesFactory
static constexpr ConsequencesFactoryType ConsequencesFactory
Definition
CreateTicket.h:12
ripple::CreateTicket::minValidCount
static constexpr std::uint32_t minValidCount
Definition
CreateTicket.h:14
ripple::CreateTicket::doApply
TER doApply() override
Precondition: fee collection is likely.
Definition
CreateTicket.cpp:56
ripple::TERSubset
Definition
TER.h:396
ripple::Transactor
Definition
Transactor.h:122
ripple::Transactor::ConsequencesFactoryType
ConsequencesFactoryType
Definition
Transactor.h:138
ripple::Transactor::Custom
@ Custom
Definition
Transactor.h:138
ripple::TxConsequences
Class describing the consequences to the account of applying a transaction if the transaction consume...
Definition
applySteps.h:39
std::uint32_t
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:6
ripple::PreclaimContext
State information when determining if a tx is likely to claim a fee.
Definition
Transactor.h:61
ripple::PreflightContext
State information when preflighting a tx.
Definition
Transactor.h:16
Generated by
1.9.8