You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ideally HeaderByNumber returns nil header only when there is any error (i.e. error is not nil).
But sometimes it returns nil header and nil error together.
The error check during error handling is false as the error is nil , so fetching the returned nil header results in panic: runtime error: invalid memory address or nil pointer dereference
The text was updated successfully, but these errors were encountered:
In function CheckIfAnyError() we iterate over the returned values of a function and check for error.
We compare the data type of errors.New("RPC Timeout error") with returned value, if it's same we consider that as a returned error and update errorIndexInReturnedValues.
The problem here is reflect.TypeOf(errors.New("RPC Timeout error")) returns *errors.errorString,
while taking in consideration any RPC error e.g
ERROR: Post "https://staging-v2.skalenodes.com/v1/whispering-turais": dial tcp: lookup staging-v2.skalenodes.com: no such host
It's of type *url.Error. which is not same as data type of our custom rpc error.
So even when there is an error returned by a function , CheckIfAnyError() says there is no error due to incorrect comparison of data types.
oracle-node version:
v1.3.0-alpha
Describe the bug
Ideally
HeaderByNumber
returns nil header only when there is any error (i.e. error is not nil).But sometimes it returns nil header and nil error together.
The error check during error handling is false as the error is nil , so fetching the returned nil header results in
panic: runtime error: invalid memory address or nil pointer dereference
The text was updated successfully, but these errors were encountered: