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
When analyzing the code and writing my own hub, I struggled with the server.version method. In LBRY a request of server.version looks like {"method":"server.version","id":58,"jsonrpc":"2.0","params":["0.113.0","0.113.0"]} and a response looks like {"jsonrpc":"2.0","result":["0.107.0","0.113.0"],"id":47}. At first glance, it doesn't look compatible with the server.version of Electrum, but it is.
First the request. Electrum defines server.version(client_name, protocol_version), where client_name is the name of the client and protocol_version is the supported version or range of supported versions of the client. When looking at the code at https://github.com/lbryio/hub/blob/ebcc6e508660f72fe11d308ae4031971b5fbf782/hub/herald/session.py#L1688, this is indeed the case. The LBRY request is fully compatible with the Electrum request, so it is also possible to send a request like {"method":"server.version","id":58,"jsonrpc":"2.0","params":["LBRY Desktop 1.0.0","0.113.0"]} or {"method":"server.version","id":58,"jsonrpc":"2.0","params":["LBRY Desktop 1.0.0",["0.113.0","0.113.0"]]}.
Note the response[0]. Why does this client code check for the first variable? The protocol information is in the second variable. I assume that response[1] is the right solution.
Dear,
When analyzing the code and writing my own hub, I struggled with the
server.version
method. In LBRY a request ofserver.version
looks like{"method":"server.version","id":58,"jsonrpc":"2.0","params":["0.113.0","0.113.0"]}
and a response looks like{"jsonrpc":"2.0","result":["0.107.0","0.113.0"],"id":47}
. At first glance, it doesn't look compatible with theserver.version
of Electrum, but it is.First the request. Electrum defines
server.version(client_name, protocol_version)
, whereclient_name
is the name of the client andprotocol_version
is the supported version or range of supported versions of the client. When looking at the code at https://github.com/lbryio/hub/blob/ebcc6e508660f72fe11d308ae4031971b5fbf782/hub/herald/session.py#L1688, this is indeed the case. The LBRY request is fully compatible with the Electrum request, so it is also possible to send a request like{"method":"server.version","id":58,"jsonrpc":"2.0","params":["LBRY Desktop 1.0.0","0.113.0"]}
or{"method":"server.version","id":58,"jsonrpc":"2.0","params":["LBRY Desktop 1.0.0",["0.113.0","0.113.0"]]}
.Then the response. Electrum defines it as returning
[server_software_version, protocol_version]
, whereserver_software_version
is the name of server andprotocol_version
is the chosen protocol version by the server to communicate with. Looking at https://github.com/lbryio/hub/blob/ebcc6e508660f72fe11d308ae4031971b5fbf782/hub/herald/session.py#L1695 and https://github.com/lbryio/hub/blob/ebcc6e508660f72fe11d308ae4031971b5fbf782/hub/herald/session.py#L1723, it indeed returns 2 variables.Now we take a look at the following code:
lbry-sdk/lbry/wallet/network.py
Line 106 in eb5da95
Note the
response[0]
. Why does this client code check for the first variable? The protocol information is in the second variable. I assume thatresponse[1]
is the right solution.Also, some logging (note line 106):
The text was updated successfully, but these errors were encountered: