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