Bitcoin Forum
May 25, 2024, 06:13:16 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: My blockchain is b0rked, would like to repair it  (Read 1625 times)
dserrano5 (OP)
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
April 06, 2013, 08:54:49 PM
 #1

Some days ago I found this:

Code:
$ bitcoind getblockhash 3
0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449
$ bitcoind getblock 0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449
error: no response from server

debug.log:

Code:
2013-04-01 10:29:34 ThreadRPCServer method=getblock
2013-04-01 10:29:35 ERROR: CheckProofOfWork() : nBits below minimum work
2013-04-01 10:29:35 ERROR: CBlock::ReadFromDisk() : errors in block header

syslog:

Code:
[12:35:48] kernel: [616350.252104] bitcoin-rpchand[21782]: segfault at 10 ip 00000000005393a3 sp 00007f217a401e70 error 4 in bitcoind[400000+3cd000]

This happened with all blocks between 1 and 59571, inclusive. A couple of days later when examining my blk00000.dat I noticed that the genesis block was followed by a bunch of null bytes, until exactly the 16 MiB mark. The next magic value showed up not much later, followed by the block 59573. I assume that the data between 16 MiB and that point was part of the block 59572.

So I tried extracting the missing data from my copy of the bootstrap.dat but I only managed to completely break the blk00000.dat Smiley. Then I took a peek to the blk00001.dat to look what was the first block there, and stored all previous blocks in the blk00000.dat.

Bitcoin starts and runs fine, but reading some blocks still kills the process, while reading some others returns garbage. I wrote a small blockchain parser and it seems to be sane; after all, the data came from the bootstrap.dat. So I'm not sure why bitcoin is dying on them (though I have some hypotheses).

I have another copy of the datadir handy, not to mention the bootstrap.dat itself, but I'd really like to repair this one. Does the .bitcoin/blocks/index directory have something to do? Can/should I remove it? Anything else worth a try?
grue
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
April 06, 2013, 11:34:10 PM
 #2

why not just delete everything except wallet.dat and bitcoin.conf (if you have it), and let the client redownload the blocks?

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
dserrano5 (OP)
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
April 07, 2013, 09:50:27 AM
 #3

why not just delete everything except wallet.dat and bitcoin.conf (if you have it), and let the client redownload the blocks?

I wouldn't learn anything by doing that.
MaGNeT
Legendary
*
Offline Offline

Activity: 1526
Merit: 1002


Waves | 3PHMaGNeTJfqFfD4xuctgKdoxLX188QM8na


View Profile WWW
April 07, 2013, 10:50:46 AM
 #4

why not just delete everything except wallet.dat and bitcoin.conf (if you have it), and let the client redownload the blocks?

I wouldn't learn anything by doing that.

Yes you would.
You would learn it saves a lot of time and trouble  Grin
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!