Struct ethcore::miner::Miner
[−]
[src]
pub struct Miner { /* fields omitted */ }
Keeps track of transactions using priority queue and holds currently mined block. Handles preparing work for "work sealing" or seals "internally" if Engine does not require work.
Methods
impl Miner
[src]
impl Miner
pub fn add_work_listener(&self, notifier: Box<NotifyWork>)
[src]
pub fn add_work_listener(&self, notifier: Box<NotifyWork>)
Push listener that will handle new jobs
pub fn add_transactions_listener(&self, f: Box<Fn(&[H256]) + Send + Sync>)
[src]
pub fn add_transactions_listener(&self, f: Box<Fn(&[H256]) + Send + Sync>)
Set a callback to be notified about imported transactions' hashes.
pub fn new(
options: MinerOptions,
gas_pricer: GasPricer,
spec: &Spec,
accounts: Option<Arc<AccountProvider>>
) -> Self
[src]
pub fn new(
options: MinerOptions,
gas_pricer: GasPricer,
spec: &Spec,
accounts: Option<Arc<AccountProvider>>
) -> Self
Creates new instance of miner Arc.
pub fn new_for_tests(
spec: &Spec,
accounts: Option<Arc<AccountProvider>>
) -> Miner
[src]
pub fn new_for_tests(
spec: &Spec,
accounts: Option<Arc<AccountProvider>>
) -> Miner
Creates new instance of miner with given spec and accounts.
NOTE This should be only used for tests.
pub fn clear(&self)
[src]
pub fn clear(&self)
Clear all pending block states
pub fn update_transaction_queue_limits(&self, block_gas_limit: U256)
[src]
pub fn update_transaction_queue_limits(&self, block_gas_limit: U256)
Updates transaction queue verification limits.
Limits consist of current block gas limit and minimal gas price.
Trait Implementations
impl MinerService for Miner
[src]
impl MinerService for Miner
type State = State<StateDB>
Type representing chain state
Get current authoring parameters.
fn set_gas_range_target(&self, gas_range_target: (U256, U256))
[src]
fn set_gas_range_target(&self, gas_range_target: (U256, U256))
Set the lower and upper bound of gas limit we wish to target when sealing a new block.
fn set_extra_data(&self, extra_data: Bytes)
[src]
fn set_extra_data(&self, extra_data: Bytes)
Set the extra_data that we will seal blocks with.
Set info necessary to sign consensus messages and block authoring. Read more
fn sensible_gas_price(&self) -> U256
[src]
fn sensible_gas_price(&self) -> U256
Suggested gas price.
fn sensible_gas_limit(&self) -> U256
[src]
fn sensible_gas_limit(&self) -> U256
Suggested gas limit.
fn import_external_transactions<C: BlockChainClient>(
&self,
chain: &C,
transactions: Vec<UnverifiedTransaction>
) -> Vec<Result<(), Error>>
[src]
fn import_external_transactions<C: BlockChainClient>(
&self,
chain: &C,
transactions: Vec<UnverifiedTransaction>
) -> Vec<Result<(), Error>>
Imports transactions to transaction queue.
fn import_own_transaction<C: BlockChainClient>(
&self,
chain: &C,
pending: PendingTransaction
) -> Result<(), Error>
[src]
fn import_own_transaction<C: BlockChainClient>(
&self,
chain: &C,
pending: PendingTransaction
) -> Result<(), Error>
Imports own (node owner) transaction to queue.
fn local_transactions(&self) -> BTreeMap<H256, Status>
[src]
fn local_transactions(&self) -> BTreeMap<H256, Status>
Get a list of local transactions with statuses.
fn queued_transactions(&self) -> Vec<Arc<VerifiedTransaction>>
[src]
fn queued_transactions(&self) -> Vec<Arc<VerifiedTransaction>>
Get a list of all transactions in the pool (some of them might not be ready for inclusion yet).
fn ready_transactions<C>(
&self,
chain: &C,
max_len: usize,
ordering: PendingOrdering
) -> Vec<Arc<VerifiedTransaction>> where
C: ChainInfo + Nonce + Sync,
[src]
fn ready_transactions<C>(
&self,
chain: &C,
max_len: usize,
ordering: PendingOrdering
) -> Vec<Arc<VerifiedTransaction>> where
C: ChainInfo + Nonce + Sync,
Get a list of all ready transactions either ordered by priority or unordered (cheaper). Read more
fn next_nonce<C>(&self, chain: &C, address: &Address) -> U256 where
C: Nonce + Sync,
[src]
fn next_nonce<C>(&self, chain: &C, address: &Address) -> U256 where
C: Nonce + Sync,
Returns next valid nonce for given address. Read more
fn transaction(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>>
[src]
fn transaction(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>>
Query transaction from the pool given it's hash.
fn remove_transaction(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>>
[src]
fn remove_transaction(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>>
Removes transaction from the pool. Read more
fn queue_status(&self) -> QueueStatus
[src]
fn queue_status(&self) -> QueueStatus
Get current queue status. Read more
fn pending_receipt(
&self,
best_block: BlockNumber,
hash: &H256
) -> Option<RichReceipt>
[src]
fn pending_receipt(
&self,
best_block: BlockNumber,
hash: &H256
) -> Option<RichReceipt>
Get a particular receipt from pending block.
fn pending_receipts(
&self,
best_block: BlockNumber
) -> Option<BTreeMap<H256, Receipt>>
[src]
fn pending_receipts(
&self,
best_block: BlockNumber
) -> Option<BTreeMap<H256, Receipt>>
Get a list of all pending receipts from pending block.
fn update_sealing<C>(&self, chain: &C) where
C: BlockChain + CallContract + BlockProducer + SealedBlockImporter + Nonce + Sync,
[src]
fn update_sealing<C>(&self, chain: &C) where
C: BlockChain + CallContract + BlockProducer + SealedBlockImporter + Nonce + Sync,
Update sealing if required. Prepare the block and work if the Engine does not seal internally.
fn is_currently_sealing(&self) -> bool
[src]
fn is_currently_sealing(&self) -> bool
Is it currently sealing?
fn work_package<C>(&self, chain: &C) -> Option<(H256, BlockNumber, u64, U256)> where
C: BlockChain + CallContract + BlockProducer + SealedBlockImporter + Nonce + Sync,
[src]
fn work_package<C>(&self, chain: &C) -> Option<(H256, BlockNumber, u64, U256)> where
C: BlockChain + CallContract + BlockProducer + SealedBlockImporter + Nonce + Sync,
Get the sealing work package preparing it if doesn't exist yet. Read more
fn submit_seal(
&self,
block_hash: H256,
seal: Vec<Bytes>
) -> Result<SealedBlock, Error>
[src]
fn submit_seal(
&self,
block_hash: H256,
seal: Vec<Bytes>
) -> Result<SealedBlock, Error>
Submit seal
as a valid solution for the header of pow_hash
. Will check the seal, but not actually insert the block into the chain. Read more
fn chain_new_blocks<C>(
&self,
chain: &C,
imported: &[H256],
_invalid: &[H256],
enacted: &[H256],
retracted: &[H256],
is_internal_import: bool
) where
C: BlockChainClient,
[src]
fn chain_new_blocks<C>(
&self,
chain: &C,
imported: &[H256],
_invalid: &[H256],
enacted: &[H256],
retracted: &[H256],
is_internal_import: bool
) where
C: BlockChainClient,
Called when blocks are imported to chain, updates transactions queue. is_internal_import
indicates that the block has just been created in miner and internally sealed by the engine, so we shouldn't attempt creating new block again. Read more
fn pending_state(&self, latest_block_number: BlockNumber) -> Option<Self::State>
[src]
fn pending_state(&self, latest_block_number: BlockNumber) -> Option<Self::State>
Get Some
clone()
of the current pending block's state or None
if we're not sealing.
fn pending_block_header(
&self,
latest_block_number: BlockNumber
) -> Option<Header>
[src]
fn pending_block_header(
&self,
latest_block_number: BlockNumber
) -> Option<Header>
Get Some
clone()
of the current pending block header or None
if we're not sealing.
fn pending_block(&self, latest_block_number: BlockNumber) -> Option<Block>
[src]
fn pending_block(&self, latest_block_number: BlockNumber) -> Option<Block>
Get Some
clone()
of the current pending block or None
if we're not sealing.
fn pending_transactions(
&self,
latest_block_number: BlockNumber
) -> Option<Vec<SignedTransaction>>
[src]
fn pending_transactions(
&self,
latest_block_number: BlockNumber
) -> Option<Vec<SignedTransaction>>
Get Some
clone()
of the current pending block transactions or None
if we're not sealing.