Skip to content

Commit c2e64db

Browse files
accounts/abi/bind/backends: make suggestGasPrice compatible with non-1559 chains (ethereum#23840)
1 parent 1e4becb commit c2e64db

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

accounts/abi/bind/backends/simulated.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,10 @@ func (b *SimulatedBackend) PendingNonceAt(ctx context.Context, account common.Ad
462462
// SuggestGasPrice implements ContractTransactor.SuggestGasPrice. Since the simulated
463463
// chain doesn't have miners, we just return a gas price of 1 for any call.
464464
func (b *SimulatedBackend) SuggestGasPrice(ctx context.Context) (*big.Int, error) {
465-
return b.pendingBlock.Header().BaseFee, nil
465+
if b.pendingBlock.Header().BaseFee != nil {
466+
return b.pendingBlock.Header().BaseFee, nil
467+
}
468+
return big.NewInt(1), nil
466469
}
467470

468471
// SuggestGasTipCap implements ContractTransactor.SuggestGasTipCap. Since the simulated

0 commit comments

Comments
 (0)