Skip to content

Commit

Permalink
core/types: remove duplication in eip2930 signer (ethereum#27860)
Browse files Browse the repository at this point in the history
Remove duplication in signer
---------

Co-authored-by: GDdark <[email protected]>
Co-authored-by: Felix Lange <[email protected]>
  • Loading branch information
3 people authored Aug 11, 2023
1 parent 8f8ef2b commit 80b76a9
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions core/types/transaction_signing.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,7 @@ func (s eip2930Signer) Sender(tx *Transaction) (common.Address, error) {
V, R, S := tx.RawSignatureValues()
switch tx.Type() {
case LegacyTxType:
if !tx.Protected() {
return HomesteadSigner{}.Sender(tx)
}
V = new(big.Int).Sub(V, s.chainIdMul)
V.Sub(V, big8)
return s.EIP155Signer.Sender(tx)
case AccessListTxType:
// AL txs are defined to use 0 and 1 as their recovery
// id, add 27 to become equivalent to unprotected Homestead signatures.
Expand Down Expand Up @@ -372,15 +368,7 @@ func (s eip2930Signer) SignatureValues(tx *Transaction, sig []byte) (R, S, V *bi
func (s eip2930Signer) Hash(tx *Transaction) common.Hash {
switch tx.Type() {
case LegacyTxType:
return rlpHash([]interface{}{
tx.Nonce(),
tx.GasPrice(),
tx.Gas(),
tx.To(),
tx.Value(),
tx.Data(),
s.chainId, uint(0), uint(0),
})
return s.EIP155Signer.Hash(tx)
case AccessListTxType:
return prefixedRlpHash(
tx.Type(),
Expand Down

0 comments on commit 80b76a9

Please sign in to comment.