mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
Reflect PR comments
This commit is contained in:
parent
d1a6f5d81e
commit
1a1c1a4718
3 changed files with 9 additions and 16 deletions
|
|
@ -356,11 +356,11 @@ func (tx *Transaction) GasTipCapIntCmp(other *big.Int) int {
|
|||
// the actual negative value, _and_ ErrGasFeeCapTooLow
|
||||
func (tx *Transaction) EffectiveGasTip(baseFee *big.Int) (*big.Int, error) {
|
||||
dst := new(big.Int)
|
||||
err := tx.EffectiveGasTipInto(dst, baseFee)
|
||||
err := tx.effectiveGasTipInto(dst, baseFee)
|
||||
return dst, err
|
||||
}
|
||||
|
||||
func (tx *Transaction) EffectiveGasTipInto(dst *big.Int, baseFee *big.Int) error {
|
||||
func (tx *Transaction) effectiveGasTipInto(dst *big.Int, baseFee *big.Int) error {
|
||||
if baseFee == nil {
|
||||
dst.Set(tx.inner.gasTipCap())
|
||||
return nil
|
||||
|
|
@ -380,14 +380,6 @@ func (tx *Transaction) EffectiveGasTipInto(dst *big.Int, baseFee *big.Int) error
|
|||
return err
|
||||
}
|
||||
|
||||
// EffectiveGasTipValue is identical to EffectiveGasTip, but does not return an
|
||||
// error in case the effective gasTipCap is negative
|
||||
func (tx *Transaction) EffectiveGasTipValue(baseFee *big.Int) *big.Int {
|
||||
dst := new(big.Int)
|
||||
tx.EffectiveGasTipInto(dst, baseFee)
|
||||
return dst
|
||||
}
|
||||
|
||||
// EffectiveGasTipCmp compares the effective gasTipCap of two transactions assuming the given base fee.
|
||||
func (tx *Transaction) EffectiveGasTipCmp(other *Transaction, baseFee *big.Int) int {
|
||||
if baseFee == nil {
|
||||
|
|
@ -395,8 +387,8 @@ func (tx *Transaction) EffectiveGasTipCmp(other *Transaction, baseFee *big.Int)
|
|||
}
|
||||
txTip := new(big.Int)
|
||||
otherTip := new(big.Int)
|
||||
tx.EffectiveGasTipInto(txTip, baseFee)
|
||||
other.EffectiveGasTipInto(otherTip, baseFee)
|
||||
tx.effectiveGasTipInto(txTip, baseFee)
|
||||
other.effectiveGasTipInto(otherTip, baseFee)
|
||||
return txTip.Cmp(otherTip)
|
||||
}
|
||||
|
||||
|
|
@ -406,7 +398,7 @@ func (tx *Transaction) EffectiveGasTipIntCmp(other *big.Int, baseFee *big.Int) i
|
|||
return tx.GasTipCapIntCmp(other)
|
||||
}
|
||||
txTip := new(big.Int)
|
||||
tx.EffectiveGasTipInto(txTip, baseFee)
|
||||
tx.effectiveGasTipInto(txTip, baseFee)
|
||||
return txTip.Cmp(other)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -625,7 +625,7 @@ func BenchmarkEffectiveGasTip(b *testing.B) {
|
|||
b.ReportAllocs()
|
||||
dst := new(big.Int)
|
||||
for i := 0; i < b.N; i++ {
|
||||
err := tx.EffectiveGasTipInto(dst, baseFee)
|
||||
err := tx.effectiveGasTipInto(dst, baseFee)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
|
@ -675,7 +675,7 @@ func TestEffectiveGasTipInto(t *testing.T) {
|
|||
|
||||
// Get result from new method
|
||||
dst := new(big.Int)
|
||||
newErr := tx.EffectiveGasTipInto(dst, baseFee)
|
||||
newErr := tx.effectiveGasTipInto(dst, baseFee)
|
||||
|
||||
// Compare results
|
||||
if (origErr != nil) != (newErr != nil) {
|
||||
|
|
|
|||
|
|
@ -260,7 +260,8 @@ func (t *jsTracer) OnTxStart(env *tracing.VMContext, tx *types.Transaction, from
|
|||
t.activePrecompiles = vm.ActivePrecompiles(rules)
|
||||
t.ctx["block"] = t.vm.ToValue(t.env.BlockNumber.Uint64())
|
||||
t.ctx["gas"] = t.vm.ToValue(tx.Gas())
|
||||
gasPriceBig, err := t.toBig(t.vm, tx.EffectiveGasTipValue(env.BaseFee).String())
|
||||
gasTip, _ := tx.EffectiveGasTip(env.BaseFee)
|
||||
gasPriceBig, err := t.toBig(t.vm, gasTip.String())
|
||||
if err != nil {
|
||||
t.err = err
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in a new issue