pub struct IndexedPool {
applicable_by_fee: HashMap<FeeRate, HashSet<ValidCommandWithHash>>,
all_by_sender: HashMap<AccountId, (VecDeque<ValidCommandWithHash>, Amount)>,
all_by_fee: HashMap<FeeRate, HashSet<ValidCommandWithHash>>,
all_by_hash: HashMap<TransactionHash, ValidCommandWithHash>,
transactions_with_expiration: HashMap<Slot, HashSet<ValidCommandWithHash>>,
size: usize,
pub config: IndexedPoolConfig,
}Fields§
§applicable_by_fee: HashMap<FeeRate, HashSet<ValidCommandWithHash>>Transactions valid against the current ledger, indexed by fee per weight unit.
all_by_sender: HashMap<AccountId, (VecDeque<ValidCommandWithHash>, Amount)>All pending transactions along with the total currency required to execute them – plus any currency spent from this account by transactions from other accounts – indexed by sender account. Ordered by nonce inside the accounts.
all_by_fee: HashMap<FeeRate, HashSet<ValidCommandWithHash>>All transactions in the pool indexed by fee per weight unit.
all_by_hash: HashMap<TransactionHash, ValidCommandWithHash>§transactions_with_expiration: HashMap<Slot, HashSet<ValidCommandWithHash>>Only transactions that have an expiry
size: usize§config: IndexedPoolConfigImplementations§
Source§impl IndexedPool
impl IndexedPool
fn new(constants: &ConsensusConstants) -> Self
fn size(&self) -> usize
fn min_fee(&self) -> Option<FeeRate>
fn member(&self, cmd: &ValidCommandWithHash) -> bool
pub fn get(&self, hash: &TransactionHash) -> Option<&ValidCommandWithHash>
fn check_expiry( &self, global_slot_since_genesis: Slot, cmd: &UserCommand, ) -> Result<(), CommandError>
Sourcefn map_set_insert<K, V>(map: &mut HashMap<K, HashSet<V>>, key: K, value: V)
fn map_set_insert<K, V>(map: &mut HashMap<K, HashSet<V>>, key: K, value: V)
Insert in a HashMap<_, HashSet<_>>
Sourcefn map_set_remove<K, V>(map: &mut HashMap<K, HashSet<V>>, key: K, value: &V)
fn map_set_remove<K, V>(map: &mut HashMap<K, HashSet<V>>, key: K, value: &V)
Remove in a HashMap<_, HashSet<_>>
fn update_expiration_map(&mut self, cmd: ValidCommandWithHash, is_add: bool)
fn remove_from_expiration_exn(&mut self, cmd: ValidCommandWithHash)
fn add_to_expiration(&mut self, cmd: ValidCommandWithHash)
Sourcefn remove_applicable_exn(&mut self, cmd: &ValidCommandWithHash)
fn remove_applicable_exn(&mut self, cmd: &ValidCommandWithHash)
Remove a command from the applicable_by_fee field. This may break an invariant.
fn make_queue<T>() -> VecDeque<T>
fn add_from_backtrack( &mut self, global_slot_since_genesis: Slot, current_global_slot: Slot, cmd: ValidCommandWithHash, ) -> Result<(), CommandError>
fn update_add( &mut self, cmd: ValidCommandWithHash, fee_per_wu: FeeRate, add_to_applicable_by_fee: bool, )
Sourcefn update_remove_all_by_fee_and_hash_and_expiration<I>(&mut self, cmds: I)where
I: IntoIterator<Item = ValidCommandWithHash>,
fn update_remove_all_by_fee_and_hash_and_expiration<I>(&mut self, cmds: I)where
I: IntoIterator<Item = ValidCommandWithHash>,
Remove a command from the all_by_fee and all_by_hash fields, and decrement size. This may break an invariant.
fn update_remove_from_applicable_by_fee( &mut self, fee_per_wu: FeeRate, command: &ValidCommandWithHash, )
fn remove_with_dependents_exn( &mut self, cmd: &ValidCommandWithHash, ) -> Result<VecDeque<ValidCommandWithHash>, CommandError>
fn remove_with_dependents_exn_impl( &self, cmd: &ValidCommandWithHash, by_sender: &mut SenderState, updates: &mut Vec<Update>, ) -> Result<VecDeque<ValidCommandWithHash>, CommandError>
fn apply_updates(&mut self, updates: Vec<Update>)
fn set_sender(&mut self, by_sender: SenderState)
fn add_from_gossip_exn( &mut self, global_slot_since_genesis: Slot, current_global_slot: Slot, cmd: &ValidCommandWithHash, current_nonce: Nonce, balance: Balance, ) -> Result<(ValidCommandWithHash, VecDeque<ValidCommandWithHash>), CommandError>
fn add_from_gossip_exn_impl( &self, global_slot_since_genesis: Slot, current_global_slot: Slot, cmd: &ValidCommandWithHash, current_nonce: Nonce, balance: Balance, by_sender: &mut SenderState, updates: &mut Vec<Update>, ) -> Result<(ValidCommandWithHash, VecDeque<ValidCommandWithHash>), CommandError>
fn expired_by_global_slot( &self, global_slot_since_genesis: Slot, ) -> Vec<ValidCommandWithHash> ⓘ
fn expired(&self, global_slot_since_genesis: Slot) -> Vec<ValidCommandWithHash> ⓘ
fn remove_expired( &mut self, global_slot_since_genesis: Slot, ) -> Result<Vec<ValidCommandWithHash>, CommandError>
fn remove_lowest_fee( &mut self, ) -> Result<VecDeque<ValidCommandWithHash>, CommandError>
Sourcefn drop_until_sufficient_balance(
queue: VecDeque<ValidCommandWithHash>,
currency_reserved: Amount,
current_balance: Amount,
) -> Result<(VecDeque<ValidCommandWithHash>, Amount, VecDeque<ValidCommandWithHash>), CommandError>
fn drop_until_sufficient_balance( queue: VecDeque<ValidCommandWithHash>, currency_reserved: Amount, current_balance: Amount, ) -> Result<(VecDeque<ValidCommandWithHash>, Amount, VecDeque<ValidCommandWithHash>), CommandError>
Drop commands from the end of the queue until the total currency consumed is <= the current balance.
fn revalidate<F>( &mut self, global_slot_since_genesis: Slot, kind: RevalidateKind<'_>, get_account: F, ) -> Result<Vec<ValidCommandWithHash>, CommandError>
Sourcefn list_includable_transactions(
&self,
limit: usize,
) -> Vec<ValidCommandWithHash> ⓘ
fn list_includable_transactions( &self, limit: usize, ) -> Vec<ValidCommandWithHash> ⓘ
Same as transactions, but does not modify the mempool
Sourcefn transactions(&mut self, limit: usize) -> Vec<ValidCommandWithHash> ⓘ
fn transactions(&mut self, limit: usize) -> Vec<ValidCommandWithHash> ⓘ
Returns a sequence of commands in the pool in descending fee order
Sourcefn get_all_transactions(&self) -> Vec<ValidCommandWithHash> ⓘ
fn get_all_transactions(&self) -> Vec<ValidCommandWithHash> ⓘ
Returns all the transactions in the pool
fn get_pending_amount_and_nonce( &self, ) -> HashMap<AccountId, (Option<Nonce>, Amount)>
Trait Implementations§
Source§impl Clone for IndexedPool
impl Clone for IndexedPool
Source§fn clone(&self) -> IndexedPool
fn clone(&self) -> IndexedPool
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IndexedPool
impl Debug for IndexedPool
Source§impl<'de> Deserialize<'de> for IndexedPool
impl<'de> Deserialize<'de> for IndexedPool
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for IndexedPool
impl RefUnwindSafe for IndexedPool
impl Send for IndexedPool
impl Sync for IndexedPool
impl Unpin for IndexedPool
impl UnsafeUnpin for IndexedPool
impl UnwindSafe for IndexedPool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.