Fix fn call in miner.rs same as client.rs.
This commit is contained in:
parent
4c44994807
commit
4153052148
@ -463,6 +463,7 @@ impl<V> BlockChainClient for Client<V> where V: Verifier {
|
|||||||
}
|
}
|
||||||
let options = TransactOptions { tracing: false, vm_tracing: analytics.vm_tracing, check_nonce: false };
|
let options = TransactOptions { tracing: false, vm_tracing: analytics.vm_tracing, check_nonce: false };
|
||||||
let mut ret = Executive::new(&mut state, &env_info, self.engine.deref().deref(), &self.vm_factory).transact(t, options);
|
let mut ret = Executive::new(&mut state, &env_info, self.engine.deref().deref(), &self.vm_factory).transact(t, options);
|
||||||
|
|
||||||
// TODO gav move this into Executive.
|
// TODO gav move this into Executive.
|
||||||
if analytics.state_diffing {
|
if analytics.state_diffing {
|
||||||
if let Ok(ref mut x) = ret {
|
if let Ok(ref mut x) = ret {
|
||||||
|
@ -255,6 +255,8 @@ impl MinerService for Miner {
|
|||||||
match sealing_work.peek_last_ref() {
|
match sealing_work.peek_last_ref() {
|
||||||
Some(work) => {
|
Some(work) => {
|
||||||
let block = work.block();
|
let block = work.block();
|
||||||
|
|
||||||
|
// TODO: merge this code with client.rs's fn call somwhow.
|
||||||
let header = block.header();
|
let header = block.header();
|
||||||
let last_hashes = chain.last_hashes();
|
let last_hashes = chain.last_hashes();
|
||||||
let env_info = EnvInfo {
|
let env_info = EnvInfo {
|
||||||
@ -273,12 +275,14 @@ impl MinerService for Miner {
|
|||||||
ExecutionError::TransactionMalformed(message)
|
ExecutionError::TransactionMalformed(message)
|
||||||
}));
|
}));
|
||||||
let balance = state.balance(&sender);
|
let balance = state.balance(&sender);
|
||||||
// give the sender max balance
|
let needed_balance = t.value + t.gas * t.gas_price;
|
||||||
state.sub_balance(&sender, &balance);
|
if balance < needed_balance {
|
||||||
state.add_balance(&sender, &U256::max_value());
|
// give the sender a sufficient balance
|
||||||
|
state.add_balance(&sender, &(needed_balance - balance));
|
||||||
|
}
|
||||||
let options = TransactOptions { tracing: false, vm_tracing: analytics.vm_tracing, check_nonce: false };
|
let options = TransactOptions { tracing: false, vm_tracing: analytics.vm_tracing, check_nonce: false };
|
||||||
|
|
||||||
let mut ret = Executive::new(&mut state, &env_info, self.engine(), chain.vm_factory()).transact(t, options);
|
let mut ret = Executive::new(&mut state, &env_info, self.engine(), chain.vm_factory()).transact(t, options);
|
||||||
|
|
||||||
// TODO gav move this into Executive.
|
// TODO gav move this into Executive.
|
||||||
if analytics.state_diffing {
|
if analytics.state_diffing {
|
||||||
if let Ok(ref mut x) = ret {
|
if let Ok(ref mut x) = ret {
|
||||||
|
Loading…
Reference in New Issue
Block a user