<p>What you are referring to are <strong>stale blocks</strong>. Orphaned blocks are one for which the previous (parent) hash field points to an unknown block or to a block not yet processed by the local node. Since Bitcoin Core follows <a href="https://bitcoin.org/en/p2p-network-guide#headers-first" rel="nofollow noreferrer">headers first</a> approach, block headers are downloaded and validated first before downloading the block data. As a result, full nodes will never receive blocks whose parents it doesn't know about. So with the current headers first approach an orphan block will not be downloaded by your Bitcoin Core node. </p>

<p>Now, coming to stale blocks. All blocks are stored on the disk in the <code>blocks/blk*.dat</code> file. The block data that you receive from your peers, if it is valid, is stored forever in that directory. However, in order to receive stale blocks, you need to be online at the time when your peer broadcasted a block to you from different chain view. Peers will only broadcast those blocks that they view form the current active chain from their perspective. So using that command, you will only be able to retrieve the stale blocks that you received when you were online.</p>

<p>You can use the <code>bitcoin-cli getchaintips</code> command to return information about all known tips in the block tree, including the main chain as well as other branches.</p>

CC BY-SA 4.0
2019-07-17T12:44:13.000Z
2019-07-17T12:44:13.000Z
Ugam Kamat
<p>If there was a chain reorg, for example: </p>

<p><strong>Blockchain:</strong></p>

<p><code>0a</code>---<code>1a</code>---<code>2a</code>---<code>3a</code></p>

<p>becomes...</p>

<p><code>0a</code>---<code>1a</code>---<code>2b</code>---<code>3b</code></p>

<p>How long are blocks <code>2b</code> and <code>3b</code> kept in memory on the node?</p>

<p>If I query the node for block <code>2b</code> later (<code>getblock(2aBlockHash, VERBOSITY_LEVEL = 2)</code>), will it still return it to me?</p>

<p>Thanks!</p>

<bitcoin-core><bitcoind><block><chain-reorganization><getmemorypool>
How long are orphaned or stale blocks kept in bitcoin core nodes memory?
Malone
# How long are orphaned or stale blocks kept in bitcoin core nodes memory?

(Asked by: username_0 on 2019-07-17)

If there was a chain reorg, for example:

**Blockchain:**

`0a`---`1a`---`2a`---`3a`

becomes...

`0a`---`1a`---`2b`---`3b`

How long are blocks `2b` and `3b` kept in memory on the node?

If I query the node for block `2b` later (`getblock(2aBlockHash, VERBOSITY_LEVEL = 2)`), will it still return it to me?

Thanks!

**Tags:** bitcoin-core, bitcoind, block, chain-reorganization, getmemorypool


---

## 1 answers

### Answer by username_1 on 2019-07-17. Score: 4 | Accepted answer

What you are referring to are **stale blocks**. Orphaned blocks are one for which the previous (parent) hash field points to an unknown block or to a block not yet processed by the local node. Since Bitcoin Core follows [headers first](https://bitcoin.org/en/p2p-network-guide#headers-first) approach, block headers are downloaded and validated first before downloading the block data. As a result, full nodes will never receive blocks whose parents it doesn't know about. So with the current headers first approach an orphan block will not be downloaded by your Bitcoin Core node.

Now, coming to stale blocks. All blocks are stored on the disk in the `blocks/blk*.dat` file. The block data that you receive from your peers, if it is valid, is stored forever in that directory. However, in order to receive stale blocks, you need to be online at the time when your peer broadcasted a block to you from different chain view. Peers will only broadcast those blocks that they view form the current active chain from their perspective. So using that command, you will only be able to retrieve the stale blocks that you received when you were online.

You can use the `bitcoin-cli getchaintips` command to return information about all known tips in the block tree, including the main chain as well as other branches.


---

