bitcoin core – What happens if a transaction is duplicated across different blocks?
I’m sure I am missing something trivial here but I have a question.
Let’s say we have Node A and Node B.
We send a transaction request to both nodes.
Both nodes now contain an unconfirmed transaction in their local mempool.
Node A includes the transaction in the next block with a successful solution.
Node B accepts the new blockchain from Node A and now continues the chain by creating a new block, including the transaction it received earlier in the next block.
So we have a situation where Node A included the transaction in the first block and Node B included the transaction in the second block.
How is this prevented?
I am aware of double spending but the resources I have read usually talk about the same transaction being included in the next block of both nodes but, in that case, one of the blocks would just be discarded.