user43221: Is there orphaned blocks in blockchain?
I mean a database of full node. Is it true that orphaned blocks (that outside the mainchain) already are in blk00*.dat files?

user5406: During the initial block download, a node will only receive blocks that are part of the best chain from other peers. Stale blocks are not be advertised to peers and since they would serve as a fingerprint to identify nodes there are also no methods of asking for them explicitly.
Later when synchronized, a node that receives competing blocks at the chaintip will store them both in its blk….dat files. A node would not specifically remove the stale blocks from their blockchain data, but they would get pruned just like other block data if the node is running in pruning mode.

43221: <p>Is there orphaned blocks in blockchain?</p>

<p>I mean a database of full node. Is it true that orphaned blocks (that outside the mainchain) already are in <code>blk00*.dat</code> files?</p>
 5406: <p>During the initial block download, a node will only receive blocks that are part of the best chain from other peers. Stale blocks are not be advertised to peers and since they would serve as a fingerprint to identify nodes there are also no methods of asking for them explicitly.</p>
<p>Later when synchronized, a node that receives competing blocks at the chaintip will store them both in its <code>blk….dat</code> files. A node would not specifically remove the stale blocks from their blockchain data, but they would get pruned just like other block data if the node is running in pruning mode.</p>
