File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,13 @@ var supportedTxs = map[string]func() TxDataV2{
2121
2222// getSender extracts the sender address from the signature values using the latest signer for the given chainID.
2323func getSender (txData TxDataV2 ) (common.Address , error ) {
24- signer := ethtypes .LatestSignerForChainID (txData .GetChainID ())
24+ chainID := txData .GetChainID ()
25+ // legacy tx returns `0` as chainID when EIP-155 is not used
26+ // seee: DeriveChainID
27+ if chainID != nil && chainID .Sign () == 0 {
28+ chainID = nil
29+ }
30+ signer := ethtypes .LatestSignerForChainID (chainID )
2531 from , err := signer .Sender (ethtypes .NewTx (txData .AsEthereumData ()))
2632 if err != nil {
2733 return common.Address {}, err
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ import "math/big"
99// - {0,1} + CHAIN_ID * 2 + 35, if EIP155 is used
1010// - {0,1} + 27, otherwise
1111//
12+ // when EIP155 is not used, chain id `0` is returned.
13+ //
1214// Ref: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md
1315func DeriveChainID (v * big.Int ) * big.Int {
1416 if v == nil || v .Sign () < 1 {
You can’t perform that action at this time.
0 commit comments