If there was a chain reorg, for example:





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?


1 Answer 1


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 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.