# Struct ethcore_rpc::v1::tests::helpers::TestMinerService [−] [src]

    pub struct TestMinerService {
        pub imported_transactions: Mutex<Vec<SignedTransaction>>,
        pub latest_closed_block: Mutex<Option<ClosedBlock>>,
        pub pending_transactions: Mutex<HashMap<H256, SignedTransaction>>,
        pub local_transactions: Mutex<BTreeMap<H256, LocalTransactionStatus>>,
        pub pending_receipts: Mutex<BTreeMap<H256, Receipt>>,
        pub last_nonces: RwLock<HashMap<Address, U256>>,
        pub password: RwLock<String>,
        // some fields omitted
    }

Test miner service.

## Fields

`imported_transactions: Mutex<Vec<SignedTransaction>>`

Imported transactions.

`latest_closed_block: Mutex<Option<ClosedBlock>>`

Latest closed block.

`pending_transactions: Mutex<HashMap<H256, SignedTransaction>>`

Pre-existed pending transactions

`local_transactions: Mutex<BTreeMap<H256, LocalTransactionStatus>>`

Pre-existed local transactions

`pending_receipts: Mutex<BTreeMap<H256, Receipt>>`

Pre-existed pending receipts

`last_nonces: RwLock<HashMap<Address, U256>>`

Last nonces.

`password: RwLock<String>`

Password held by Engine.

## Trait Implementations

### `impl Default for TestMinerService`
[src]

#### `fn default() -> TestMinerService`

Returns the "default value" for a type. Read more

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

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

Returns miner's status.

#### `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 lower gas limit we wish to target when sealing a new block.

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

Set the upper 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 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 transactions_limit(&self) -> usize`

Get current transactions limit in queue.

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

Get the author that we will seal blocks as.

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

Get current minimal gas price for transactions accepted to queue.

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

Get the extra_data that we will seal blocks with.

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

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

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

Get the upper bound of 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 transactions to transaction queue.

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

Returns hashes of transactions currently in pending

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

Removes all transactions from the queue and restart mining operation.

#### `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.

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

New chain head event. Restart mining operation.

#### `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 transaction(&self,
_best_block: BlockNumber,
hash: &H256)
-> Option<SignedTransaction>`

Query pending transactions for hash.

#### `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 ready_transactions(&self,
_best_block: BlockNumber)
-> Vec<PendingTransaction>`

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

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

Get a list of all future transactions.

#### `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 is_sealing(&self) -> bool`

Is it currently sealing?

#### `fn submit_seal(&self,
_chain: &MiningBlockChainClient,
_pow_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.

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

Latest account balance in pending state.

#### `fn call(&self,
_chain: &MiningBlockChainClient,
_t: &SignedTransaction,
_analytics: CallAnalytics)
-> Result<Executed, CallError>`

Call into contract code using 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 sensible_gas_price(&self) -> U256`

Suggested gas price.

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

Suggested gas limit.

# 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`)