rippled
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ripple::TxQ::MaybeTx Class Reference

Represents a transaction in the queue which may be applied later to the open ledger. More...

Collaboration diagram for ripple::TxQ::MaybeTx:
Collaboration graph
[legend]

Public Member Functions

 MaybeTx (std::shared_ptr< STTx const > const &, TxID const &txID, FeeLevel64 feeLevel, ApplyFlags const flags, PreflightResult const &pfresult)
 Constructor. More...
 
std::pair< TER, bool > apply (Application &app, OpenView &view, beast::Journal j)
 Attempt to apply the queued transaction to the open ledger. More...
 
TxConsequences const & consequences () const
 Potential TxConsequences of applying this transaction to the open ledger. More...
 
TxDetails getTxDetails () const
 Return a TxDetails based on contained information. More...
 

Public Attributes

boost::intrusive::set_member_hook byFeeListHook
 Used by the TxQ::FeeHook and TxQ::FeeMultiSet below to put each MaybeTx object into more than one set without copies, pointers, etc. More...
 
std::shared_ptr< STTx const > txn
 The complete transaction. More...
 
const FeeLevel64 feeLevel
 Computed fee level that the transaction will pay. More...
 
const TxID txID
 Transaction ID. More...
 
const AccountID account
 Account submitting the transaction. More...
 
const std::optional< LedgerIndexlastValid
 Expiration ledger for the transaction (sfLastLedgerSequence field). More...
 
const SeqProxy seqProxy
 Transaction SeqProxy number (sfSequence or sfTicketSequence field). More...
 
int retriesRemaining
 A transaction at the front of the queue will be given several attempts to succeed before being dropped from the queue. More...
 
const ApplyFlags flags
 Flags provided to apply. More...
 
std::optional< TERlastResult
 If the transactor attempted to apply the transaction to the open ledger from the queue and failed, then this is the transactor result from the last attempt. More...
 
std::optional< PreflightResult const > pfresult
 Cached result of the preflight operation. More...
 

Static Public Attributes

static constexpr int retriesAllowed = 10
 Starting retry count for newly queued transactions. More...
 

Detailed Description

Represents a transaction in the queue which may be applied later to the open ledger.

Definition at line 509 of file TxQ.h.

Constructor & Destructor Documentation

◆ MaybeTx()

ripple::TxQ::MaybeTx::MaybeTx ( std::shared_ptr< STTx const > const &  txn_,
TxID const &  txID,
FeeLevel64  feeLevel,
ApplyFlags const  flags,
PreflightResult const &  pfresult 
)

Constructor.

Definition at line 269 of file TxQ.cpp.

Member Function Documentation

◆ apply()

std::pair< TER, bool > ripple::TxQ::MaybeTx::apply ( Application app,
OpenView view,
beast::Journal  j 
)

Attempt to apply the queued transaction to the open ledger.

Definition at line 288 of file TxQ.cpp.

◆ consequences()

TxConsequences const& ripple::TxQ::MaybeTx::consequences ( ) const

Potential TxConsequences of applying this transaction to the open ledger.

Definition at line 594 of file TxQ.h.

◆ getTxDetails()

TxDetails ripple::TxQ::MaybeTx::getTxDetails ( ) const

Return a TxDetails based on contained information.

Definition at line 601 of file TxQ.h.

Member Data Documentation

◆ byFeeListHook

boost::intrusive::set_member_hook ripple::TxQ::MaybeTx::byFeeListHook

Used by the TxQ::FeeHook and TxQ::FeeMultiSet below to put each MaybeTx object into more than one set without copies, pointers, etc.

Definition at line 515 of file TxQ.h.

◆ txn

std::shared_ptr<STTx const> ripple::TxQ::MaybeTx::txn

The complete transaction.

Definition at line 518 of file TxQ.h.

◆ feeLevel

const FeeLevel64 ripple::TxQ::MaybeTx::feeLevel

Computed fee level that the transaction will pay.

Definition at line 521 of file TxQ.h.

◆ txID

const TxID ripple::TxQ::MaybeTx::txID

Transaction ID.

Definition at line 523 of file TxQ.h.

◆ account

const AccountID ripple::TxQ::MaybeTx::account

Account submitting the transaction.

Definition at line 525 of file TxQ.h.

◆ lastValid

const std::optional<LedgerIndex> ripple::TxQ::MaybeTx::lastValid

Expiration ledger for the transaction (sfLastLedgerSequence field).

Definition at line 528 of file TxQ.h.

◆ seqProxy

const SeqProxy ripple::TxQ::MaybeTx::seqProxy

Transaction SeqProxy number (sfSequence or sfTicketSequence field).

Definition at line 531 of file TxQ.h.

◆ retriesRemaining

int ripple::TxQ::MaybeTx::retriesRemaining

A transaction at the front of the queue will be given several attempts to succeed before being dropped from the queue.

If dropped, one of the account's penalty flags will be set, and other transactions may have their retriesRemaining forced down as part of the penalty.

Definition at line 540 of file TxQ.h.

◆ flags

const ApplyFlags ripple::TxQ::MaybeTx::flags

Flags provided to apply.

If the transaction is later attempted with different flags, it will need to be preflighted again.

Definition at line 544 of file TxQ.h.

◆ lastResult

std::optional<TER> ripple::TxQ::MaybeTx::lastResult

If the transactor attempted to apply the transaction to the open ledger from the queue and failed, then this is the transactor result from the last attempt.

Should never be a tec, tef, tem, or tesSUCCESS, because those results cause the transaction to be removed from the queue.

Definition at line 551 of file TxQ.h.

◆ pfresult

std::optional<PreflightResult const> ripple::TxQ::MaybeTx::pfresult

Cached result of the preflight operation.

Because preflight is expensive, minimize the number of times it needs to be done.

Invariant
pfresult is never allowed to be empty. The std::optional is leveraged to allow emplaced construction and replacement without a copy assignment operation.

Definition at line 560 of file TxQ.h.

◆ retriesAllowed

constexpr int ripple::TxQ::MaybeTx::retriesAllowed = 10
staticconstexpr

Starting retry count for newly queued transactions.

In TxQ::accept, the required fee level may be low enough that this transaction gets a chance to apply to the ledger, but it may get a retry ter result for another reason (eg. insufficient balance). When that happens, the transaction is left in the queue to try again later, but it shouldn't be allowed to fail indefinitely. The number of failures allowed is essentially arbitrary. It should be large enough to allow temporary failures to clear up, but small enough that the queue doesn't fill up with stale transactions which prevent lower fee level transactions from queuing.

Definition at line 576 of file TxQ.h.