Skip to content

Commit 825899b

Browse files
committed
Fix RecoverSender
1 parent 1a3ee22 commit 825899b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

wallet/signer.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ func NewEIP155Signer(chainID uint64) *EIP1155Signer {
2525

2626
func (e *EIP1155Signer) RecoverSender(tx *ethgo.Transaction) (ethgo.Address, error) {
2727
v := new(big.Int).SetBytes(tx.V).Uint64()
28-
v -= e.chainID * 2
29-
v -= 8
30-
v -= 27
28+
if v > 1 {
29+
v -= 27
30+
if v > 1 {
31+
v -= e.chainID * 2
32+
v -= 8
33+
}
34+
}
3135

3236
sig, err := encodeSignature(tx.R, tx.S, byte(v))
3337
if err != nil {

0 commit comments

Comments
 (0)