electrumx
electrumx copied to clipboard
ElectrumX should accept local incoming connections even if it has not fully caught up with the bitcoin daemon
Steps to reproduce:
- Setup ElectrumX.
- Setup electrum with
oneserver
connecting one's own ElectrumX server that was just set up and is not fully blockchain synced yet.
Expected result:
ElectrumX accepts local incoming connection.
Actual result:
ElectrumX does not accept local incoming3 connection.
Issue
Quote https://electrumx-spesmilo.readthedocs.io/en/latest/environment.html
ElectrumX will not serve any incoming connections until it has fully caught up with your bitcoin daemon.
I am arguing that this shouldn't be the case. Should be changed. This seems to be a bug at least in context of using electrum with one's own self-hosted, local ElectrumX server.
ElectrumX should be supporting a local rcp connection when not synced to the tip of the blockchain, at least if some option (environment variable) is configured.
Why is that an issue?
Unexpected and very difficult to figure out what's wrong.
It is highly unusual to open/close a server/service (local) port depending on some internal state (progress of blockchain synchronization). This is the first server application which I've ever seen which is doing this. For example, if nginx is configured but there is an issue with PHP, nginx will show an error message. It won't just close the server listening port.
Suggested Solution
Could you please add an environment variable TRUSTEDSERVER
(or better name)? If enabled, always allow local incoming connections.
Related
Dunno what RDP is but RPC is always listening
Indeed.
Quote https://electrumx-spesmilo.readthedocs.io/en/latest/environment.html
ElectrumX will not serve any incoming connections until it has fully caught up with your bitcoin daemon.
This is what I wanted to make this ticket about.
The only exception is local RPC connections, which are served at any time after the server has initialized.
Indeed. No issue with RPC.
I've updated my original post above to say "incoming connections" instead of RDP RPC. I.e.:
ElectrumX should accept local incoming connections even if it has not fully caught up with the bitcoin daemon
The reason is that it cannot serve you correct answers to the queries you send, only incorrect ones, so there is no point.
Sure, no correct/up to date answers can be sent.
But instead of not opening the listening port, which is unexpected and very difficult to figure out what's wrong, no other application is doing this to my knowledge...
Could you please consider opening the listening port and reply in the protocol not fully synced yet
or more fancy not fully synced yet. Synced only block #xxx of #yyy. Expected time until fully synced: ...
or something alike?
I guess electrum would/could understand this as "invalid reply" and disconnect. It might even disconnect faster since an open port that says "sorry, not ready yet" is faster than "hm, trying to connect, waiting for timeout".
Any other server software that isn't ready for whatever temporary or permanent error code (let's say e-mail, e-mail servers are doing that), will inform the connecting client software the temporary or permanent error code (in case of e-mail it will tell something like "temporary error, sorry, server is too busy, try again later" or "permanent error, sorry, this user does not exist". An e-mail server that is busy, will inform about that, but it won't just close the listen port.
related https://github.com/spesmilo/electrumx/pull/90#issuecomment-971830830