Skip to content

Commit

Permalink
accounts/abi/bind: fix error handling in baseFee query (ethereum#23781)
Browse files Browse the repository at this point in the history
This fixes a panic that occurs when HeaderByNumber() returns an error.
  • Loading branch information
kibgzr authored and gzliudan committed Aug 22, 2024
1 parent 7eeeeb9 commit 8f9ae76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion accounts/abi/bind/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func (c *BoundContract) transact(opts *TransactOpts, contract *common.Address, i
rawTx, err = c.createLegacyTx(opts, contract, input)
} else {
// Only query for basefee if gasPrice not specified
if head, errHead := c.transactor.HeaderByNumber(ensureContext(opts.Context), nil); err != nil {
if head, errHead := c.transactor.HeaderByNumber(ensureContext(opts.Context), nil); errHead != nil {
return nil, errHead
} else if head.BaseFee != nil {
rawTx, err = c.createDynamicTx(opts, contract, input, head)
Expand Down

0 comments on commit 8f9ae76

Please sign in to comment.