accounts/abi/bind: check invalid chainID first (#29275)
This commit is contained in:
parent
6b3d4d068a
commit
eda9c7e36f
|
@ -142,10 +142,10 @@ func NewKeyStoreTransactorWithChainID(keystore *keystore.KeyStore, account accou
|
||||||
// NewKeyedTransactorWithChainID is a utility method to easily create a transaction signer
|
// NewKeyedTransactorWithChainID is a utility method to easily create a transaction signer
|
||||||
// from a single private key.
|
// from a single private key.
|
||||||
func NewKeyedTransactorWithChainID(key *ecdsa.PrivateKey, chainID *big.Int) (*TransactOpts, error) {
|
func NewKeyedTransactorWithChainID(key *ecdsa.PrivateKey, chainID *big.Int) (*TransactOpts, error) {
|
||||||
keyAddr := crypto.PubkeyToAddress(key.PublicKey)
|
|
||||||
if chainID == nil {
|
if chainID == nil {
|
||||||
return nil, ErrNoChainID
|
return nil, ErrNoChainID
|
||||||
}
|
}
|
||||||
|
keyAddr := crypto.PubkeyToAddress(key.PublicKey)
|
||||||
signer := types.LatestSignerForChainID(chainID)
|
signer := types.LatestSignerForChainID(chainID)
|
||||||
return &TransactOpts{
|
return &TransactOpts{
|
||||||
From: keyAddr,
|
From: keyAddr,
|
||||||
|
|
Loading…
Reference in New Issue