change nonce, balance, storage_at to *_latest counterparts

This commit is contained in:
Robert Habermeier 2016-05-26 12:54:18 +02:00
parent a3b1cdb175
commit c2a4ed6fc4
2 changed files with 10 additions and 10 deletions

View File

@ -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<Bytes> {
@ -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::<HashSet<Address>>();
for sender in to_remove.into_iter() {
transaction_queue.remove_all(sender, chain.nonce(&sender));
transaction_queue.remove_all(sender, chain.nonce_latest(&sender));
}
});
}

View File

@ -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(())