Skip to content

Commit

Permalink
Set default advanced tab gas limit
Browse files Browse the repository at this point in the history
The advanced tab of the transaction confirmation screen would enter
into an infinite loop and crash if the given gas price was falsy and
some interaction was made with the gas limit field.

To prevent this infinite loop, a default value of 0 has been set. The
user will still need to update the gas limit in order to confirm the
transaction, as zero is too low a gas limit (the lowest is 21000).
21000 cannot be the default gas limit at this layer, because the limit
used is from a layer above this, which wouldn't have that same 21000
set.
  • Loading branch information
Gudahtt committed Nov 10, 2019
1 parent 02aebc2 commit 6208882
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export default class AdvancedGasInputs extends Component {
static propTypes = {
updateCustomGasPrice: PropTypes.func,
updateCustomGasLimit: PropTypes.func,
customGasPrice: PropTypes.number,
customGasLimit: PropTypes.number,
customGasPrice: PropTypes.number.isRequired,
customGasLimit: PropTypes.number.isRequired,
insufficientBalance: PropTypes.bool,
customPriceIsSafe: PropTypes.bool,
isSpeedUp: PropTypes.bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function convertGasPriceForInputs (gasPriceInHexWEI) {
}

function convertGasLimitForInputs (gasLimitInHexWEI) {
return parseInt(gasLimitInHexWEI, 16)
return parseInt(gasLimitInHexWEI, 16) || 0
}

const mapDispatchToProps = dispatch => {
Expand Down

0 comments on commit 6208882

Please sign in to comment.