@@ -17,20 +17,26 @@ import (
1717
1818type attemptBuilder struct {
1919 gas.EvmFeeEstimator
20- priceMaxKey func (common.Address ) * assets.Wei
21- keystore keys.TxSigner
20+ priceMaxKey func (common.Address ) * assets.Wei
21+ keystore keys.TxSigner
22+ emptyTxLimitDefault uint64
2223}
2324
24- func NewAttemptBuilder (priceMaxKey func (common.Address ) * assets.Wei , estimator gas.EvmFeeEstimator , keystore keys.TxSigner ) * attemptBuilder {
25+ func NewAttemptBuilder (priceMaxKey func (common.Address ) * assets.Wei , estimator gas.EvmFeeEstimator , keystore keys.TxSigner , emptyTxLimitDefault uint64 ) * attemptBuilder {
2526 return & attemptBuilder {
26- priceMaxKey : priceMaxKey ,
27- EvmFeeEstimator : estimator ,
28- keystore : keystore ,
27+ priceMaxKey : priceMaxKey ,
28+ EvmFeeEstimator : estimator ,
29+ keystore : keystore ,
30+ emptyTxLimitDefault : emptyTxLimitDefault ,
2931 }
3032}
3133
3234func (a * attemptBuilder ) NewAttempt (ctx context.Context , lggr logger.Logger , tx * types.Transaction , dynamic bool ) (* types.Attempt , error ) {
33- fee , estimatedGasLimit , err := a .EvmFeeEstimator .GetFee (ctx , tx .Data , tx .SpecifiedGasLimit , a .priceMaxKey (tx .FromAddress ), & tx .FromAddress , & tx .ToAddress )
35+ gasLimit := tx .SpecifiedGasLimit
36+ if tx .IsPurgeable {
37+ gasLimit = a .emptyTxLimitDefault
38+ }
39+ fee , estimatedGasLimit , err := a .EvmFeeEstimator .GetFee (ctx , tx .Data , gasLimit , a .priceMaxKey (tx .FromAddress ), & tx .FromAddress , & tx .ToAddress )
3440 if err != nil {
3541 return nil , err
3642 }
@@ -42,7 +48,11 @@ func (a *attemptBuilder) NewAttempt(ctx context.Context, lggr logger.Logger, tx
4248}
4349
4450func (a * attemptBuilder ) NewBumpAttempt (ctx context.Context , lggr logger.Logger , tx * types.Transaction , previousAttempt types.Attempt ) (* types.Attempt , error ) {
45- bumpedFee , bumpedFeeLimit , err := a .EvmFeeEstimator .BumpFee (ctx , previousAttempt .Fee , tx .SpecifiedGasLimit , a .priceMaxKey (tx .FromAddress ), nil )
51+ gasLimit := tx .SpecifiedGasLimit
52+ if tx .IsPurgeable {
53+ gasLimit = a .emptyTxLimitDefault
54+ }
55+ bumpedFee , bumpedFeeLimit , err := a .EvmFeeEstimator .BumpFee (ctx , previousAttempt .Fee , gasLimit , a .priceMaxKey (tx .FromAddress ), nil )
4656 if err != nil {
4757 return nil , err
4858 }
0 commit comments