0

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:

  1. Transactions A and B are created in the same moment, A is parent of B.
  2. Miner receives both of them, both are considered valid.
  3. 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?

marked as duplicate by Nate Eldredge, Raghav Sood, JBaczuk, G. Maxwell, Jonathan Cross Aug 23 '18 at 14:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Yes, you're right. I performed search using different search strings and did not see this post, thank you. – Anton Pantuykhin Aug 21 '18 at 9:46
1

is it possible to add transaction and its parent to the same block?

Yes, as long as A exists in the mempool when B is submitted, it will be allowed in the mempool, and can be in the same block, see Order of transactions within a block. A transaction that consumes invalid unspent outputs (UTXOs) will be rejected before it enters the mempool.

If a miner mines a block with a transaction (in this case B) that has an invalid input (ie the UTXO it is spending does not exist), the block will be rejected when it is submitted because it is a block with invalid transactions.

1

I.e., is it possible to add transaction and its parent to the same block?

Yes. The "parent" transaction must be earlier in block.

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