rippled
Public Member Functions | List of all members
ripple::TxQ::OrderCandidates Class Reference

Used for sorting MaybeTx. More...

Public Member Functions

 OrderCandidates ()=default
 Default constructor. More...
 
bool operator() (const MaybeTx &lhs, const MaybeTx &rhs) const
 Sort MaybeTx by feeLevel descending, then by pseudo-randomized transaction ID ascending. More...
 

Detailed Description

Used for sorting MaybeTx.

Definition at line 628 of file TxQ.h.

Constructor & Destructor Documentation

◆ OrderCandidates()

ripple::TxQ::OrderCandidates::OrderCandidates ( )
explicitdefault

Default constructor.

Member Function Documentation

◆ operator()()

bool ripple::TxQ::OrderCandidates::operator() ( const MaybeTx lhs,
const MaybeTx rhs 
) const

Sort MaybeTx by feeLevel descending, then by pseudo-randomized transaction ID ascending.

The transaction queue is ordered such that transactions paying a higher fee are in front of transactions paying a lower fee, giving them an opportunity to be processed into the open ledger first. Within transactions paying the same fee, order by the arbitrary but consistent pseudo-randomized transaction ID. The ID is pseudo-randomized by XORing it with the open ledger's parent hash, which is deterministic, but unpredictable. This allows validators to build similar queues in the same order, and thus have more similar initial proposals.

Definition at line 650 of file TxQ.h.