Struct ethcore::miner::TransactionQueue
[−]
[src]
pub struct TransactionQueue { /* fields omitted */ }
TransactionQueue
implementation
Methods
impl TransactionQueue
[src]
fn new(strategy: PrioritizationStrategy) -> Self
Creates new instance of this Queue
fn with_limits(strategy: PrioritizationStrategy,
limit: usize,
gas_limit: U256,
tx_gas_limit: U256)
-> Self
limit: usize,
gas_limit: U256,
tx_gas_limit: U256)
-> Self
Create new instance of this Queue with specified limits
fn set_limit(&mut self, limit: usize)
Set the new limit for current
and future
queue.
fn limit(&self) -> usize
Returns current limit of transactions in the queue.
fn minimal_gas_price(&self) -> &U256
Get the minimal gas price.
fn set_minimal_gas_price(&mut self, min_gas_price: U256)
Sets new gas price threshold for incoming transactions. Any transaction already imported to the queue is not affected.
fn effective_minimum_gas_price(&self) -> U256
Get one more than the lowest gas price in the queue iff the pool is full, otherwise 0.
fn set_gas_limit(&mut self, gas_limit: U256)
Sets new gas limit. Transactions with gas slightly (GAS_LIMIT_HYSTERESIS
) above the limit won't be imported.
Any transaction already imported to the queue is not affected.
fn set_total_gas_limit(&mut self, gas_limit: U256)
Sets new total gas limit.
fn set_tx_gas_limit(&mut self, limit: U256)
Set the new limit for the amount of gas any individual transaction may have. Any transaction already imported to the queue is not affected.
fn status(&self) -> TransactionQueueStatus
Returns current status for this queue
fn add(&mut self,
tx: SignedTransaction,
origin: TransactionOrigin,
time: BlockNumber,
min_block: Option<BlockNumber>,
details_provider: &TransactionDetailsProvider)
-> Result<TransactionImportResult, Error>
tx: SignedTransaction,
origin: TransactionOrigin,
time: BlockNumber,
min_block: Option<BlockNumber>,
details_provider: &TransactionDetailsProvider)
-> Result<TransactionImportResult, Error>
Add signed transaction to queue to be verified and imported.
NOTE details_provider methods should be cheap to compute otherwise it might open up an attack vector.
fn cull(&mut self, sender: Address, client_nonce: U256)
Removes all transactions from particular sender up to (excluding) given client (state) nonce. Client (State) Nonce = next valid nonce for this sender.
fn remove_old<F>(&mut self, fetch_account: &F, current_time: BlockNumber) where F: Fn(&Address) -> AccountDetails
Checks the current nonce for all transactions' senders in the queue and removes the old transactions.
fn penalize(&mut self, transaction_hash: &H256)
Penalize transactions from sender of transaction with given hash. I.e. it should change the priority of the transaction in the queue.
NOTE: We need to penalize all transactions from particular sender to avoid breaking invariants in queue (ordered by nonces). Consecutive transactions from this sender would fail otherwise (because of invalid nonce).
fn remove_invalid<F>(&mut self, transaction_hash: &H256, fetch_nonce: &F) where F: Fn(&Address) -> U256
Removes invalid transaction identified by hash from queue. Assumption is that this transaction nonce is not related to client nonce, so transactions left in queue are processed according to client nonce.
If gap is introduced marks subsequent transactions as future
fn top_transactions(&self) -> Vec<SignedTransaction>
Returns top transactions from the queue ordered by priority.
fn top_transactions_at(&self, best_block: BlockNumber) -> Vec<SignedTransaction>
Returns top transactions from the queue ordered by priority.
fn pending_transactions(&self,
best_block: BlockNumber)
-> Vec<PendingTransaction>
best_block: BlockNumber)
-> Vec<PendingTransaction>
Return all ready transactions.
fn future_transactions(&self) -> Vec<PendingTransaction>
Return all ready transactions.
fn local_transactions(&self) -> &LinkedHashMap<H256, LocalTransactionStatus>
Returns local transactions (some of them might not be part of the queue anymore).
fn pending_hashes(&self) -> Vec<H256>
Returns hashes of all transactions from current, ordered by priority.
fn has_local_pending_transactions(&self) -> bool
Returns true if there is at least one local transaction pending
fn find(&self, hash: &H256) -> Option<SignedTransaction>
Finds transaction in the queue by hash (if any)
fn clear(&mut self)
Removes all elements (in any state) from the queue
fn last_nonce(&self, address: &Address) -> Option<U256>
Returns highest transaction nonce for given address.