<p>Bitcoin Core may only have just the block headers for some blocks, not the full block data. Such block headers would get an entry into the chainstate and block index as a block that the node knows about. However the node does not have the full block data corresponding to that header so there is no corresponding block data in the <code>blk*.dat</code> files.</p>

<p>This situation happens during syncing (since Bitcoin Core will fetch block headers first and then the blocks), when there are orphan blocks, and when there are chain forks.</p>

CC BY-SA 3.0
2018-02-27T19:31:14.693Z
2018-02-27T19:31:14.693Z
Ava Chow
<p>I've observed this behavior with Bitcoin Core v0.15 while parsing the LevelDB index in <code>.bitcoin/blocks/index</code>. It is also a situation that is obviously accounted for in the Bitcoin Core source code <a href="https://github.com/bitcoin/bitcoin/blob/5961b23898ee7c0af2626c46d5d70e80136578d3/src/chain.h#L263" rel="nofollow noreferrer">here</a> (See <code>BLOCK_HAVE_DATA</code> and <code>BLOCK_HAVE_UNDO</code>). I am just looking to understand what would cause this to happen? Can a peer receive the block header before receiving the block itself? I'm finding that only the top few blocks in the chain seem to be missing data; They appear in the index but not the <code>.dat</code> files. </p>

<bitcoin-core><bitcoind><client><block><bitcoin-core-development>
In what circumstances would a block appear in the Leveldb .ldb index but have no data in a .dat file?
Brannon
# In what circumstances would a block appear in the Leveldb .ldb index but have no data in a .dat file?

(Asked by: username_0 on 2018-02-27)

I've observed this behavior with Bitcoin Core v0.15 while parsing the LevelDB index in `.bitcoin/blocks/index`. It is also a situation that is obviously accounted for in the Bitcoin Core source code [here](https://github.com/bitcoin/bitcoin/blob/5961b23898ee7c0af2626c46d5d70e80136578d3/src/chain.h#L263) (See `BLOCK_HAVE_DATA` and `BLOCK_HAVE_UNDO`). I am just looking to understand what would cause this to happen? Can a peer receive the block header before receiving the block itself? I'm finding that only the top few blocks in the chain seem to be missing data; They appear in the index but not the `.dat` files.

**Tags:** bitcoin-core, bitcoind, client, block, bitcoin-core-development


---

## 1 answers

### Answer by username_1 on 2018-02-27. Score: 4 | Accepted answer

Bitcoin Core may only have just the block headers for some blocks, not the full block data. Such block headers would get an entry into the chainstate and block index as a block that the node knows about. However the node does not have the full block data corresponding to that header so there is no corresponding block data in the `blk*.dat` files.

This situation happens during syncing (since Bitcoin Core will fetch block headers first and then the blocks), when there are orphan blocks, and when there are chain forks.


---

