bitcoin-abe / bitcoin-abe

Abe: block browser for Bitcoin and similar currencies
GNU Affero General Public License v3.0
982 stars 653 forks source link

"MerkleRootMismatch" on height 431 using bitcoind(v0.15.1 regtest) #244

Open northfun opened 6 years ago

northfun commented 6 years ago

bitcoind from bitcoin-core.

We've tried so many times,and crashed at height 431 every time:

block_tx 432 432
commit
Exception at 101974
Failed to catch up {'blkfile_offset': 101866, 'blkfile_number': 100000, 'chain_id': None, 'loader': None, 'conf': None, 'dirname': '/alidata1/admin/.bitcoin/regtest', 'id': 1}
Traceback (most recent call last):
  File "Abe/DataStore.py", line 2563, in catch_up
    store.catch_up_dir(dircfg)
  File "Abe/DataStore.py", line 2843, in catch_up_dir
    store.import_blkdat(dircfg, ds, blkfile['name'])
  File "Abe/DataStore.py", line 2975, in import_blkdat
    store.import_block(b, chain = chain)
  File "Abe/DataStore.py", line 1091, in import_block
    raise MerkleRootMismatch(b['hash'], tx_hash_array)
MerkleRootMismatch: Block header Merkle root does not match its transactions. block hash=19ee5f5a3a4d8d4f598a06c62a237cb8c9cbcbced6f25368937c7c6931bb318a                                                         

from log of ~/.bitcoin/..., shows the version of block changed at height 431 from 0x30000003 to 0x20000000:

./debug.log:1434:2017-12-26 10:37:57 UpdateTip: new best=41e675148f20a957727a98595e52466ac0227cd3713b111d18d77a29fd1c0acf height=430 version=0x30000003 log2_work=9.7515441 tx=431 date='2017-12-26 10:39:10' progress=1.000000 cache=0.1MiB(430txo)                                         
./debug.log:1437:2017-12-26 10:37:57 UpdateTip: new best=0b550f4a8f5398140fe524fe7a61e4d916fcf1a37d4c19c5eaab3074d7d4eec1 height=431 version=0x30000003 log2_work=9.7548875 tx=432 date='2017-12-26 10:39:10' progress=1.000000 cache=0.1MiB(431txo)                                         
./debug.log:1440:2017-12-26 10:37:57 UpdateTip: new best=19ee5f5a3a4d8d4f598a06c62a237cb8c9cbcbced6f25368937c7c6931bb318a height=432 version=0x20000000 log2_work=9.7582232 tx=433 date='2017-12-26 10:39:10' progress=1.000000 cache=0.1MiB(432txo)                                         
./debug.log:1443:2017-12-26 10:37:57 UpdateTip: new best=0cd3b07d0477575170b37241c91b7245f3d734725dc95d5892e7bc7308d9fb9e height=433 version=0x20000000 log2_work=9.7615512 tx=434 date='2017-12-26 10:39:10' progress=1.000000 cache=0.1MiB(433txo)                                         

But at height 143,version changed from 0x20000000 to 0x30000003,abe went through ok. I wonder how to solve it,comment out the checking of merkelroot can't pass the problem. Thanks for your help.

dermoth commented 6 years ago

Commenting the check will likely cause you a corrupt the database as it's possible the tx'es didn't get loaded properly.

What version of Abe are you using? There haven't been a release for a while so you should be using the current master branch rather than a release tarball/branch.

Also Segwit isn't yet supported, so using the latest bitcoin-core will not work with segwit blocks. Using an older bitcoind should work, but it will be missing some signature data and would have to reprocess all blocks again from the start of segregated witness once a supported abe version and bitcoind is used.

Regards

northfun commented 6 years ago

Thanks for your advise,worth trying. It's the current master branch,the lastest commit is 74c5b4ccf1ca56f5a1b8bed49398785e34b60257.

marioschlipf commented 6 years ago

For anyone stumbling upon this issue: I spent a significant amount of time digging into why bitcoin-abe is not working with newer versions of Bitcoin Core anymore and fixed it on my fork: https://github.com/marioschlipf/bitcoin-abe

It might not be a very clean solution, but it works and bitcoin-abe is the only block explorer I know that works on file system level with Regtest.

Feel free to contribute.