electrs icon indicating copy to clipboard operation
electrs copied to clipboard

Feature: Support to run electrs offline

Open jr682 opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe. Runnin bitcoind and electrs in an offline machine. No internet. Copy of blockchain on machine for bitcoind. When blockchain is old, maybe some hours, electrs refuse all requests. Message about IBD, initial block download.

Describe the solution you'd like Option to ignore IBD and serve all requests.

Describe alternatives you've considered Other option to answer all request when blockchain is out of date would also work.

Additional context Performance of electrs is excellent in offline machine.

jr682 avatar Jun 03 '21 15:06 jr682

I think the solution for this is the same as for listening during sync. I swear I've seen an issue about it, can't find it right now.

Kixunil avatar Jun 04 '21 07:06 Kixunil

I agree that this is a useful feature. There are legitimate reasons to run it offline with no internet connection.

The check for whether or not it's doing an initial block download is done by bitcoind, not electrs. However electrs then refuses to progress any further until bitcoind says that the initial block download is complete.

A workaround while we wait for a fix is to edit src/daemon.rs, and in the function rpc_poll(), change:

if info.initial_block_download || left_blocks > 0 {

to:

if left_blocks > 0 {

sjkjs avatar Jun 02 '23 06:06 sjkjs

The reason electrs is waiting for IBD to finish is to make sure it won't "compete" with bitcoind on CPU/IO resources during the IBD process, which is preferable when running on modest hardware.

romanz avatar Jun 04 '23 18:06 romanz

Interesting. I think it could be configurable but I'm wondering how much does it even help. At least the blocks which verify signatures are CPU-bound and bitcoind isn't very parallelized, so if you have many cores it'd be probably better to run them in parallel at that time. There may be other weird cases, like user having two dedicated storages for chain and electrs index...

Kixunil avatar Jun 04 '23 19:06 Kixunil

@jr682 @sjkjs Could you please try #888 (using the new --skip-block-download-wait flag)?

romanz avatar Jun 04 '23 19:06 romanz

Thanks romanz. I can confirm that it works after putting skip-block-download-wait=true into the config file. I didn't try with the flag but I assume it's the same thing.

sjkjs avatar Jun 05 '23 02:06 sjkjs