rippled
Loading...
Searching...
No Matches
xrpld
app
tx
detail
CreateTicket.h
1
#pragma once
2
3
#include <xrpld/app/tx/detail/Transactor.h>
4
5
namespace
xrpl
{
6
7
class
CreateTicket
:
public
Transactor
8
{
9
public
:
10
static
constexpr
ConsequencesFactoryType
ConsequencesFactory
{
Custom
};
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
49
makeTxConsequences
(
PreflightContext
const
& ctx);
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
64
using
TicketCreate
=
CreateTicket
;
65
66
}
// namespace xrpl
xrpl::ApplyContext
State information when applying a tx.
Definition
ApplyContext.h:17
xrpl::CreateTicket
Definition
CreateTicket.h:8
xrpl::CreateTicket::CreateTicket
CreateTicket(ApplyContext &ctx)
Definition
CreateTicket.h:44
xrpl::CreateTicket::preclaim
static TER preclaim(PreclaimContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
Definition
CreateTicket.cpp:28
xrpl::CreateTicket::makeTxConsequences
static TxConsequences makeTxConsequences(PreflightContext const &ctx)
Definition
CreateTicket.cpp:12
xrpl::CreateTicket::preflight
static NotTEC preflight(PreflightContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
Definition
CreateTicket.cpp:19
xrpl::CreateTicket::minValidCount
static constexpr std::uint32_t minValidCount
Definition
CreateTicket.h:12
xrpl::CreateTicket::maxTicketThreshold
static constexpr std::uint32_t maxTicketThreshold
Definition
CreateTicket.h:42
xrpl::CreateTicket::maxValidCount
static constexpr std::uint32_t maxValidCount
Definition
CreateTicket.h:34
xrpl::CreateTicket::doApply
TER doApply() override
Precondition: fee collection is likely.
Definition
CreateTicket.cpp:54
xrpl::CreateTicket::ConsequencesFactory
static constexpr ConsequencesFactoryType ConsequencesFactory
Definition
CreateTicket.h:10
xrpl::TERSubset
Definition
TER.h:395
xrpl::Transactor
Definition
Transactor.h:106
xrpl::Transactor::ConsequencesFactoryType
ConsequencesFactoryType
Definition
Transactor.h:122
xrpl::Transactor::Custom
@ Custom
Definition
Transactor.h:122
xrpl::TxConsequences
Class describing the consequences to the account of applying a transaction if the transaction consume...
Definition
applySteps.h:37
std::uint32_t
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::PreclaimContext
State information when determining if a tx is likely to claim a fee.
Definition
Transactor.h:53
xrpl::PreflightContext
State information when preflighting a tx.
Definition
Transactor.h:15
Generated by
1.9.8