ElectrumX Crashes on Reading blocks from Bitcoind regtest node

Can anyone help me to debug this issue?

What I Am Trying to Do

I am attempting to run a bitcoind regtest node and connect it to electrumx_server

The Problem

When I run electrumx_server, it connects to bitcoind successfully but it crashes when it starts to read the first block giving this error: RuntimeError: truncated block file

Environment Details

Operating System: Ubuntu 22.04 ElectrumX Version: 1.20.2 bitcoind Version: v27.0

These are the logs when I run electrumx_server command:

INFO:electrumx:ElectrumX server starting
WARNING:Env:lowered maximum sessions from 1,000 to 674 because your open file limit is 1,024
INFO:electrumx:logging level: INFO
INFO:Controller:Python version: 3.10.12 (main, Nov  6 2024, 20:22:13) [GCC 11.4.0]
INFO:Controller:software version: ElectrumX 1.20.2
INFO:Controller:aiorpcX version: 0.22.1
INFO:Controller:supported protocol versions: 1.4-1.4.2
INFO:Controller:event loop policy: None
INFO:Controller:reorg limit is 8,000 blocks
INFO:Daemon:daemon #1 at 127.0.0.1:18443/ (current)
INFO:DB:switching current directory to /home/omarosman23/.electrumx/db
INFO:DB:using leveldb for DB backend
INFO:DB:opened UTXO DB (for sync: True)
INFO:DB:UTXO DB version: 8
INFO:DB:coin: BitcoinSV
INFO:DB:network: regtest
INFO:DB:height: 0
INFO:DB:tip: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
INFO:DB:tx count: 1
INFO:DB:chain size: 0 GB (285 bytes)
INFO:DB:flushing DB cache at 1,200 MB
INFO:History:history DB version: 1
INFO:History:flush count: 1
INFO:BlockProcessor:scanning block directory meta/blocks...
INFO:BlockProcessor:deleted 1 stale block files, total size 285 bytes
INFO:BlockProcessor:catching up to daemon height 101 (101 blocks behind)
INFO:BlockProcessor:height 1 of 101 6962336134cc551e47876c1bcc436986489b8c0d9b6008c34b8781f87bbf3544 2024-12-04 01:07:08 0.000GB 1 txs chain 0GB
INFO:SessionManager:stopping servers
INFO:SessionManager:closing connections...
INFO:SessionManager:connections closed
ERROR:BlockProcessor:error prefetching 0610f78b45cdcb8f3acc06bb6c0fa976ef79e824360058ef1ba76ee119c7cc21: Session is closed
ERROR:BlockProcessor:error prefetching 11575e4c2dd2b786ffe24ab0439f7fec21a6860d9485b63a06273401a37d9f32: 'NoneType' object has no attribute 'get'
ERROR:BlockProcessor:error prefetching 60c69f7f4fd78479c376cd06163c198aa5e45df053ac90918e9f90b43d69f73a: 'NoneType' object has no attribute 'get'
ERROR:BlockProcessor:error prefetching 359d3818b64039b05e6552f272c1fb6c98fb713b6f4d3ba8e736dde9e159d0cd: 'NoneType' object has no attribute 'get'
ERROR:BlockProcessor:error prefetching 46a16268710b51639eec8173bd8cb90ed20bdc45c067824f3c14ccb8941d1bf9: 'NoneType' object has no attribute 'get'
INFO:Controller:shutting down
INFO:Controller:shutdown complete
ERROR:BlockProcessor:error prefetching 55b9ba7f176fdcdd90be70816b12e7e387e2c301993d7190833410d63e910af4: 'NoneType' object has no attribute 'get'
ERROR:BlockProcessor:error prefetching 70a1e31ab0606cb04a3972005ce708c933a47c39678585de9c7a5a762c40fb19: 'NoneType' object has no attribute 'get'
ERROR:BlockProcessor:error prefetching 0cecb7ba4ffec37b3da27536c5ef35b87946fe09a6551e515f9a7f09b0896023: 'NoneType' object has no attribute 'get'
ERROR:BlockProcessor:error prefetching 641e359e27b8d10d4c11b316fab5935dfaa26cc073aeb68a4117005013a1e176: 'NoneType' object has no attribute 'get'
ERROR:BlockProcessor:error prefetching 208ab8575cb81cee12fdaf920656eb37e3bf1202a80a208bb3dcf9490280bc4d: 'NoneType' object has no attribute 'get'
ERROR:BlockProcessor:error prefetching 071e7faf308ed9b5d10700bd10aba36f483b08410ba95ccc7bf5ca4120211e00: 'NoneType' object has no attribute 'get'
ERROR:BlockProcessor:error prefetching 38fc7e85297feb287d1fdcc142976a925611bed841b2aceebe7aa27394759c97: 'NoneType' object has no attribute 'get'
ERROR:BlockProcessor:error prefetching 2602d075e6764d6f111ab702658d7663746d4c30ab43258d0baf3523d28fac6b: 'NoneType' object has no attribute 'get'
ERROR:BlockProcessor:error prefetching 78b3b683bd21f3ef3bdba8e6af1b8d331e6b70f5062549a2df4371c92ac1dc33: 'NoneType' object has no attribute 'get'
ERROR:electrumx:ElectrumX server terminated abnormally
Traceback (most recent call last):
  File "/home/omarosman23/.local/bin/electrumx_server", line 35, in main
    asyncio.run(controller.run())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/omarosman23/.local/lib/python3.10/site-packages/electrumx/lib/server_base.py", line 125, in run
    await server_task
  File "/home/omarosman23/.local/lib/python3.10/site-packages/electrumx/lib/server_base.py", line 98, in serve
    await self.serve(shutdown_event)
  File "/home/omarosman23/.local/lib/python3.10/site-packages/electrumx/server/controller.py", line 143, in serve
    task.result()
  File "/home/omarosman23/.local/lib/python3.10/site-packages/electrumx/server/block_processor.py", line 758, in fetch_and_process_blocks
    await self.advance_blocks(hex_hashes)
  File "/home/omarosman23/.local/lib/python3.10/site-packages/electrumx/server/block_processor.py", line 476, in advance_blocks
    await self.run_with_lock(advance_and_maybe_flush(block))
  File "/home/omarosman23/.local/lib/python3.10/site-packages/electrumx/server/block_processor.py", line 320, in run_with_lock
    return await asyncio.shield(run_locked())
  File "/home/omarosman23/.local/lib/python3.10/site-packages/electrumx/server/block_processor.py", line 319, in run_locked
    return await coro
  File "/home/omarosman23/.local/lib/python3.10/site-packages/electrumx/server/block_processor.py", line 466, in advance_and_maybe_flush
    await run_in_thread(self.advance_block, block)
  File "/home/omarosman23/.local/lib/python3.10/site-packages/aiorpcx/curio.py", line 57, in run_in_thread
    return await get_event_loop().run_in_executor(None, func, *args)
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/omarosman23/.local/lib/python3.10/site-packages/electrumx/server/block_processor.py", line 510, in advance_block
    for tx, tx_hash in block.iter_txs():
  File "/home/omarosman23/.local/lib/python3.10/site-packages/electrumx/server/block_processor.py", line 113, in iter_txs
    raw = raw[cursor:] + self._read(self.chunk_size)
  File "/home/omarosman23/.local/lib/python3.10/site-packages/electrumx/server/block_processor.py", line 71, in _read
    raise RuntimeError(f'truncated block file for block {self.hex_hash} '
RuntimeError: truncated block file for block 6962336134cc551e47876c1bcc436986489b8c0d9b6008c34b8781f87bbf3544 height 1

Configuration Details

ElectrumX Configuration (config):

DB_DIRECTORY = /home/omarosman23/.electrumx/db
DB_ENGINE = rocksdb
DAEMON_URL = http://rpcuser:rpcpassword@127.0.0.1:18443
COIN = BitcoinSVRegtest
NET= regtest
SSL_CERTFILE = /home/omarosman23/.electrumx/electrumx.crt
SSL_KEYFILE = /home/omarosman23/.electrumx/electrumx.key

Bitcoin Daemon Configuration (bitcoin.conf):

server=1
txindex=1
rpcuser=rpcuser
rpcpassword=rpcpassword
rpcallowip=0.0.0.0/0

[regtest]
rpcbind=0.0.0.0
rpcport=18443

Expected Behavior

The electrumx_server should connect to the bitcoind node, scans the blocks and does not crash



from Recent Questions - Bitcoin Stack Exchange https://ift.tt/pKhibqE
via IFTTT

Popular posts from this blog

Do Kwon’s Detention Prolonged Until 2024 As Montenegro Responds To Extradition Requests

Sam Bankman-Fried Trial Begins Tomorrow: 3 Reasons Ex-SEC Official Foresees Conviction

April’s Crypto Game-Changers: 7 Events Set To Drastically Impact The Course Of Digital Currencies