# Struct ethcore::miner::Miner [−] [src]

    pub struct Miner {
        pub seals_internally: bool,
        // some 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.

## Fields

`seals_internally: bool`

Does the node perform internal (without work) sealing.

## Methods

### `impl Miner`
[src]

#### `fn push_notifier(&self, notifier: Box<NotifyWork>)`

Push notifier that will handle new jobs

#### `fn new(options: MinerOptions,
gas_pricer: GasPricer,
spec: &Spec,
accounts: Option<Arc<AccountProvider>>)
-> Arc<Miner>`

Creates new instance of miner Arc.

#### `fn with_spec_and_accounts(spec: &Spec,
accounts: Option<Arc<AccountProvider>>)
-> Miner`

Creates new instance of miner with accounts and with given spec.

#### `fn with_spec(spec: &Spec) -> Miner`

Creates new instance of miner without accounts, but with given spec.

#### `fn clear(&self)`

Clear all pending block states

#### `fn pending_state(&self) -> Option<State>`

Get `Some` `clone()` of the current pending block's state or `None` if we're not sealing.

#### `fn pending_block(&self) -> Option<Block>`

Get `Some` `clone()` of the current pending block or `None` if we're not sealing.

#### `fn recalibrate_minimal_gas_price(&self)`

Asynchronously updates minimal gas price for transaction queue

## Trait Implementations

### `impl MinerService for Miner`
[src]

#### `fn clear_and_reset(&self, chain: &MiningBlockChainClient)`

Removes all transactions from the queue and restart mining operation.

#### `fn status(&self) -> MinerStatus`

Returns miner's status.

#### `fn call(&self,
client: &MiningBlockChainClient,
t: &SignedTransaction,
analytics: CallAnalytics)
-> Result<Executed, CallError>`

Call into contract code using pending state.

#### `fn balance(&self, chain: &MiningBlockChainClient, address: &Address) -> U256`

Latest account balance in pending state.

#### `fn storage_at(&self,
chain: &MiningBlockChainClient,
address: &Address,
position: &H256)
-> H256`

Get storage value in pending state.

#### `fn nonce(&self, chain: &MiningBlockChainClient, address: &Address) -> U256`

Get account nonce in pending state.

#### `fn code(&self,
chain: &MiningBlockChainClient,
address: &Address)
-> Option<Bytes>`

Get contract code in pending state.

#### `fn set_author(&self, author: Address)`

Set the author that we will seal blocks as.

#### `fn set_engine_signer(&self,
address: Address,
password: String)
-> Result<(), AccountError>`

Set info necessary to sign consensus messages.

#### `fn set_extra_data(&self, extra_data: Bytes)`

Set the extra_data that we will seal blocks with.

#### `fn set_gas_floor_target(&self, target: U256)`

Set the gas limit we wish to target when sealing a new block.

#### `fn set_gas_ceil_target(&self, target: U256)`

Set the upper bound of gas limit we wish to target when sealing a new block.

#### `fn set_minimal_gas_price(&self, min_gas_price: U256)`

Set minimal gas price of transaction to be accepted for mining.

#### `fn minimal_gas_price(&self) -> U256`

Get current minimal gas price for transactions accepted to queue.

#### `fn sensible_gas_price(&self) -> U256`

Suggested gas price.

#### `fn sensible_gas_limit(&self) -> U256`

Suggested gas limit.

#### `fn transactions_limit(&self) -> usize`

Get current transactions limit in queue.

#### `fn set_transactions_limit(&self, limit: usize)`

Set maximal number of transactions kept in the queue (both current and future).

#### `fn set_tx_gas_limit(&self, limit: U256)`

Set maximum amount of gas allowed for any single transaction to mine.

#### `fn author(&self) -> Address`

Get the author that we will seal blocks as.

#### `fn extra_data(&self) -> Bytes`

Get the extra_data that we will seal blocks with.

#### `fn gas_floor_target(&self) -> U256`

Get the gas limit we wish to target when sealing a new block.

#### `fn gas_ceil_target(&self) -> U256`

Get the gas limit we wish to target when sealing a new block.

#### `fn import_external_transactions(&self,
chain: &MiningBlockChainClient,
transactions: Vec<UnverifiedTransaction>)
-> Vec<Result<TransactionImportResult, Error>>`

Imports transactions to transaction queue.

#### `fn import_own_transaction(&self,
chain: &MiningBlockChainClient,
pending: PendingTransaction)
-> Result<TransactionImportResult, Error>`

Imports own (node owner) transaction to queue.

#### `fn pending_transactions(&self) -> Vec<PendingTransaction>`

Get a list of all pending transactions in the queue.

#### `fn local_transactions(&self) -> BTreeMap<H256, LocalTransactionStatus>`

Get a list of local transactions with statuses.

#### `fn future_transactions(&self) -> Vec<PendingTransaction>`

Get a list of all future transactions.

#### `fn ready_transactions(&self, best_block: BlockNumber) -> Vec<PendingTransaction>`

Get a list of all transactions that can go into the given block.

#### `fn pending_transactions_hashes(&self, best_block: BlockNumber) -> Vec<H256>`

Returns hashes of transactions currently in pending

#### `fn transaction(&self,
best_block: BlockNumber,
hash: &H256)
-> Option<SignedTransaction>`

Query pending transactions for hash.

#### `fn pending_receipt(&self,
best_block: BlockNumber,
hash: &H256)
-> Option<RichReceipt>`

Get a particular reciept.

#### `fn pending_receipts(&self, best_block: BlockNumber) -> BTreeMap<H256, Receipt>`

Get a list of all pending receipts.

#### `fn last_nonce(&self, address: &Address) -> Option<U256>`

Returns highest transaction nonce for given address.

#### `fn update_sealing(&self, chain: &MiningBlockChainClient)`

Update sealing if required. Prepare the block and work if the Engine does not seal internally.

#### `fn is_sealing(&self) -> bool`

Is it currently sealing?

#### `fn map_sealing_work<F, T>(&self,
chain: &MiningBlockChainClient,
f: F)
-> Option<T> where F: FnOnce(&ClosedBlock) -> T`

Get the sealing work package and if `Some`, apply some transform.

#### `fn submit_seal(&self,
chain: &MiningBlockChainClient,
block_hash: H256,
seal: Vec<Bytes>)
-> Result<(), 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(&self,
chain: &MiningBlockChainClient,
_imported: &[H256],
_invalid: &[H256],
enacted: &[H256],
retracted: &[H256])`

Called when blocks are imported to chain, updates transactions queue.

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)