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

Commit

Permalink
Fix potential as_usize overflow when casting from U256 in miner
Browse files Browse the repository at this point in the history
  • Loading branch information
sorpaas committed Jul 26, 2018
1 parent 5795d33 commit 4589ff5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ethcore/src/miner/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ impl Miner {
let max_transactions = if min_tx_gas.is_zero() {
usize::max_value()
} else {
MAX_SKIPPED_TRANSACTIONS.saturating_add((*open_block.block().header().gas_limit() / min_tx_gas).as_u64() as usize)
MAX_SKIPPED_TRANSACTIONS.saturating_add(cmp::min(*open_block.block().header().gas_limit() / min_tx_gas, usize::max_value()).as_usize())
};

let pending: Vec<Arc<_>> = self.transaction_queue.pending(
Expand Down

0 comments on commit 4589ff5

Please sign in to comment.