1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#![warn(missing_docs)]
mod miner;
mod service_transaction_checker;
pub mod pool_client;
pub mod stratum;
pub use self::miner::{Miner, MinerOptions, Penalization, PendingSet, AuthoringParams};
pub use ethcore_miner::pool::PendingOrdering;
use std::sync::Arc;
use std::collections::BTreeMap;
use bytes::Bytes;
use ethereum_types::{H256, U256, Address};
use ethcore_miner::pool::{VerifiedTransaction, QueueStatus, local_transactions};
use block::{Block, SealedBlock};
use client::{
CallContract, RegistryInfo, ScheduleInfo,
BlockChain, BlockProducer, SealedBlockImporter, ChainInfo,
AccountData, Nonce,
};
use error::Error;
use header::{BlockNumber, Header};
use receipt::{RichReceipt, Receipt};
use transaction::{self, UnverifiedTransaction, SignedTransaction, PendingTransaction};
use state::StateInfo;
pub trait TransactionVerifierClient: Send + Sync
+ CallContract + RegistryInfo
+ BlockChain + ScheduleInfo + AccountData
{}
pub trait BlockChainClient: TransactionVerifierClient + BlockProducer + SealedBlockImporter {}
pub trait MinerService : Send + Sync {
type State: StateInfo + 'static;
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)
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<BTreeMap<H256, Receipt>>;
fn pending_receipt(&self, best_block: BlockNumber, hash: &H256) -> Option<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(&self, address: Address, password: Option<String>) -> Result<(), ::account_provider::SignError>;
fn import_external_transactions<C>(&self, client: &C, transactions: Vec<UnverifiedTransaction>)
-> Vec<Result<(), transaction::Error>>
where C: BlockChainClient;
fn import_own_transaction<C>(&self, chain: &C, transaction: PendingTransaction)
-> Result<(), transaction::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 ready_transactions<C>(&self, chain: &C, max_len: usize, ordering: PendingOrdering) -> Vec<Arc<VerifiedTransaction>>
where C: ChainInfo + Nonce + Sync;
fn queued_transactions(&self) -> Vec<Arc<VerifiedTransaction>>;
fn local_transactions(&self) -> BTreeMap<H256, local_transactions::Status>;
fn queue_status(&self) -> QueueStatus;
fn sensible_gas_price(&self) -> U256;
fn sensible_gas_limit(&self) -> U256;
}