Merge with master
This commit is contained in:
parent
04082d1514
commit
2aa3864d67
3
Cargo.lock
generated
3
Cargo.lock
generated
@ -236,7 +236,6 @@ dependencies = [
|
|||||||
name = "ethcore-rpc"
|
name = "ethcore-rpc"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"clippy 0.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethash 1.0.0",
|
"ethash 1.0.0",
|
||||||
"ethcore 1.0.0",
|
"ethcore 1.0.0",
|
||||||
@ -293,7 +292,7 @@ dependencies = [
|
|||||||
name = "ethjson"
|
name = "ethjson"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ethcore-util 1.1.0",
|
"ethcore-util 1.0.0",
|
||||||
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_codegen 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_codegen 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -214,6 +214,7 @@ impl<V> Client<V> where V: Verifier {
|
|||||||
let last_hashes = self.build_last_hashes(header.parent_hash.clone());
|
let last_hashes = self.build_last_hashes(header.parent_hash.clone());
|
||||||
let db = self.state_db.lock().unwrap().spawn();
|
let db = self.state_db.lock().unwrap().spawn();
|
||||||
|
|
||||||
|
|
||||||
let enact_result = enact_verified(&block, engine, db, &parent, last_hashes);
|
let enact_result = enact_verified(&block, engine, db, &parent, last_hashes);
|
||||||
if let Err(e) = enact_result {
|
if let Err(e) = enact_result {
|
||||||
warn!(target: "client", "Block import failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e);
|
warn!(target: "client", "Block import failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e);
|
||||||
@ -418,7 +419,7 @@ impl<V> BlockChainClient for Client<V> where V: Verifier {
|
|||||||
// give the sender max balance
|
// give the sender max balance
|
||||||
state.sub_balance(&sender, &balance);
|
state.sub_balance(&sender, &balance);
|
||||||
state.add_balance(&sender, &U256::max_value());
|
state.add_balance(&sender, &U256::max_value());
|
||||||
Executive::new(&mut state, &env_info, self.engine.deref().deref()).transact(t, false)
|
Executive::new(&mut state, &env_info, self.engine.deref().deref()).transact(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO [todr] Should be moved to miner crate eventually.
|
// TODO [todr] Should be moved to miner crate eventually.
|
||||||
|
@ -236,7 +236,7 @@ impl BlockChainClient for TestBlockChainClient {
|
|||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_sealing(&self, _author: Address, _gas_floor_target: U256, _extra_data: Bytes, _transactions: Vec<SignedTransaction>) -> Option<ClosedBlock> {
|
fn prepare_sealing(&self, _author: Address, _gas_floor_target: U256, _extra_data: Bytes, _transactions: Vec<SignedTransaction>) -> Option<(ClosedBlock, HashSet<H256>)> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,26 +97,33 @@ impl Miner {
|
|||||||
self.transaction_queue.lock().unwrap().set_minimal_gas_price(min_gas_price);
|
self.transaction_queue.lock().unwrap().set_minimal_gas_price(min_gas_price);
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
fn update_gas_limit(&self, chain: &BlockChainClient) {
|
|
||||||
let gas_limit = HeaderView::new(&chain.best_block_header()).gas_limit();
|
|
||||||
let mut queue = self.transaction_queue.lock().unwrap();
|
|
||||||
queue.set_gas_limit(gas_limit);
|
|
||||||
=======
|
|
||||||
/// Prepares new block for sealing including top transactions from queue.
|
/// Prepares new block for sealing including top transactions from queue.
|
||||||
pub fn prepare_sealing(&self, chain: &BlockChainClient) {
|
fn prepare_sealing(&self, chain: &BlockChainClient) {
|
||||||
let no_of_transactions = 128;
|
let transactions = self.transaction_queue.lock().unwrap().top_transactions();
|
||||||
// TODO: should select transactions orm queue according to gas limit of block.
|
|
||||||
let transactions = self.transaction_queue.lock().unwrap().top_transactions(no_of_transactions);
|
|
||||||
|
|
||||||
let b = chain.prepare_sealing(
|
let b = chain.prepare_sealing(
|
||||||
self.author(),
|
self.author(),
|
||||||
self.gas_floor_target(),
|
self.gas_floor_target(),
|
||||||
self.extra_data(),
|
self.extra_data(),
|
||||||
transactions,
|
transactions,
|
||||||
);
|
);
|
||||||
*self.sealing_block.lock().unwrap() = b;
|
|
||||||
>>>>>>> b684bc9... Updating sealing when new transactions are received
|
*self.sealing_block.lock().unwrap() = b.map(|(block, invalid_transactions)| {
|
||||||
|
let mut queue = self.transaction_queue.lock().unwrap();
|
||||||
|
queue.remove_all(
|
||||||
|
&invalid_transactions.into_iter().collect::<Vec<H256>>(),
|
||||||
|
|a: &Address| AccountDetails {
|
||||||
|
nonce: chain.nonce(a),
|
||||||
|
balance: chain.balance(a),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
block
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update_gas_limit(&self, chain: &BlockChainClient) {
|
||||||
|
let gas_limit = HeaderView::new(&chain.best_block_header()).gas_limit();
|
||||||
|
let mut queue = self.transaction_queue.lock().unwrap();
|
||||||
|
queue.set_gas_limit(gas_limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user