Closed nkuba closed 1 year ago
@checksum0 will you be interested in merging this PR? We confirmed errors are handled correctly with integration tests in https://github.com/keep-network/keep-core/pull/3567.
Closing in favor of https://github.com/checksum0/go-electrum/pull/9.
Closes: https://github.com/checksum0/go-electrum/issues/5
Here we provide a workaround for servers that don't follow the JSON-RPC 2.0 specification for error objects.
According to the specification, an error should be an object containing
code
,message
, anddata
properties (see: https://www.jsonrpc.org/specification#error_object). Unfortunately, Electrs returns an error as a string (see: https://github.com/Blockstream/esplora/issues/453).We define an error unmarshaling function to handle both types of errors.
Sample outputs from servers that the client has to handle: ElectrumX
Fulcrum
Esplora/Electrs