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

Commit

Permalink
saturating add
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Drwięga committed Sep 23, 2016
1 parent 84e7cb1 commit 6fffede
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ethcore/src/miner/transaction_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,7 @@ impl TransactionOrder {
}

fn penalize(mut self) -> Self {
let current = self.penalties;
self.penalties = match self.penalties.overflowing_add(1) {
(_, true) => current,
(val, false) => val,
};
self.penalties = self.penalties.saturating_add(1);
self
}
}
Expand Down Expand Up @@ -349,7 +345,7 @@ pub struct AccountDetails {


/// Transactions with `gas > (gas_limit + gas_limit * Factor(in percents))` are not imported to the queue.
const GAS_LIMIT_HYSTERESIS: usize = 10; // %
const GAS_LIMIT_HYSTERESIS: usize = 10; // (100/GAS_LIMIT_HYSTERESIS) %

/// `TransactionQueue` implementation
pub struct TransactionQueue {
Expand Down

0 comments on commit 6fffede

Please sign in to comment.