Electrumx won't start because UTXO not found in "h" table, but it's a confirmed tx
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 568
- Forks
- 447
- PR merge metrics
- No merged PRs in 30d
Description
Most probably related #265 , after that ElectrumX cannot be started any more. Updated to latest git master and still the same. Here is the complete traceback:
ERROR:electrumx:ElectrumX server terminated abnormally
Traceback (most recent call last):
File "/usr/local/bin/electrumx_server", line 35, in main
asyncio.run(controller.run())
File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/home/ss/.local/lib/python3.9/site-packages/electrumx/lib/server_base.py", line 129, in run
await server_task
File "/home/ss/.local/lib/python3.9/site-packages/electrumx/lib/server_base.py", line 102, in serve
await self.serve(shutdown_event)
File "/home/ss/.local/lib/python3.9/site-packages/electrumx/server/controller.py", line 134, in serve
await group.spawn(wait_for_catchup())
File "/home/ss/.local/lib/python3.9/site-packages/aiorpcx/curio.py", line 297, in __aexit__
await self.join()
File "/home/ss/.local/lib/python3.9/site-packages/electrumx/lib/util.py", line 377, in join
raise exc
File "/home/ss/.local/lib/python3.9/site-packages/electrumx/server/block_processor.py", line 702, in fetch_and_process_blocks
await group.spawn(self._process_prefetched_blocks())
File "/home/ss/.local/lib/python3.9/site-packages/aiorpcx/curio.py", line 297, in __aexit__
await self.join()
File "/home/ss/.local/lib/python3.9/site-packages/electrumx/lib/util.py", line 377, in join
raise exc
File "/home/ss/.local/lib/python3.9/site-packages/electrumx/server/block_processor.py", line 663, in _process_prefetched_blocks
await self.check_and_advance_blocks(blocks)
File "/home/ss/.local/lib/python3.9/site-packages/electrumx/server/block_processor.py", line 229, in check_and_advance_blocks
await self.run_in_thread_with_lock(self.advance_blocks, blocks)
File "/home/ss/.local/lib/python3.9/site-packages/electrumx/server/block_processor.py", line 212, in run_in_thread_with_lock
return await asyncio.shield(run_in_thread_locked())
File "/home/ss/.local/lib/python3.9/site-packages/electrumx/server/block_processor.py", line 211, in run_in_thread_locked
return await run_in_thread(func, *args)
File "/home/ss/.local/lib/python3.9/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.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/ss/.local/lib/python3.9/site-packages/electrumx/server/block_processor.py", line 409, in advance_blocks
undo_info = self.advance_txs(block.transactions, is_unspendable)
File "/home/ss/.local/lib/python3.9/site-packages/electrumx/server/block_processor.py", line 450, in advance_txs
cache_value = spend_utxo(txin.prev_hash, txin.prev_idx)
File "/home/ss/.local/lib/python3.9/site-packages/electrumx/server/block_processor.py", line 646, in spend_utxo
raise ChainError(f'UTXO {hash_to_hex_str(tx_hash)} / {tx_idx:,d} not '
electrumx.server.block_processor.ChainError: UTXO 70900883bd3d29998f22c345d7d42728386e37eae8792ddec34e41c9102782a4 / 14 not found in "h" table
Traceback (most recent call last):
File "/usr/local/bin/electrumx_rpc", line 4, in <module>
__import__('pkg_resources').run_script('e-x==1.16.0', 'electrumx_rpc')
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 651, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1436, in run_script
raise ResolutionError(
pkg_resources.ResolutionError: Script 'scripts/electrumx_rpc' not found in metadata at '/home/ss/.local/lib/python3.9/site-packages/e_x-1.16.0.dist-info'
Control process exited, code=exited, status=1/FAILURE
Failed with result 'exit-code'.
Consumed 46.134s CPU time.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with electrumx/server/block_processor.py, especially advance_txs() and spend_utxo(), where the traceback reports the missing UTXO in the "h" table. Read related issue #265 and trace why the confirmed transaction is absent during block processing. Done means the server can start and process this transaction without raising the ChainError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100