kyuupichan / electrumx

Alternative implementation of spesmilo/electrum-server
Other
724 stars 733 forks source link

ChainError: UTXO 42f8a8a545b8fa749ed0664bea1d1aed04a64d3bfc682826c33fd55d902b81d8 / 0 not found in "h" table #1059

Closed jerrygzy closed 3 years ago

jerrygzy commented 3 years ago

Hi, I am running electrumx on a BSV full node, fresh start from height 0, and got this error.

INFO:BlockProcessor:our height: 701,047 daemon: 701,433 UTXOs 361MB hist 184MB                                                                                                      │
INFO:BlockProcessor:our height: 701,048 daemon: 701,433 UTXOs 361MB hist 185MB                                                                                                      │
INFO:BlockProcessor:our height: 701,049 daemon: 701,433 UTXOs 361MB hist 185MB                                                                                                      │
INFO:BlockProcessor:our height: 701,050 daemon: 701,433 UTXOs 362MB hist 187MB                                                                                                      │
INFO:BlockProcessor:our height: 701,051 daemon: 701,433 UTXOs 362MB hist 187MB                                                                                                      │
INFO:BlockProcessor:our height: 701,052 daemon: 701,433 UTXOs 362MB hist 187MB                                                                                                      │
INFO:Prefetcher:cancelled; prefetcher stopping                                                                                                                                      │
INFO:SessionManager:stopping servers                                                                                                                                                │
INFO:SessionManager:closing connections...                                                                                                                                          │
INFO:SessionManager:connections closed                                                                                                                                              │
INFO:Controller:shutting down                                                                                                                                                       │
INFO:Controller:shutdown complete                                                                                                                                                   │
ERROR:electrumx:ElectrumX server terminated abnormally                                                                                                                              │
Traceback (most recent call last):                                                                                                                                                  │
  File "/usr/local/lib/python3.8/dist-packages/electrumX-1.18.1-py3.8.egg/EGG-INFO/scripts/electrumx_server", line 35, in main                                                      │
  File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run                                                                                                                     │
    return loop.run_until_complete(main)                                                                                                                                            │
  File "/usr/lib/python3.8/asyncio/base_events.py", line 608, in run_until_complete                                                                                                 │
    return future.result()                                                                                                                                                          │
  File "/usr/local/lib/python3.8/dist-packages/electrumX-1.18.1-py3.8.egg/electrumx/lib/server_base.py", line 125, in run                                                           │
    await server_task                                                                                                                                                               │
  File "/usr/local/lib/python3.8/dist-packages/electrumX-1.18.1-py3.8.egg/electrumx/lib/server_base.py", line 98, in serve                                                          │
    await self.serve(shutdown_event)                                                                                                                                                │
  File "/usr/local/lib/python3.8/dist-packages/electrumX-1.18.1-py3.8.egg/electrumx/server/controller.py", line 142, in serve                                                       │
    task.result()                                                                                                                                                                   │
  File "/usr/local/lib/python3.8/dist-packages/electrumX-1.18.1-py3.8.egg/electrumx/server/block_processor.py", line 671, in fetch_and_process_blocks                               │
    task.result()                                                                                                                                                                   │
  File "/usr/local/lib/python3.8/dist-packages/electrumX-1.18.1-py3.8.egg/electrumx/server/block_processor.py", line 628, in _process_blocks                                        │
    await self.run_with_lock(process_event())                                                                                                                                       │
  File "/usr/local/lib/python3.8/dist-packages/electrumX-1.18.1-py3.8.egg/electrumx/server/block_processor.py", line 205, in run_with_lock                                          │
    return await asyncio.shield(run_locked())                                                                                                                                       │
  File "/usr/local/lib/python3.8/dist-packages/electrumX-1.18.1-py3.8.egg/electrumx/server/block_processor.py", line 204, in run_locked                                             │
    return await coro                                                                                                                                                               │
  File "/usr/local/lib/python3.8/dist-packages/electrumX-1.18.1-py3.8.egg/electrumx/server/block_processor.py", line 619, in process_event                                          │
    await self._advance_blocks(blocks)                                                                                                                                              │
  File "/usr/local/lib/python3.8/dist-packages/electrumX-1.18.1-py3.8.egg/electrumx/server/block_processor.py", line 351, in _advance_blocks                                        │
    await self._advance_block(block)                                                                                                                                                │
  File "/usr/local/lib/python3.8/dist-packages/electrumX-1.18.1-py3.8.egg/electrumx/server/block_processor.py", line 382, in _advance_block                                         │
    undo_info = self.advance_txs(block.transactions, is_unspendable)                                                                                                                │
  File "/usr/local/lib/python3.8/dist-packages/electrumX-1.18.1-py3.8.egg/electrumx/server/block_processor.py", line 418, in advance_txs                                            │
    cache_value = spend_utxo(txin.prev_hash, txin.prev_idx)                                                                                                                         │
  File "/usr/local/lib/python3.8/dist-packages/electrumX-1.18.1-py3.8.egg/electrumx/server/block_processor.py", line 606, in spend_utxo                                             │
    raise ChainError('UTXO {} / {:,d} not found in "h" table'                                                                                                                       │
electrumx.server.block_processor.ChainError: UTXO 42f8a8a545b8fa749ed0664bea1d1aed04a64d3bfc682826c33fd55d902b81d8 / 0 not found in "h" table                                
kyuupichan commented 3 years ago

Either your node's blocks, or the ElectrumX DB is corrupt. You can only start from scratch again. If it happens again likely your node has corrupt blocks.

barrystyle commented 2 years ago

Worth mentioning for anyone else who finds this via google etc; simply means that electrumx has reconstructed the transaction by itself and ended up with a different hash to your coin daemon (and stored it in the in-memory UTXO cache).

kyuupichan commented 2 years ago

ElectrumX doesn't construct any transactions itself. It means something on-disk has been corrupted; typically a bitcoind block

barrystyle commented 1 year ago

It recreates transactions given the individual components (nversion, vin, vout etc). If a given coin has additional fields, the same 'reconstructed' transaction's hash is going to differ from what ElectrumX ends up with. That being said, ElectrumX doesnt support alts (anymore).

Martin8617 commented 1 year ago

Have the same issue. First on a Raspberry Pi and now on a power notebook. I agree that a Raspberry maybe is too weak to handle the hugh amount of data over time, but the notebook should handle it easy. Two times from scratch..., without another solution as mention above I will give up. Has somebody another idea? Bitcoin core v22.2.0, electrumX v1.20.0 on a HP Elitebook 8760w / ssd 1T /, ram 8GB / Debian bullseye / Kernel 5.10.0-21-amd64

kyuupichan commented 1 year ago

What coin? BSV?

Martin8617 commented 1 year ago

BitcoinSV

kyuupichan commented 1 year ago

All I can say is that it works for me and for everyone else. If this persists it usually indicates your bitcoind has corrupt blocks, and that you need to delete all bitcoind data and start from genesis.

Martin8617 commented 1 year ago

Yes, that is why I changed the hardware and started from scratch.But if this is the onliest reason to stuck, I have to do it a third time with double checked empty bitcoind data... Thx for your answer.

Martin8617 commented 1 year ago

Ok, third clean install - same issue Around block 481'823 it stops...
...and it is every time the UTXO 05894556e08491470eae0e8f75690d416cc9c9c278f8ac09daf9d3f4075a2003 which is not valid in the explorer.

It's hard to believe I get the same error three times. Do I have to delete other files than the folders: /.bitcoin/ and /.electrumx/ ?

If somebody has another idea than a corrupt block please have a look at the attached log file: Error-Log.txt

Clean install with: Raspberry Pi 4B 8GB / ssd 1 TB / Raspberry OS bullseye / Bitcoin Core v24.0.1 / electrumX v1.20.2

kyuupichan commented 1 year ago

It means your bitcoind blocks are corrupt; it is bitcoind you need to start from genesis, and then redo ElectrumX.

kyuupichan commented 1 year ago

Note that to sync the BSV chain you will need at least 12TB of disk space and 64GB of RAM (including swap).