Struct ethcore_miner::pool::TransactionQueue
source · [−]pub struct TransactionQueue { /* private fields */ }
Expand description
Ethereum Transaction Queue
Responsible for:
- verifying incoming transactions
- maintaining a pool of verified transactions.
- returning an iterator for transactions that are ready to be included in block (pending)
Implementations
sourceimpl TransactionQueue
impl TransactionQueue
sourcepub fn new(
limits: Options,
verification_options: Options,
strategy: PrioritizationStrategy
) -> Self
pub fn new(
limits: Options,
verification_options: Options,
strategy: PrioritizationStrategy
) -> Self
Create new queue with given pool limits and initial verification options.
sourcepub fn update_scoring(&self, block_base_fee: U256)
pub fn update_scoring(&self, block_base_fee: U256)
If latest block has different base fee than it’s parent, then transaction pool scoring needs to be updated.
sourcepub fn set_verifier_options(&self, options: Options)
pub fn set_verifier_options(&self, options: Options)
Update verification options
Some parameters of verification may vary in time (like block gas limit or minimal gas price).
sourcepub fn set_in_chain_checker<F>(&self, f: F) where
F: Fn(&H256) -> bool + Send + Sync + 'static,
pub fn set_in_chain_checker<F>(&self, f: F) where
F: Fn(&H256) -> bool + Send + Sync + 'static,
Sets the in-chain transaction checker for pool listener.
sourcepub fn import<C: Client + NonceClient + BalanceClient + Clone>(
&self,
client: C,
transactions: Vec<Transaction>
) -> Vec<Result<(), Error>>
pub fn import<C: Client + NonceClient + BalanceClient + Clone>(
&self,
client: C,
transactions: Vec<Transaction>
) -> Vec<Result<(), Error>>
Import a set of transactions to the pool.
Given blockchain and state access (Client) verifies and imports transactions to the pool.
sourcepub fn all_transactions(&self) -> Vec<Arc<VerifiedTransaction>>
pub fn all_transactions(&self) -> Vec<Arc<VerifiedTransaction>>
Returns all transactions in the queue without explicit ordering.
sourcepub fn all_transaction_hashes(&self) -> Vec<H256>
pub fn all_transaction_hashes(&self) -> Vec<H256>
Returns all transaction hashes in the queue without explicit ordering.
sourcepub fn pending_hashes<N>(&self, nonce: N) -> BTreeSet<H256> where
N: Fn(&Address) -> Option<U256>,
pub fn pending_hashes<N>(&self, nonce: N) -> BTreeSet<H256> where
N: Fn(&Address) -> Option<U256>,
Computes unordered set of pending hashes.
Since strict nonce-checking is not required, you may get some false positive future transactions as well.
sourcepub fn pending<C>(
&self,
client: C,
settings: PendingSettings
) -> Vec<Arc<VerifiedTransaction>> where
C: NonceClient,
pub fn pending<C>(
&self,
client: C,
settings: PendingSettings
) -> Vec<Arc<VerifiedTransaction>> where
C: NonceClient,
Returns current pending transactions ordered by priority.
NOTE: This may return a cached version of pending transaction set.
Re-computing the pending set is possible with #collect_pending
method,
but be aware that it’s a pretty expensive operation.
sourcepub fn pending_filtered<C>(
&self,
client: C,
settings: PendingSettings,
filter: &TransactionFilter
) -> Vec<Arc<VerifiedTransaction>> where
C: NonceClient,
pub fn pending_filtered<C>(
&self,
client: C,
settings: PendingSettings,
filter: &TransactionFilter
) -> Vec<Arc<VerifiedTransaction>> where
C: NonceClient,
Returns current pending transactions filtered.
Different to the pending() method, this one does not cache.
sourcepub fn collect_pending<C, F, T>(
&self,
client: C,
includable_boundary: U256,
block_number: u64,
current_timestamp: u64,
nonce_cap: Option<U256>,
collect: F
) -> T where
C: NonceClient,
F: FnOnce(PendingIterator<'_, VerifiedTransaction, (Condition, State<C>), NonceAndGasPrice, (LocalTransactionsList, (Notifier, Logger))>) -> T,
pub fn collect_pending<C, F, T>(
&self,
client: C,
includable_boundary: U256,
block_number: u64,
current_timestamp: u64,
nonce_cap: Option<U256>,
collect: F
) -> T where
C: NonceClient,
F: FnOnce(PendingIterator<'_, VerifiedTransaction, (Condition, State<C>), NonceAndGasPrice, (LocalTransactionsList, (Notifier, Logger))>) -> T,
Collect pending transactions.
NOTE This is re-computing the pending set and it might be expensive to do so.
Prefer using cached pending set using #pending
method.
sourcepub fn cull<C: NonceClient + Clone>(&self, client: C)
pub fn cull<C: NonceClient + Clone>(&self, client: C)
t_nb 10.5.1 Culls all stalled transactions from the pool.
sourcepub fn next_nonce<C: NonceClient>(
&self,
client: C,
address: &Address
) -> Option<U256>
pub fn next_nonce<C: NonceClient>(
&self,
client: C,
address: &Address
) -> Option<U256>
Returns next valid nonce for given sender
or None
if there are no pending transactions from that sender.
sourcepub fn find(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>>
pub fn find(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>>
Retrieve a transaction from the pool.
Given transaction hash looks up that transaction in the pool
and returns a shared pointer to it or None
if it’s not present.
sourcepub fn remove<'a, T: IntoIterator<Item = &'a H256>>(
&self,
hashes: T,
is_invalid: bool
) -> Vec<Option<Arc<VerifiedTransaction>>>
pub fn remove<'a, T: IntoIterator<Item = &'a H256>>(
&self,
hashes: T,
is_invalid: bool
) -> Vec<Option<Arc<VerifiedTransaction>>>
Remove a set of transactions from the pool.
Given an iterator of transaction hashes removes them from the pool. That method should be used if invalid transactions are detected or you want to cancel a transaction.
sourcepub fn penalize<'a, T: IntoIterator<Item = &'a Address>>(&self, senders: T)
pub fn penalize<'a, T: IntoIterator<Item = &'a Address>>(&self, senders: T)
Penalize given senders.
sourcepub fn current_worst_gas_price(&self) -> U256
pub fn current_worst_gas_price(&self) -> U256
Returns gas price of currently the worst transaction in the pool.
sourcepub fn current_worst_effective_priority_fee(&self) -> U256
pub fn current_worst_effective_priority_fee(&self) -> U256
Returns effective priority fee gas price of currently the worst transaction in the pool. If the worst transaction has zero gas price, the minimal gas price is returned.
sourcepub fn has_local_pending_transactions(&self) -> bool
pub fn has_local_pending_transactions(&self) -> bool
Check if there are any local transactions in the pool.
Returns true
if there are any transactions in the pool
that has been marked as local.
Local transactions are the ones from accounts managed by this node
and transactions submitted via local RPC (eth_sendRawTransaction
)
sourcepub fn local_transactions(&self) -> BTreeMap<H256, Status>
pub fn local_transactions(&self) -> BTreeMap<H256, Status>
Returns status of recently seen local transactions.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for TransactionQueue
impl Send for TransactionQueue
impl Sync for TransactionQueue
impl Unpin for TransactionQueue
impl !UnwindSafe for TransactionQueue
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more