Struct vapcore_miner::pool::TransactionQueue [−][src]
Vapory 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
impl TransactionQueue
[src]
pub fn new(
limits: Options,
verification_options: Options,
strategy: PrioritizationStrategy
) -> Self
[src]
limits: Options,
verification_options: Options,
strategy: PrioritizationStrategy
) -> Self
Create new queue with given pool limits and initial verification options.
pub fn set_verifier_options(&self, options: Options)
[src]
Update verification options
Some parameters of verification may vary in time (like block gas limit or minimal gas price).
pub fn set_in_chain_checker<F>(&self, f: F) where
F: Fn(&H256) -> bool + Send + Sync + 'static,
[src]
F: Fn(&H256) -> bool + Send + Sync + 'static,
Sets the in-chain transaction checker for pool listener.
pub fn import<T: IntoIterator<Item = Transaction>, C: Client + NonceClient + Clone>(
&self,
client: C,
transactions: T
) -> Vec<Result<(), Error>>
[src]
&self,
client: C,
transactions: T
) -> Vec<Result<(), Error>>
Import a set of transactions to the pool.
Given blockchain and state access (Client) verifies and imports transactions to the pool.
pub fn all_transactions(&self) -> Vec<Arc<VerifiedTransaction>>
[src]
Returns all transactions in the queue without explicit ordering.
pub fn all_transaction_hashes(&self) -> Vec<H256>
[src]
Returns all transaction hashes in the queue without explicit ordering.
pub fn pending_hashes<N>(&self, nonce: N) -> BTreeSet<H256> where
N: Fn(&Address) -> Option<U256>,
[src]
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.
pub fn pending<C>(
&self,
client: C,
settings: PendingSettings
) -> Vec<Arc<VerifiedTransaction>> where
C: NonceClient,
[src]
&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.
pub fn collect_pending<C, F, T>(
&self,
client: C,
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, (TransactionsPoolNotifier, Logger))>) -> T,
[src]
&self,
client: C,
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, (TransactionsPoolNotifier, 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.
pub fn cull<C: NonceClient + Clone>(&self, client: C)
[src]
Culls all stalled transactions from the pool.
pub fn next_nonce<C: NonceClient>(
&self,
client: C,
address: &Address
) -> Option<U256>
[src]
&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.
pub fn find(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>>
[src]
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.
pub fn remove<'a, T: IntoIterator<Item = &'a H256>>(
&self,
hashes: T,
is_invalid: bool
) -> Vec<Option<Arc<VerifiedTransaction>>>
[src]
&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.
pub fn clear(&self)
[src]
Clear the entire pool.
pub fn penalize<'a, T: IntoIterator<Item = &'a Address>>(&self, senders: T)
[src]
Penalize given senders.
pub fn current_worst_gas_price(&self) -> U256
[src]
Returns gas price of currently the worst transaction in the pool.
pub fn status(&self) -> Status
[src]
Returns a status of the queue.
pub fn has_local_pending_transactions(&self) -> bool
[src]
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 (vap_sendRawTransaction
)
pub fn local_transactions(&self) -> BTreeMap<H256, Status>
[src]
Returns status of recently seen local transactions.
pub fn add_pending_listener(&self, f: UnboundedSender<Arc<Vec<H256>>>)
[src]
Add a listener to be notified about all transactions the pool
pub fn add_full_listener(&self, f: UnboundedSender<Arc<Vec<(H256, TxStatus)>>>)
[src]
Add a listener to be notified about all transactions the pool
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> MaybeDebug for T where
T: Debug,
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
T: Debug,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,