diff --git a/common/exchange/rates.go b/common/exchange/rates.go index fac2b7df33..221ba480ef 100644 --- a/common/exchange/rates.go +++ b/common/exchange/rates.go @@ -72,7 +72,7 @@ func getRate(exchangeRates common.ExchangeRates, feeCurrency *common.Address) (* // returns -1 0 or 1 depending if val1 < val2, val1 == val2, or val1 > val2 respectively. func CompareValue(exchangeRates common.ExchangeRates, val1 *big.Int, feeCurrency1 *common.Address, val2 *big.Int, feeCurrency2 *common.Address) (int, error) { // Short circuit if the fee currency is the same. - if feeCurrency1 == feeCurrency2 { + if common.AreSameAddress(feeCurrency1, feeCurrency2) { return val1.Cmp(val2), nil } diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 2bf29c44bd..a4589d35a7 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -689,7 +689,11 @@ func (pool *LegacyPool) validateTx(tx *types.Transaction, local bool) error { }, ExistingExpenditure: func(addr common.Address) (*big.Int, *big.Int) { if list := pool.pending[addr]; list != nil { - return list.TotalCostFor(tx.FeeCurrency()).ToBig(), list.TotalCostFor(nil).ToBig() + if tx.FeeCurrency() != nil { + return list.TotalCostFor(tx.FeeCurrency()).ToBig(), list.TotalCostFor(nil).ToBig() + } else { + return common.Big0, list.TotalCostFor(nil).ToBig() + } } return new(big.Int), new(big.Int) }, @@ -703,7 +707,7 @@ func (pool *LegacyPool) validateTx(tx *types.Transaction, local bool) error { nativeCost = nativeCost.Add(nativeCost, l1Cost) } } - if tx.FeeCurrency() != feeCurrency { + if !common.AreSameAddress(tx.FeeCurrency(), feeCurrency) { // We are only interested in costs in the same currency feeCurrencyCost = new(big.Int) }