mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
accounts: EIP-2718: Typed Transaction Envelope + EIP-2930 (#21502)
This commit is contained in:
parent
01d3be7eb8
commit
146ea8ba78
3 changed files with 3 additions and 4 deletions
|
|
@ -118,7 +118,7 @@ func NewKeyStoreTransactorWithChainID(keystore *keystore.KeyStore, account accou
|
|||
if chainID == nil {
|
||||
return nil, ErrNoChainID
|
||||
}
|
||||
signer := types.NewEIP155Signer(chainID)
|
||||
signer := types.LatestSignerForChainID(chainID)
|
||||
return &TransactOpts{
|
||||
From: account.Address,
|
||||
Signer: func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
|
||||
|
|
@ -141,7 +141,7 @@ func NewKeyedTransactorWithChainID(key *ecdsa.PrivateKey, chainID *big.Int) (*Tr
|
|||
if chainID == nil {
|
||||
return nil, ErrNoChainID
|
||||
}
|
||||
signer := types.NewEIP155Signer(chainID)
|
||||
signer := types.LatestSignerForChainID(chainID)
|
||||
return &TransactOpts{
|
||||
From: keyAddr,
|
||||
Signer: func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
|
||||
|
|
|
|||
|
|
@ -319,7 +319,6 @@ func (ks *KeyStore) SignTxWithPassphrase(a accounts.Account, passphrase string,
|
|||
return nil, err
|
||||
}
|
||||
defer zeroKey(key.PrivateKey)
|
||||
|
||||
// Depending on the presence of the chain ID, sign with or without replay protection.
|
||||
signer := types.LatestSignerForChainID(chainID)
|
||||
return types.SignTx(tx, signer, key.PrivateKey)
|
||||
|
|
|
|||
|
|
@ -699,7 +699,7 @@ func (w *Wallet) SignHash(account accounts.Account, hash []byte) ([]byte, error)
|
|||
// the needed details via SignTxWithPassphrase, or by other means (e.g. unlock
|
||||
// the account in a keystore).
|
||||
func (w *Wallet) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {
|
||||
signer := types.NewEIP155Signer(chainID)
|
||||
signer := types.LatestSignerForChainID(chainID)
|
||||
hash := signer.Hash(tx)
|
||||
sig, err := w.SignHash(account, hash[:])
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue