<p>This is likely the case because you don't have the block.</p>

<p>Blocks are downloaded out of order, and the block index contains entries for blocks that are not in the main chain ("orphan blocks"). Many of those are clearly not in the best chain before they're even downloaded, in which case Bitcoin Core will not download them at all.</p>

CC BY-SA 4.0
2019-06-28T19:14:54.070Z
Very clear, thanks! I thought the block index contained only the main chain.
Kevin P
CC BY-SA 4.0
2019-06-28T17:26:52.270Z
2019-06-28T17:26:52.270Z
Pieter Wuille
<p><a href="https://github.com/bitcoin/bitcoin/blob/v0.15.1/src/chain.h#L387L407" rel="nofollow noreferrer">This</a> is the source code snippet that is used for the serialization of block indexes (found in leveldb).</p>

<p>Block 478573 index is (as of my node's leveldb) <code>89af109c996d020000000020774f568005a00bf4ffed76b52e3a7e5e5140a5371834a00000000000000000009f5db27969fecc0ef71503279069b2df981ba545592a7b425f353b5060e77f3e7e13825935470118da70378e</code></p>

<p>Isn't NFile undefined (i.e. 0) in this case? (and NDataPos and NUndoPos too).</p>

<p>Whereas for block 478574 it is :</p>

<p><code>89af109c996e1d801886399fbf8017828daf5502000020dcc139c241e6315463dd82c89fc288de35f004c87816430000000000000000000f7f9503fc2daab46c4103516c386b1c5b2390e082af76ba8c49fb522d5e5b148b96805935470118ae6ba061</code></p>

<p>Which yields NFile = 953 and is correct.</p>

<p>Why block 478573 is not defined? And how to retrieve NFile and NDataPos in that case? I understand that the index is different for every node because it depends on the order the blocks were downloaded.</p>

CC BY-SA 4.0
2019-06-28T15:58:49.633Z
What do you mean by undefined? Zero?
Pieter Wuille
CC BY-SA 4.0
2019-06-28T17:14:35.707Z
Yes I meant zero
Kevin P
<block><leveldb>
CDiskBlockIndex: NFile and NDataPos not defined
Kevin P
# CDiskBlockIndex: NFile and NDataPos not defined

(Asked by: username_0 on 2019-06-28)

[This](https://github.com/bitcoin/bitcoin/blob/v0.15.1/src/chain.h#L387L407) is the source code snippet that is used for the serialization of block indexes (found in leveldb).

Block 478573 index is (as of my node's leveldb) `89af109c996d020000000020774f568005a00bf4ffed76b52e3a7e5e5140a5371834a00000000000000000009f5db27969fecc0ef71503279069b2df981ba545592a7b425f353b5060e77f3e7e13825935470118da70378e`

Isn't NFile undefined (i.e. 0) in this case? (and NDataPos and NUndoPos too).

Whereas for block 478574 it is :

`89af109c996e1d801886399fbf8017828daf5502000020dcc139c241e6315463dd82c89fc288de35f004c87816430000000000000000000f7f9503fc2daab46c4103516c386b1c5b2390e082af76ba8c49fb522d5e5b148b96805935470118ae6ba061`

Which yields NFile = 953 and is correct.

Why block 478573 is not defined? And how to retrieve NFile and NDataPos in that case? I understand that the index is different for every node because it depends on the order the blocks were downloaded.

**Tags:** block, leveldb

> **Comments:**
> **username_1**: What do you mean by undefined? Zero?  
> **username_0**: Yes I meant zero  

---

## 1 answers

### Answer by username_1 on 2019-06-28. Score: 0 | Accepted answer

This is likely the case because you don't have the block.

Blocks are downloaded out of order, and the block index contains entries for blocks that are not in the main chain ("orphan blocks"). Many of those are clearly not in the best chain before they're even downloaded, in which case Bitcoin Core will not download them at all.

> **Comments:**
> **username_0**: Very clear, thanks! I thought the block index contained only the main chain.  

---

