[bug]: Electrs can only serve one service at a time. Multiple services/electrum desktops connected will be unreliable or just not work at all.
BitcoinMechanic opened this issue · 11 comments
Prerequisites
- I have searched for existing issues that already report this problem.
Device
Laptop/Desktop
Device OS
MacOS
Device OS Version
12.5
Browser
Firefox
Browser Version
105
Current Behavior
Running (for example) mempool - that consistently works perfectly and reliably with no need for restarts or health check complaints or any unreliability. If I connect electrum wallet (desktop) to electrs it will likely just not connect at all. I have gotten it to connect in the past, but only for a short time and then causing electrs to not work right at all. Electrum Wallet then has its network button turn red and mempool also stops working.
Stopping mempool before starting electrum and connecting electrum results in perfect behaviour by both electrum and electrs.
Expected Behavior
This is now the behaviour I've come to expect as I'm lead to believe that electrs is not capable of handling multiple applications connecting to it.
In this guide this is said to be the case with Electrum Personal Server at least....
One thing to note about EPS is that it really is “personal” — it only connects to one Electrum Wallet at a time. So if your desktop wallet is connected, don’t spend hours tinkering with your mobile Electrum Wallet trying to figure out why it doesn’t connect (true story). You also can’t be the “Uncle Jim” of your social circle with EPS, by providing a trusted node for them to connect to.
Steps to Reproduce
To break electrs:
- Install and sync electrs
- Run mempool
- Wait for everything to synchronize
- Connect an Electrum Wallet (desktop) instance to electrs
- Something will break - best case Electrum just doesn't connect. Worst case it works a bit, then turns red. The electrs service itself will have its health check to get stuck this issue "finalizing synchronization" and stop working for mempool as well.
To get it to work:
- Just run one of either Mempool or Electrum and they should work perfectly.
Anything else?
No response
This is a very unfortunate deficiency if true.
Thanks for the detailed report, will look into it.
It'd be worth testing blue wallet with one of mempool/electrum desktop at the same time.
Can confirm that bluewallet caused my electrs to mess up while mempool was running.
Update: On the Pro I'm able to use Electrum and Sparrow simultaneously for some time, though after a few hours Sparrow appears to lose a connection - the blue toggle in the bottom right start fading in and out. This may or may not be expected behaviour between Sparrow and Electrs so I'm trying this without also running Electrum. Will update.
edit: same behaviour with Sparrow, even without Electrum running.
I'm not sure there's anything we can do about this
Make sure BTC RPC Proxy isn't between electrs and bitcoin core. That seems to be a common denominator in things not working with electrs. Or at the very least, enable getblock
rpc call in BTC RPC Proxy. This call is needed for some reason and currently isn't allowed by default. Probably never will be since we aren't moving forward with BTC RPC Proxy. There could be other needed but unallowed calls too. If you disable mempool temporarily, then connect your wallet(s) to electrs, look at BTC RPC Proxy's logs to determine which calls it's attempting to make but being blocked on.
@BitcoinMechanic please test with getblock
enabled in proxy and we'll get that added
How exactly do we make electrs break while not using getblock
in a way that it would work if connected directly to core?
At some point, electrs itself generates a getblock
call to whatever bitcoin rpc it's connected to. I'm not sure what electrum protocol call from electrum in turn induces the getblock call from electrs, but since the default configuration in btc-rpc-proxy for the electrs user is to not allow the getblock
call, when it makes that call, btc-rpc-proxy ignores it.
Are you asking how it is that a wallet such as sparrow doesn't choke there when it is connected directly to the bitcoin RPC? Either it 1) handles no response better than electrs does or 2) doesn't even need the getblock
call
No I'm simply wondering how I can verify that adding this RPC fixes anything as I have only ever broken electrs in a way where getblock
is not the issue.
Since we got rid of proxy, hopefully this is no longer a problem. Do you still experience this @BitcoinMechanic?