diff --git a/miner/src/miner.rs b/miner/src/miner.rs index efb2f2c77..9fb771bb7 100644 --- a/miner/src/miner.rs +++ b/miner/src/miner.rs @@ -167,8 +167,8 @@ impl Miner { }; let mut queue = self.transaction_queue.lock().unwrap(); let fetch_account = |a: &Address| AccountDetails { - nonce: chain.nonce(a), - balance: chain.balance(a, BlockID::Latest).unwrap(), + nonce: chain.nonce_latest(a), + balance: chain.balance_latest(a), }; for hash in invalid_transactions.into_iter() { queue.remove_invalid(&hash, &fetch_account); @@ -291,7 +291,7 @@ impl MinerService for Miner { fn balance(&self, chain: &BlockChainClient, address: &Address) -> U256 { let sealing_work = self.sealing_work.lock().unwrap(); sealing_work.peek_last_ref().map_or_else( - || chain.balance(address, BlockID::Latest).unwrap(), + || chain.balance_latest(address), |b| b.block().fields().state.balance(address) ) } @@ -299,14 +299,14 @@ impl MinerService for Miner { fn storage_at(&self, chain: &BlockChainClient, address: &Address, position: &H256) -> H256 { let sealing_work = self.sealing_work.lock().unwrap(); sealing_work.peek_last_ref().map_or_else( - || chain.storage_at(address, position, BlockID::Latest).unwrap(), + || chain.storage_at_latest(address, position), |b| b.block().fields().state.storage_at(address, position) ) } fn nonce(&self, chain: &BlockChainClient, address: &Address) -> U256 { let sealing_work = self.sealing_work.lock().unwrap(); - sealing_work.peek_last_ref().map_or_else(|| chain.nonce(address), |b| b.block().fields().state.nonce(address)) + sealing_work.peek_last_ref().map_or_else(|| chain.nonce_latest(address), |b| b.block().fields().state.nonce(address)) } fn code(&self, chain: &BlockChainClient, address: &Address) -> Option { @@ -551,8 +551,8 @@ impl MinerService for Miner { let _sender = tx.sender(); } let _ = self.import_transactions(txs, |a| AccountDetails { - nonce: chain.nonce(a), - balance: chain.balance(a, BlockID::Latest).unwrap(), + nonce: chain.nonce_latest(a), + balance: chain.balance_latest(a), }); }); } @@ -572,7 +572,7 @@ impl MinerService for Miner { }) .collect::>(); for sender in to_remove.into_iter() { - transaction_queue.remove_all(sender, chain.nonce(&sender)); + transaction_queue.remove_all(sender, chain.nonce_latest(&sender)); } }); } diff --git a/sync/src/chain.rs b/sync/src/chain.rs index 5f9cf6371..7f8e21e58 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -900,8 +900,8 @@ impl ChainSync { } let chain = io.chain(); let fetch_account = |a: &Address| AccountDetails { - nonce: chain.nonce(a), - balance: chain.balance(a, BlockID::Latest).unwrap(), + nonce: chain.nonce_latest(a), + balance: chain.balance_latest(a), }; let _ = self.miner.import_transactions(transactions, fetch_account); Ok(())