Skip to content

Commit

Permalink
fix egp equal to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
agnusmor committed Jan 5, 2024
1 parent a1d6f62 commit 5b139b4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pool/effectivegasprice.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func (e *EffectiveGasPrice) CalculateBreakEvenGasPrice(rawTx []byte, txGasPrice

if txGasUsed == 0 {
// Returns tx.GasPrice as the breakEvenGasPrice
log.Infof("egp-dbg txGasUsed is zero")
return txGasPrice, nil
}

Expand Down Expand Up @@ -96,6 +95,10 @@ func (e *EffectiveGasPrice) CalculateBreakEvenGasPrice(rawTx []byte, txGasPrice
log.Infof("egp-dbg l2MinGasPrice: %v, txZeroBytes: %v, txNonZeroBytes: %v, totalTxPrice: %v, breakEvenGasPrice: %v",
l2MinGasPrice, txZeroBytes, txNonZeroBytes, totalTxPrice, breakEvenGasPrice)

if breakEvenGasPrice.Cmp(new(big.Int).SetUint64(0)) == 0 {
breakEvenGasPrice.SetUint64(1)
}

return breakEvenGasPrice, nil
}

Expand All @@ -117,7 +120,7 @@ func (e *EffectiveGasPrice) CalculateEffectiveGasPrice(rawTx []byte, txGasPrice
ratioPriority = new(big.Float).Quo(bfTxGasPrice, bfL2GasPrice)
}

log.Infof("egp-dbg breakEvenGasPrice: %d, bfL2GasPrice: %d, bfTxGasPrice: %d, ratioPriority: %d", breakEvenGasPrice, bfL2GasPrice, bfTxGasPrice, ratioPriority)
log.Infof("egp-dbg breakEvenGasPrice: %v, bfL2GasPrice: %v, bfTxGasPrice: %v, ratioPriority: %v", breakEvenGasPrice, bfL2GasPrice, bfTxGasPrice, ratioPriority)

bfEffectiveGasPrice := new(big.Float).Mul(new(big.Float).SetInt(breakEvenGasPrice), ratioPriority)

Expand Down

0 comments on commit 5b139b4

Please sign in to comment.