mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 11:20:45 +00:00
core/types: improve effectiveGasPrice
This commit is contained in:
parent
9a8e14e77e
commit
ba80c16384
3 changed files with 14 additions and 12 deletions
|
|
@ -295,11 +295,12 @@ func (tx *BlobTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
|
|||
if baseFee == nil {
|
||||
return dst.Set(tx.GasFeeCap.ToBig())
|
||||
}
|
||||
tip := dst.Sub(tx.GasFeeCap.ToBig(), baseFee)
|
||||
if tip.Cmp(tx.GasTipCap.ToBig()) > 0 {
|
||||
tip.Set(tx.GasTipCap.ToBig())
|
||||
effectiveGasPrice := dst.Add(tx.GasTipCap.ToBig(), baseFee)
|
||||
gasFeeCap := tx.GasFeeCap.ToBig()
|
||||
if effectiveGasPrice.Cmp(gasFeeCap) > 0 {
|
||||
effectiveGasPrice.Set(gasFeeCap)
|
||||
}
|
||||
return tip.Add(tip, baseFee)
|
||||
return effectiveGasPrice
|
||||
}
|
||||
|
||||
func (tx *BlobTx) rawSignatureValues() (v, r, s *big.Int) {
|
||||
|
|
|
|||
|
|
@ -101,11 +101,11 @@ func (tx *DynamicFeeTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.I
|
|||
if baseFee == nil {
|
||||
return dst.Set(tx.GasFeeCap)
|
||||
}
|
||||
tip := dst.Sub(tx.GasFeeCap, baseFee)
|
||||
if tip.Cmp(tx.GasTipCap) > 0 {
|
||||
tip.Set(tx.GasTipCap)
|
||||
effectiveGasPrice := dst.Add(tx.GasTipCap, baseFee)
|
||||
if effectiveGasPrice.Cmp(tx.GasFeeCap) > 0 {
|
||||
effectiveGasPrice.Set(tx.GasFeeCap)
|
||||
}
|
||||
return tip.Add(tip, baseFee)
|
||||
return effectiveGasPrice
|
||||
}
|
||||
|
||||
func (tx *DynamicFeeTx) rawSignatureValues() (v, r, s *big.Int) {
|
||||
|
|
|
|||
|
|
@ -202,11 +202,12 @@ func (tx *SetCodeTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int
|
|||
if baseFee == nil {
|
||||
return dst.Set(tx.GasFeeCap.ToBig())
|
||||
}
|
||||
tip := dst.Sub(tx.GasFeeCap.ToBig(), baseFee)
|
||||
if tip.Cmp(tx.GasTipCap.ToBig()) > 0 {
|
||||
tip.Set(tx.GasTipCap.ToBig())
|
||||
effectiveGasPrice := dst.Add(tx.GasTipCap.ToBig(), baseFee)
|
||||
gasTipCap := tx.GasFeeCap.ToBig()
|
||||
if effectiveGasPrice.Cmp(gasTipCap) > 0 {
|
||||
effectiveGasPrice.Set(gasTipCap)
|
||||
}
|
||||
return tip.Add(tip, baseFee)
|
||||
return effectiveGasPrice
|
||||
}
|
||||
|
||||
func (tx *SetCodeTx) rawSignatureValues() (v, r, s *big.Int) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue