Question: Transactions in both stale block and mined block

Hi all,

So I have a question about the principle of stale blocks. I understand the transactions of a stale block are sent back to the mempool. But what happens if a transaction is also included in the confirmed block already? It will then be in a confirmed block ánd the mempool.

Case:

  • Block A:
    • TxA
    • TxB
    • TxC
  • Block B:
    • TxC
    • TxD
    • TxE

Imagine block A being dropped (stale). This means TxA, TxB and TxC are returned to the mempool. However, TxC is actually mined in Block B as well.

Now I am pretty sure this transaction won’t be added in the blockchain twice, so basically, I am wondering, how are such transactions deduplicated?

1 Like

In this case the transaction simply doesn’t go back into the mempool because its already confirmed in the winning chain. The nodes will verify the transactions in blocks once they receive the chain with most PoW.

And even if they didn’t, the tx would be invalid and wouldn’t be added to the next block once eventually chosen because that would make the entire block invalid. :slight_smile:

1 Like

Thanks for that. After going through Filips parts about forks and segwit I also understand tx’s do have a unique ID as well so yeah, pretty obvious in hindsight! :-p.

Yes, the tx hash is also the txid :slight_smile: