mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-20 11:46:44 +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 {
|
if baseFee == nil {
|
||||||
return dst.Set(tx.GasFeeCap.ToBig())
|
return dst.Set(tx.GasFeeCap.ToBig())
|
||||||
}
|
}
|
||||||
tip := dst.Sub(tx.GasFeeCap.ToBig(), baseFee)
|
effectiveGasPrice := dst.Add(tx.GasTipCap.ToBig(), baseFee)
|
||||||
if tip.Cmp(tx.GasTipCap.ToBig()) > 0 {
|
gasFeeCap := tx.GasFeeCap.ToBig()
|
||||||
tip.Set(tx.GasTipCap.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) {
|
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 {
|
if baseFee == nil {
|
||||||
return dst.Set(tx.GasFeeCap)
|
return dst.Set(tx.GasFeeCap)
|
||||||
}
|
}
|
||||||
tip := dst.Sub(tx.GasFeeCap, baseFee)
|
effectiveGasPrice := dst.Add(tx.GasTipCap, baseFee)
|
||||||
if tip.Cmp(tx.GasTipCap) > 0 {
|
if effectiveGasPrice.Cmp(tx.GasFeeCap) > 0 {
|
||||||
tip.Set(tx.GasTipCap)
|
effectiveGasPrice.Set(tx.GasFeeCap)
|
||||||
}
|
}
|
||||||
return tip.Add(tip, baseFee)
|
return effectiveGasPrice
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tx *DynamicFeeTx) rawSignatureValues() (v, r, s *big.Int) {
|
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 {
|
if baseFee == nil {
|
||||||
return dst.Set(tx.GasFeeCap.ToBig())
|
return dst.Set(tx.GasFeeCap.ToBig())
|
||||||
}
|
}
|
||||||
tip := dst.Sub(tx.GasFeeCap.ToBig(), baseFee)
|
effectiveGasPrice := dst.Add(tx.GasTipCap.ToBig(), baseFee)
|
||||||
if tip.Cmp(tx.GasTipCap.ToBig()) > 0 {
|
gasTipCap := tx.GasFeeCap.ToBig()
|
||||||
tip.Set(tx.GasTipCap.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) {
|
func (tx *SetCodeTx) rawSignatureValues() (v, r, s *big.Int) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue