romanz / electrs

An efficient re-implementation of Electrum Server in Rust
MIT License
1.1k stars 407 forks source link

Indexing fails at Block 1 (00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048) #1046

Closed tchjntr closed 5 months ago

tchjntr commented 6 months ago

Describe the bug electrs stops as it fails to get Block 1 (00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048)

Error: electrs failed

Caused by:
    0: sync failed
    1: failed to get block 00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048
    2: receiving on an empty and disconnected channel

Electrs version v0.10.5

To Reproduce Steps to reproduce the behavior:

  1. Configure and start electrs
  2. See error

Expected behavior I expect electrs to sync

Configuration

# Bitcoin Core settings
network = "bitcoin"
cookie_file= "/home/janitor/.bitcoin/.cookie"

# Electrs settings
#electrum_rpc_addr = "0.0.0.0:50001"
db_dir = "/home/janitor/.electrs/"
server_banner = "Welcome to electrs (Electrum Rust Server)"
skip_block_download_wait = true

# Logging
log_filters = "INFO"
timestamp = true

Environment variables: N/A Arguments: --disable-electrum-rpc

System running electrs

Additional context This issue seems to be similar to #905 so I ran bitcoin-cli getblock to confirm that the block was actually on disk.

bitcoin-cli getblock 00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048
{
  "hash": "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048",
  "confirmations": 845268,
  "height": 1,
  "version": 1,
  "versionHex": "00000001",
  "merkleroot": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098",
  "time": 1231469665,
  "mediantime": 1231469665,
  "nonce": 2573394689,
  "bits": "1d00ffff",
  "difficulty": 1,
  "chainwork": "0000000000000000000000000000000000000000000000000000000200020002",
  "nTx": 1,
  "previousblockhash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
  "nextblockhash": "000000006a625f06636b8bb6ac7b960a8d03705d1ace08b1a19da3fdcc99ddbd",
  "strippedsize": 215,
  "size": 215,
  "weight": 860,
  "tx": [
    "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098"
  ]
}
tchjntr commented 5 months ago

Found out about #665 so I am currently reindexing my Bitcoin node before giving electrs a second try.

tchjntr commented 5 months ago

I've finished reindexing my Bitcoin node and now I am trying to start indexing electrs but every time I try to start the system unit it stops with the following error message:

electrs[852160]: Error: Failed to read configuration file /home/janitor/.electrs/electrs.conf: Permission denied (os error 13)

This is the system unit:

# systemd unit for electrs
# /etc/systemd/system/electrs.service

[Unit]
Description=Electrs
Wants=bitcoind.service
After=bitcoind.service

[Service]
ExecStart=/usr/local/bin/electrs --conf /home/janitor/.electrs/electrs.conf

# Process management
####################
Type=simple
TimeoutSec=300
KillMode=process

# Directory creation and permissions
####################################
RuntimeDirectory=electrs
RuntimeDirectoryMode=0710
User=janitor
Group=janitor

# Hardening Measures
####################
PrivateTmp=true
ProtectSystem=full
ProtectHome=true
PrivateDevices=true
MemoryDenyWriteExecute=true

[Install]
WantedBy=multi-user.target

And the permissions for the electrs.conf file are correct:

janitor@u59pro:~/.electrs$ ls -lah
total 12K
drwxr-xr-x  2 janitor janitor 4.0K May 29 15:41 .
drwx------ 19 janitor janitor 4.0K May 29 15:39 ..
-rw-r--r--  1 janitor janitor 1.9K May 29 15:41 electrs.conf
antonilol commented 5 months ago

probably caused by ProtectHome=true

tchjntr commented 5 months ago

probably caused by ProtectHome=true

Thanks. It started indexing.

I'll report back if there's any issue with indexing blocks or after it's fully indexed.

tchjntr commented 5 months ago

electrs successfully synced after reindexing Bitcoin.