Would a block containing a transaction with an identical hash as a previous transaction be considered valid? That is, if someone made a transaction for generating Bitcoins and solve two blocks with the same coinbase transaction, would the second block using that transaction valid?
2 Answers
The transaction would be valid - there is nothing in the protocol that forbids this.
This is also the cause of the "duplicate coinbase" bug in the Satoshi client which I discovered a few months ago. If you create a block with a duplicate coinbase and that block then becomes orphaned it will cause the both the original and duplicate tx to be removed from the database.
-
Isnt the probability in this happening make it almost not worth consider fixing? Not that im saying any bugs are a good thing. Just others should have priority.– MaxSanCommented Feb 28, 2012 at 15:41
-
2@MaxSan: A miner could have, in the past, intentionally triggered this bug. It's very, very hard to do that now, since the mining difficulty is so much higher. Essentially, though, it's just an attack on themselves. They've carefully created coins they can't spend with, and which won't be accepted by, the standard client. Commented Feb 28, 2012 at 16:34
-
2They can use it to make other people's coinbase transactions unspendable as well. For example If I mine a copy of the genesis transaction and that block was orphaned it would make the genesis transaction unspendable (from all clients with the corrupted database). When P2SH hits the problem will be exacerbated as you can mine a block which you can pretty much guarantee will be orphaned.– user418Commented Feb 28, 2012 at 17:28
-
That's valid (and has happened) for coinbase transactions and transactions built off of coinbase transactions. Other than those strange cases, putting the same transaction in the chain twice isn't allowed.
Coinbase duplicates are only allowed due to an oversight. It will be corrected soon.
-
1"Other than those strange cases ... isn't allowed" -> It is allowed, just incredibly hard to do (preimage attack on SHA256). Commented Feb 28, 2012 at 22:17