From 365197d04629143a81367b01e50e8b12b64ca140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 13 Aug 2021 12:54:33 +0300 Subject: [PATCH] accounts/external: handle 0 chainid as not-set for the Clef API --- accounts/external/backend.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/accounts/external/backend.go b/accounts/external/backend.go index b2de9e932af9..534115a76a10 100644 --- a/accounts/external/backend.go +++ b/accounts/external/backend.go @@ -218,17 +218,17 @@ func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transactio args.MaxFeePerGas = (*hexutil.Big)(tx.GasFeeCap()) args.MaxPriorityFeePerGas = (*hexutil.Big)(tx.GasTipCap()) default: - return nil, fmt.Errorf("Unsupported tx type %d", tx.Type()) + return nil, fmt.Errorf("unsupported tx type %d", tx.Type()) } // We should request the default chain id that we're operating with // (the chain we're executing on) - if chainID != nil { + if chainID != nil && chainID.Sign() != 0 { args.ChainID = (*hexutil.Big)(chainID) } if tx.Type() != types.LegacyTxType { // However, if the user asked for a particular chain id, then we should // use that instead. - if tx.ChainId() != nil { + if tx.ChainId().Sign() != 0 { args.ChainID = (*hexutil.Big)(tx.ChainId()) } accessList := tx.AccessList()