chris-belcher / electrum-personal-server

Maximally lightweight electrum server for a single user
MIT License
602 stars 110 forks source link

server.version without arguments crashes the server #187

Closed Overtorment closed 4 years ago

Overtorment commented 4 years ago
Traceback (most recent call last):
  File "/usr/local/bin/electrum-personal-server", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/electrumpersonalserver/server/common.py", line 421, in main
    run_electrum_server(rpc, txmonitor, config)
  File "/usr/local/lib/python3.6/dist-packages/electrumpersonalserver/server/common.py", line 142, in run_electrum_server
    protocol.handle_query(query)
  File "/usr/local/lib/python3.6/dist-packages/electrumpersonalserver/server/electrumprotocol.py", line 458, in handle_query
    client_protocol_version = query["params"][1]
IndexError: list index out of range
chris-belcher commented 4 years ago

Thanks for the issue.

chris-belcher commented 4 years ago

According to this doc: https://github.com/kyuupichan/electrumx/blob/master/docs/protocol-methods.rst#serverversion if the server and client have no versions in common then the server should close the connection. So to deal with this issue I think EPS should close the connection if no version number is provided.

But I don't want to break things, so which client application did you use when this crash happened?

Overtorment commented 4 years ago

bluewallet. when do the same call to electrumx it replies with actual server version:

image

chris-belcher commented 4 years ago

I guess I'll make it so that if the client doesn't provide a version we'll just assume its the latest version.