Zeros in blk00*.dat files

1

When writing a blockchain parser I've found that some blk00*.dat files contain zeros instead of blocks. (I got zero where magic bytes were expected, looked in the file and saw there are more zeros.)

What does it mean? Do I have corrupted chain? How do I fix my parser, so it would interpret the file correctly?

Martin Habovštiak

Posted 2016-09-04T16:08:42.287

Reputation: 85

Answers

1

zero instead of magic bytes means the end of bictoin block data. just skip the rest of file and follow to next blk-file

by the way. it is better to assemble blk-files for future parsing with old clients (I use 0.8.5) because they put blocks in right order

amaclin

Posted 2016-09-04T16:08:42.287

Reputation: 5 763

I've checked that the block in the next file points to hash of previous one and indeed, it does. Thank you!Martin Habovštiak 2016-09-06T15:33:56.203