Skip to content

Commit

Permalink
Fix nil pointer exception in txList Filter
Browse files Browse the repository at this point in the history
This occurred because gasPriceMinimums contains the gasPriceMinimum for
every fee currency, not just the fee currencies of the transfer. This
changes the iteration to go through each gasPriceFloor and then get the
gasPriceMinimum from the fee currency associated with the floor. This works
because gasPriceMinimums contains every whitelisted fee currency and the tx
has already been validated to pay in a fee currency.
  • Loading branch information
Joshua Gutow committed Feb 5, 2021
1 parent 3a2a2fc commit 1849624
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/tx_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ func (l *txList) Filter(nativeCostLimit, nativeGasPriceMinimum *big.Int, feeLimi
}
}
// Ensure that each gas price floor >= the gas price minimum.
for feeCurrency, gasPriceMinimum := range gasPriceMinimums {
if l.gaspricefloors[feeCurrency].Cmp(gasPriceMinimum) < 0 {
for feeCurrency, gasPriceFloor := range l.gaspricefloors {
if gasPriceMinimum := gasPriceMinimums[feeCurrency]; gasPriceFloor.Cmp(gasPriceMinimum) < 0 {
canBail = false
l.gaspricefloors[feeCurrency] = new(big.Int).Set(gasPriceMinimum)
}
Expand Down

0 comments on commit 1849624

Please sign in to comment.