mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
Some chains’ network IDs use hexadecimal such as Optimism ("0xa" instead
of "10"), so when converting the string to big.Int, we cannot specify
base 10; otherwise, it will encounter errors with hexadecimal network
IDs.
Co-authored-by: Zhihao Lin <3955922+kkqy@users.noreply.github.com>
This commit is contained in:
parent
e1a407d2c0
commit
0662224c31
1 changed files with 1 additions and 1 deletions
|
|
@ -365,7 +365,7 @@ func (ec *Client) NetworkID(ctx context.Context) (*big.Int, error) {
|
|||
if err := ec.c.CallContext(ctx, &ver, "net_version"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _, ok := version.SetString(ver, 10); !ok {
|
||||
if _, ok := version.SetString(ver, 0); !ok {
|
||||
return nil, fmt.Errorf("invalid net_version result %q", ver)
|
||||
}
|
||||
return version, nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue