From 1ba3d1fd91d2f55b262b2d1f7827723c7b32f493 Mon Sep 17 00:00:00 2001 From: KibGzr Date: Thu, 21 Oct 2021 16:40:35 +0700 Subject: [PATCH] accounts/abi/bind: fix error handling in baseFee query (#23781) This fixes a panic that occurs when HeaderByNumber() returns an error. --- accounts/abi/bind/base.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/abi/bind/base.go b/accounts/abi/bind/base.go index 2826a97340aa..c0c0f3e62b9d 100644 --- a/accounts/abi/bind/base.go +++ b/accounts/abi/bind/base.go @@ -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)