Trait ethcore::miner::MinerService
source · [−]pub trait MinerService: Send + Sync {
type State: StateInfo + 'static;
Show 32 methods
fn submit_seal(
&self,
pow_hash: H256,
seal: Vec<Bytes>
) -> Result<SealedBlock, Error>;
fn is_currently_sealing(&self) -> bool;
fn work_package<C>(
&self,
chain: &C
) -> Option<(H256, BlockNumber, u64, U256)>
where
C: BlockChain + CallContract + BlockProducer + SealedBlockImporter + Nonce + Sync;
fn update_sealing<C>(&self, chain: &C, force: ForceUpdateSealing)
where
C: BlockChain + CallContract + BlockProducer + SealedBlockImporter + Nonce + Sync;
fn chain_new_blocks<C>(
&self,
chain: &C,
imported: &[H256],
invalid: &[H256],
enacted: &[H256],
retracted: &[H256],
is_internal_import: bool
)
where
C: BlockChainClient;
fn pending_receipts(
&self,
best_block: BlockNumber
) -> Option<Vec<RichReceipt>>;
fn pending_state(
&self,
latest_block_number: BlockNumber
) -> Option<Self::State>;
fn pending_block_header(
&self,
latest_block_number: BlockNumber
) -> Option<Header>;
fn pending_block(&self, latest_block_number: BlockNumber) -> Option<Block>;
fn pending_transactions(
&self,
latest_block_number: BlockNumber
) -> Option<Vec<SignedTransaction>>;
fn authoring_params(&self) -> AuthoringParams;
fn set_gas_range_target(&self, gas_range_target: (U256, U256));
fn set_extra_data(&self, extra_data: Bytes);
fn set_author<T: Into<Option<Author>>>(&self, author: T);
fn import_external_transactions<C>(
&self,
client: &C,
transactions: Vec<UnverifiedTransaction>
) -> Vec<Result<(), Error>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
where
C: BlockChainClient;
fn import_own_transaction<C>(
&self,
chain: &C,
transaction: PendingTransaction
) -> Result<(), Error>
where
C: BlockChainClient;
fn import_claimed_local_transaction<C>(
&self,
chain: &C,
transaction: PendingTransaction,
trusted: bool
) -> Result<(), Error>
where
C: BlockChainClient;
fn remove_transaction(
&self,
hash: &H256
) -> Option<Arc<VerifiedTransaction>>;
fn transaction(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>>;
fn next_nonce<C>(&self, chain: &C, address: &Address) -> U256
where
C: Nonce + Sync;
fn pending_transaction_hashes<C>(&self, chain: &C) -> BTreeSet<H256>
where
C: ChainInfo + Sync;
fn ready_transactions_filtered<C>(
&self,
chain: &C,
max_len: usize,
filter: Option<TransactionFilter>,
ordering: PendingOrdering
) -> Vec<Arc<VerifiedTransaction>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
where
C: BlockChain + Nonce + Sync;
fn queued_transactions(&self) -> Vec<Arc<VerifiedTransaction>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
;
fn queued_transaction_hashes(&self) -> Vec<H256>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
;
fn local_transactions(&self) -> BTreeMap<H256, Status>;
fn queue_status(&self) -> QueueStatus;
fn sensible_gas_price(&self) -> U256;
fn sensible_max_priority_fee(&self) -> U256;
fn sensible_gas_limit(&self) -> U256;
fn set_minimal_gas_price(&self, gas_price: U256) -> Result<bool, &str>;
fn pending_receipt(
&self,
best_block: BlockNumber,
hash: &H256
) -> Option<RichReceipt> { ... }
fn ready_transactions<C>(
&self,
chain: &C,
max_len: usize,
ordering: PendingOrdering
) -> Vec<Arc<VerifiedTransaction>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
where
C: BlockChain + Nonce + Sync,
{ ... }
}
Expand description
Miner client API
Associated Types
Required methods
fn submit_seal(
&self,
pow_hash: H256,
seal: Vec<Bytes>
) -> Result<SealedBlock, Error>
fn submit_seal(
&self,
pow_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.
fn is_currently_sealing(&self) -> bool
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,
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.
Returns None
if engine seals internally.
fn update_sealing<C>(&self, chain: &C, force: ForceUpdateSealing) where
C: BlockChain + CallContract + BlockProducer + SealedBlockImporter + Nonce + Sync,
fn update_sealing<C>(&self, chain: &C, force: ForceUpdateSealing) where
C: BlockChain + CallContract + BlockProducer + SealedBlockImporter + Nonce + Sync,
Update current pending block
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.
fn pending_receipts(&self, best_block: BlockNumber) -> Option<Vec<RichReceipt>>
fn pending_receipts(&self, best_block: BlockNumber) -> Option<Vec<RichReceipt>>
Get a list of all pending receipts from pending block.
fn pending_state(&self, latest_block_number: BlockNumber) -> Option<Self::State>
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>
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>
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>>
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.
Get current authoring parameters.
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)
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.
On chains where sealing is done externally (e.g. PoW) we provide only reward beneficiary.
Imports transactions to transaction queue.
fn import_own_transaction<C>(
&self,
chain: &C,
transaction: PendingTransaction
) -> Result<(), Error> where
C: BlockChainClient,
fn import_own_transaction<C>(
&self,
chain: &C,
transaction: PendingTransaction
) -> Result<(), Error> where
C: BlockChainClient,
Imports own (node owner) transaction to queue.
fn import_claimed_local_transaction<C>(
&self,
chain: &C,
transaction: PendingTransaction,
trusted: bool
) -> Result<(), Error> where
C: BlockChainClient,
fn import_claimed_local_transaction<C>(
&self,
chain: &C,
transaction: PendingTransaction,
trusted: bool
) -> Result<(), Error> where
C: BlockChainClient,
Imports transactions from potentially external sources, with behaviour determined
by the config flag tx_queue_allow_unfamiliar_locals
fn remove_transaction(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>>
fn remove_transaction(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>>
Removes transaction from the pool.
Attempts to “cancel” a transaction. If it was not propagated yet (or not accepted by other peers) there is a good chance that the transaction will actually be removed. NOTE: The transaction is not removed from pending block if there is one.
fn transaction(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>>
fn transaction(&self, hash: &H256) -> Option<Arc<VerifiedTransaction>>
Query transaction from the pool given it’s hash.
Returns next valid nonce for given address.
This includes nonces of all transactions from this address in the pending queue if they are consecutive. NOTE: pool may contain some future transactions that will become pending after transaction with nonce returned from this function is signed on.
Get a set of all pending transaction hashes.
Depending on the settings may look in transaction pool or only in pending block.
fn ready_transactions_filtered<C>(
&self,
chain: &C,
max_len: usize,
filter: Option<TransactionFilter>,
ordering: PendingOrdering
) -> Vec<Arc<VerifiedTransaction>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
where
C: BlockChain + Nonce + Sync,
fn ready_transactions_filtered<C>(
&self,
chain: &C,
max_len: usize,
filter: Option<TransactionFilter>,
ordering: PendingOrdering
) -> Vec<Arc<VerifiedTransaction>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
where
C: BlockChain + Nonce + Sync,
A: Allocator,
Get a list of all ready transactions either ordered by priority or unordered (cheaper), and optionally filtered by sender, recipient, gas, gas price, value and/or nonce.
Depending on the settings may look in transaction pool or only in pending block.
If you don’t need a full set of transactions, you can add max_len
and create only a limited set of
transactions.
Get a list of all transactions in the pool (some of them might not be ready for inclusion yet).
Get a list of all transaction hashes in the pool (some of them might not be ready for inclusion yet).
fn local_transactions(&self) -> BTreeMap<H256, Status>
fn local_transactions(&self) -> BTreeMap<H256, Status>
Get a list of local transactions with statuses.
fn queue_status(&self) -> QueueStatus
fn queue_status(&self) -> QueueStatus
Get current queue status.
Status includes verification thresholds and current pool utilization and limits.
fn sensible_gas_price(&self) -> U256
fn sensible_gas_price(&self) -> U256
Suggested gas price.
fn sensible_max_priority_fee(&self) -> U256
fn sensible_max_priority_fee(&self) -> U256
Suggested max priority fee gas price
fn sensible_gas_limit(&self) -> U256
fn sensible_gas_limit(&self) -> U256
Suggested gas limit.
Provided methods
fn pending_receipt(
&self,
best_block: BlockNumber,
hash: &H256
) -> Option<RichReceipt>
fn pending_receipt(
&self,
best_block: BlockNumber,
hash: &H256
) -> Option<RichReceipt>
Get a particular receipt from pending block.
fn ready_transactions<C>(
&self,
chain: &C,
max_len: usize,
ordering: PendingOrdering
) -> Vec<Arc<VerifiedTransaction>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
where
C: BlockChain + Nonce + Sync,
fn ready_transactions<C>(
&self,
chain: &C,
max_len: usize,
ordering: PendingOrdering
) -> Vec<Arc<VerifiedTransaction>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
where
C: BlockChain + Nonce + Sync,
A: Allocator,
Get an unfiltered list of all ready transactions.