How does Kaspa calculate the mergeset for a new block?
The mergeset of a new block is all the blocks that can be reached through the new block's parent set but are not already ancestors of its selected parent. In Kaspa's blockDAG, each block can reference multiple parents, and one of those parents is designated the "selected parent" — the main chain ancestor. Any other blocks that are reachable through the remaining parents, yet sit outside the selected parent's ancestry, are gathered into the mergeset. In the concrete example from the source: if block B is the selected parent and the new block also connects to blocks C and D, then C and D form the mergeset. This matters for beginners because the mergeset is how Kaspa's consensus engine accounts for parallel blocks instead of discarding them, which is what lets the network process transactions at high speed without losing security.