@ -190,7 +190,7 @@ func (s londonSigner) Sender(tx *Transaction) (common.Address, error) {
// id, add 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 common . Address { } , fmt . Errorf ( "%w: have %d want %d" , ErrInvalidChainId , tx . ChainId ( ) , s . chainId )
}
return recoverPlain ( s . Hash ( tx ) , R , S , V , true )
}
@ -208,7 +208,7 @@ func (s londonSigner) SignatureValues(tx *Transaction, sig []byte) (R, S, V *big
// Check that chain ID of tx matches the signer. We also accept ID zero here,
// because it indicates that the chain ID was not specified in the tx.
if txdata . ChainID . Sign ( ) != 0 && txdata . ChainID . Cmp ( s . chainId ) != 0 {
return nil , nil , nil , ErrInvalidChainId
return nil , nil , nil , fmt . Errorf ( "%w: have %d want %d" , ErrInvalidChainId , txdata . ChainID , s . chainId )
}
R , S , _ = decodeSignature ( sig )
V = big . NewInt ( int64 ( sig [ 64 ] ) )
@ -270,7 +270,7 @@ func (s eip2930Signer) Sender(tx *Transaction) (common.Address, error) {
return common . Address { } , ErrTxTypeNotSupported
}
if tx . ChainId ( ) . Cmp ( s . chainId ) != 0 {
return common . Address { } , ErrInvalidChainId
return common . Address { } , fmt . Errorf ( "%w: have %d want %d" , ErrInvalidChainId , tx . ChainId ( ) , s . chainId )
}
return recoverPlain ( s . Hash ( tx ) , R , S , V , true )
}
@ -283,7 +283,7 @@ func (s eip2930Signer) SignatureValues(tx *Transaction, sig []byte) (R, S, V *bi
// Check that chain ID of tx matches the signer. We also accept ID zero here,
// because it indicates that the chain ID was not specified in the tx.
if txdata . ChainID . Sign ( ) != 0 && txdata . ChainID . Cmp ( s . chainId ) != 0 {
return nil , nil , nil , ErrInvalidChainId
return nil , nil , nil , fmt . Errorf ( "%w: have %d want %d" , ErrInvalidChainId , txdata . ChainID , s . chainId )
}
R , S , _ = decodeSignature ( sig )
V = big . NewInt ( int64 ( sig [ 64 ] ) )
@ -364,7 +364,7 @@ func (s EIP155Signer) Sender(tx *Transaction) (common.Address, error) {
return HomesteadSigner { } . Sender ( tx )
}
if tx . ChainId ( ) . Cmp ( s . chainId ) != 0 {
return common . Address { } , ErrInvalidChainId
return common . Address { } , fmt . Errorf ( "%w: have %d want %d" , ErrInvalidChainId , tx . ChainId ( ) , s . chainId )
}
V , R , S := tx . RawSignatureValues ( )
V = new ( big . Int ) . Sub ( V , s . chainIdMul )