You have to delete that block manually. You won't have to re-download previous blocks. Stop your Bitcoin Core instance and open its data directory. Go to
blocks folder and delete files associated with this block (
blk.dat and
rev.dat). A similar problem has been described
here and it was answered by achow101 who is also a member of this forum.
I deleted the last
blk.dat and
rev.dat files and restarted. It re-indexed all the blocks and continued syncing and now I'm up-to-date. Thanks for the suggestion and the link.
I have some suggestions for any core developers that might read this:
- 1. Since this problem seems to happen regularly, it would be helpful if the block processing code would detect that the last block is corrupted and do something about it.
- 2. Since it is the last block that is corrupted, there really isn't a need to re-index the entire chain. Recovering from a corrupted last block could only take a second.
Rather than deleting the bad records, I would rename them. This means that if you have a bad spot on the disk, the software won't try to reuse it. All other actions should be as suggested.
Thanks for the suggestion, but I don't think that managing bad sectors by hand is practical. If you suspect that there is a bad sector, you should have the operating system check the disk.