rippled
|
Represents a transaction in the queue which may be applied later to the open ledger. More...
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< LedgerIndex > | lastValid |
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< TER > | 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. 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... | |
static LedgerHash | parentHashComp {} |
The hash of the parent ledger. More... | |
Represents a transaction in the queue which may be applied later to the open ledger.
ripple::TxQ::MaybeTx::MaybeTx | ( | std::shared_ptr< STTx const > const & | txn_, |
TxID const & | txID, | ||
FeeLevel64 | feeLevel, | ||
ApplyFlags const | flags, | ||
PreflightResult const & | pfresult | ||
) |
std::pair< TER, bool > ripple::TxQ::MaybeTx::apply | ( | Application & | app, |
OpenView & | view, | ||
beast::Journal | j | ||
) |
TxConsequences const& ripple::TxQ::MaybeTx::consequences | ( | ) | const |
Potential TxConsequences of applying this transaction to the open ledger.
TxDetails ripple::TxQ::MaybeTx::getTxDetails | ( | ) | const |
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.
std::shared_ptr<STTx const> ripple::TxQ::MaybeTx::txn |
const FeeLevel64 ripple::TxQ::MaybeTx::feeLevel |
const TxID ripple::TxQ::MaybeTx::txID |
Transaction ID.
const AccountID ripple::TxQ::MaybeTx::account |
const std::optional<LedgerIndex> ripple::TxQ::MaybeTx::lastValid |
const SeqProxy ripple::TxQ::MaybeTx::seqProxy |
Transaction SeqProxy number (sfSequence
or sfTicketSequence
field).
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.
const ApplyFlags ripple::TxQ::MaybeTx::flags |
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.
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.
pfresult
is never allowed to be empty. The std::optional
is leveraged to allow emplace
d construction and replacement without a copy assignment operation.
|
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.
|
static |
The hash of the parent ledger.
This is used to pseudo-randomize the transaction order when populating byFee_, by XORing it with the transaction hash (txID). Using a single static and doing the XOR operation every time was tested to be as fast or faster than storing the computed "sort key", and obviously uses less memory.