I found myself incapable of answering what would happen in this case, so here it is:
A hacker (
Mr Hacker) spendsUTXO_1andUTXO_2inTX_1, depositing the monetary value of allTX_1's outputs into aService(eg a payment processor).A legitimate user (
Mr Legit) spendsUTXO_3inTX_2. Again,TX_2's outputs targets the sameServiceBoth
TX_1andTX_2make it into the same block and get one confirmation by the network.The
Serviceimmediately spendsUTXO_1andUTXO_3inTX_3to payMr LegitandUTXO_2inTX_4to payMr Smith.Mr Hackerthen decides to double-spendTX_1and for that reason he createsTX_5which "redirects" all outputs to himself.Mr Hackeris a miner so he is able to perform all the hashing work to make the double-spend successful. He is also lucky and the double-spend succeeds.
So the question is:
Have all TXs before
TX_5(TXs: 1,2,3,4) been invalidated or justTX_1,TX_3andTX_4(TX_3andTX_4spent an output previous controlled byTX_1which was double-spent)?Mr Legitcould see 1 confirmation forTX_2before the double-spending. What does he see now? What doesMr Smithsee in his wallet, before and after the double-spending?The
Servicerealizes that a double-spending took place and needs to recover from that broken state. What does it have to do to get back to normal operation? Does it have to re-send all the TXs? Does it still have in place the deposits made byTX_2after the double-spending or does it have to do something to re-claim these outputs?How can the
ServicepreventMr Hacker, who also has plenty of money to spend, from repeating the same process forever just to ruin theService's smooth operation, rather than (theService) waiting for more confirmations before sending out the payments?