@@ -120,6 +120,15 @@ func NewSender(ctx context.Context, config *config.SenderConfig, privs []*ecdsa.
120
120
return nil , err
121
121
}
122
122
123
+ var baseFeePerGas uint64
124
+ if config .TxType == DynamicFeeTxType {
125
+ if header .BaseFee != nil {
126
+ baseFeePerGas = header .BaseFee .Uint64 ()
127
+ } else {
128
+ return nil , errors .New ("DynamicFeeTxType not supported, header.BaseFee nil" )
129
+ }
130
+ }
131
+
123
132
sender := & Sender {
124
133
ctx : ctx ,
125
134
config : config ,
@@ -128,7 +137,7 @@ func NewSender(ctx context.Context, config *config.SenderConfig, privs []*ecdsa.
128
137
auths : auths ,
129
138
confirmCh : make (chan * Confirmation , 128 ),
130
139
blockNumber : header .Number .Uint64 (),
131
- baseFeePerGas : header . BaseFee . Uint64 () ,
140
+ baseFeePerGas : baseFeePerGas ,
132
141
pendingTxs : sync.Map {},
133
142
stopCh : make (chan struct {}),
134
143
}
@@ -356,7 +365,13 @@ func (s *Sender) resubmitTransaction(feeData *FeeData, auth *bind.TransactOpts,
356
365
func (s * Sender ) CheckPendingTransaction (header * types.Header ) {
357
366
number := header .Number .Uint64 ()
358
367
atomic .StoreUint64 (& s .blockNumber , number )
359
- atomic .StoreUint64 (& s .baseFeePerGas , header .BaseFee .Uint64 ())
368
+ if s .config .TxType == DynamicFeeTxType {
369
+ if header .BaseFee != nil {
370
+ atomic .StoreUint64 (& s .baseFeePerGas , header .BaseFee .Uint64 ())
371
+ } else {
372
+ log .Error ("DynamicFeeTxType not supported, header.BaseFee nil" )
373
+ }
374
+ }
360
375
s .pendingTxs .Range (func (key , value interface {}) bool {
361
376
// ignore empty id, since we use empty id to occupy pending task
362
377
if value == nil || reflect .ValueOf (value ).IsNil () {
0 commit comments