This question already has an answer here:
I'm trying to understand bitcoin transactions verification specified here. Item 10 states, that parent transaction (mentioned as input for current) should be searched not only in already confirmed transactions (in main chain), but also in transaction pool (which contains unconfirmed transactions). This means, that transaction can become a candidate to be added to block even if it's parent is not in the blockchain. If this is true, than consider following situation:
- Transactions A and B are created in the same moment, A is parent of B.
- Miner receives both of them, both are considered valid.
- Miner adds only transaction B to block.
If such block is mined, it will be invalid, because other nodes will fail to validate transaction B. But if we also insert transaction A in it, will validation succeed on other nodes? I.e., is it possible to add transaction and its parent to the same block?