Skip to content

Commit

Permalink
accounts/external: handle 0 chainid as not-set for the Clef API
Browse files Browse the repository at this point in the history
  • Loading branch information
karalabe committed Aug 13, 2021
1 parent fd604be commit 365197d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions accounts/external/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 365197d

Please sign in to comment.