Removing assertion and just comparing fees

This commit is contained in:
Tomasz Drwięga 2016-03-05 17:06:04 +01:00
parent 8915974cf0
commit c13afcf404

View File

@ -387,8 +387,9 @@ impl TransactionQueue {
by_hash.insert(hash.clone(), tx); by_hash.insert(hash.clone(), tx);
if let Some(old) = set.insert(address, nonce, order.clone()) { if let Some(old) = set.insert(address, nonce, order.clone()) {
// There was already transaction in queue. Let's check which one should stay // There was already transaction in queue. Let's check which one should stay
if old.cmp(&order) == Ordering::Greater { let old_fee = old.gas_price;
assert!(old.nonce_height == order.nonce_height, "Both transactions should have the same height."); let new_fee = order.gas_price;
if old_fee.cmp(&new_fee) == Ordering::Greater {
// Put back old transaction since it has greater priority (higher gas_price) // Put back old transaction since it has greater priority (higher gas_price)
set.insert(address, nonce, old); set.insert(address, nonce, old);
by_hash.remove(&hash); by_hash.remove(&hash);