Parameter to allow user to force the sealing mechanism (#918)

* Allow block sealing mechanism to be forced, even when not mining.

* Fix deadlock in dispatch_transaction. Fix tests.

* Horrible workaround for transaction importing.

* Reduce tracing. Cleanups.

* Remove logging.

* Remove broken code inherited from dodgy implementation.

* pre-query tx queue nonce also if any

* remove outside nonce queries

* remove queue nonces
This commit is contained in:
Gav Wood
2016-04-11 11:52:33 -07:00
parent edf4735542
commit c48374dbc6
7 changed files with 38 additions and 17 deletions

View File

@@ -26,6 +26,7 @@ use ethminer::{MinerService, AccountDetails};
use jsonrpc_core::*;
use util::numbers::*;
use util::sha3::*;
use util::bytes::{ToPretty};
use util::rlp::{encode, UntrustedRlp, View};
use ethcore::client::*;
use ethcore::block::IsBlock;
@@ -191,9 +192,13 @@ impl<C, S, A, M, EM> EthClient<C, S, A, M, EM>
let import = {
let client = take_weak!(self.client);
take_weak!(self.miner).import_transactions(vec![signed_transaction], |a: &Address| AccountDetails {
nonce: client.nonce(a),
balance: client.balance(a),
let miner = take_weak!(self.miner);
miner.import_transactions(vec![signed_transaction], |a: &Address| {
AccountDetails {
nonce: client.nonce(&a),
balance: client.balance(&a),
}
})
};
@@ -499,6 +504,7 @@ impl<C, S, A, M, EM> Eth for EthClient<C, S, A, M, EM>
data: request.data.map_or_else(Vec::new, |d| d.to_vec()),
}.sign(&secret)
};
trace!(target: "miner", "send_transaction: dispatching tx: {}", encode(&signed_transaction).to_vec().pretty());
self.dispatch_transaction(signed_transaction)
},
Err(_) => { to_value(&H256::zero()) }