citp / BlockSci

A high-performance tool for blockchain science and exploration
https://citp.github.io/BlockSci/
GNU General Public License v3.0
1.34k stars 259 forks source link

Chain corruption while updating BCH chain #255

Open ClementPavue opened 5 years ago

ClementPavue commented 5 years ago

While updating incrementally the chain I got somehow the following corruption. It seems like the parser failed to store some transactions while updating. I encountered the issue at height 574980. I use the disk to update my DB.

Expected Result

A valid parser folder

Actual Result

100.0% done fetching block headers terminate called after throwing an instance of 'std::runtime_error' what(): Block data corrupted. Tx file has 269473839 transaction, but max tx to load is tx 269473892 Aborted

Reproduction Steps

sudo blocksci_parser /data/conf.json update

System Information

BlockSci version: 0.6 Using AMI: no Total memory:64GB

maltemoeser commented 5 years ago

Copying from https://github.com/citp/BlockSci/issues/256#issuecomment-478040159

Manage to reproduce the issue here is the log of my code:

I'm 14 blocks late
Beginning BlockChain parsing.
Starting with chain of 575901 blocks
Removing 0 blocks
Adding 8 blocks
Back linking transactions
terminate called after throwing an instance of 'std::runtime_error'
what():  Block data corrupted. Tx file has 269607452 transaction, but max tx to load is tx 269608039
Aborted

My cpp code ask the chain to update if there is more than 6 blocks late at regular interval.

ClementPavue commented 5 years ago

Whoops sorry mb wrong issue

maltemoeser commented 5 years ago

The issue does not seem to be related to the particular blocks:

ubuntu@[...] > blocksci_parser bch.json update
100.0% done fetching block headers
Starting with chain of 575901 blocks
Removing 0 blocks
Adding 8 blocks
0.00% done, Block 575902/575909
Back linking transactions

Updating hash index
Updating index with 1529 txes
0.00% done
Updating address index
Updating index with 1529 txes
0.00% done
Updating index with scripts of type multisig_script
0.00% done