Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Update transaction_queue.rs
Browse files Browse the repository at this point in the history
Avoid extraneous `U256` operations and split-state local.
  • Loading branch information
gavofyork committed Apr 24, 2016
1 parent 0f4fbad commit b4fc758
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions miner/src/transaction_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ impl TransactionQueue {
/// Checks if there are any transactions in `future` that should actually be promoted to `current`
/// (because nonce matches).
fn move_matching_future_to_current(&mut self, address: Address, mut current_nonce: U256, first_nonce: U256) {
let mut should_update_last_nonces = false;
let mut update_last_nonce_to = None;
{
let by_nonce = self.future.by_address.row_mut(&address);
if let None = by_nonce {
Expand All @@ -590,14 +590,14 @@ impl TransactionQueue {
// Put to current
let order = order.update_height(current_nonce, first_nonce);
self.current.insert(address, current_nonce, order);
update_last_nonce_to = Some(current_nonce);
current_nonce = current_nonce + U256::one();
should_update_last_nonces = true;
}
}
self.future.by_address.clear_if_empty(&address);
if should_update_last_nonces {
if let Some(x) = update_last_nonce_to {
// Update last inserted nonce
self.last_nonces.insert(address, current_nonce - U256::one());
self.last_nonces.insert(address, x);
}
}

Expand Down

0 comments on commit b4fc758

Please sign in to comment.