Skip to content

Commit

Permalink
core/types: don't check chainid before determining if protected
Browse files Browse the repository at this point in the history
  • Loading branch information
lightclient committed Jan 8, 2021
1 parent 14f93c4 commit 254a593
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/types/transaction_signing.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ func NewEIP2718Signer(chainId *big.Int) EIP2718Signer {

// Sender returns the recovered addressed from a transaction's signature.
func (s EIP2718Signer) Sender(tx *Transaction) (common.Address, error) {
if tx.ChainId().Cmp(s.chainId) != 0 {
return common.Address{}, ErrInvalidChainId
}
V, R, S := tx.RawSignatureValues()
if tx.Type() == LegacyTxId {
if !tx.Protected() {
Expand All @@ -130,6 +127,9 @@ func (s EIP2718Signer) Sender(tx *Transaction) (common.Address, error) {
// 27 to become equivalent to unprotected Homestead signatures.
V = new(big.Int).Add(V, big.NewInt(27))
}
if tx.ChainId().Cmp(s.chainId) != 0 {
return common.Address{}, ErrInvalidChainId
}
return recoverPlain(s.Hash(tx), R, S, V, true)
}

Expand Down

0 comments on commit 254a593

Please sign in to comment.