Fixing possible race in transaction queue

This commit is contained in:
Tomasz Drwięga 2016-03-15 10:54:19 +01:00
parent d6d0f8d4eb
commit 40ac01b730

View File

@ -516,11 +516,10 @@ impl TransactionQueue {
return; return;
} }
let base_nonce = fetch_nonce(&address); Self::replace_transaction(tx, state_nonce, &mut self.current, &mut self.by_hash);
Self::replace_transaction(tx, base_nonce, &mut self.current, &mut self.by_hash);
self.last_nonces.insert(address, nonce); self.last_nonces.insert(address, nonce);
// But maybe there are some more items waiting in future? // But maybe there are some more items waiting in future?
self.move_matching_future_to_current(address, nonce + U256::one(), base_nonce); self.move_matching_future_to_current(address, nonce + U256::one(), state_nonce);
self.current.enforce_limit(&mut self.by_hash); self.current.enforce_limit(&mut self.by_hash);
} }