I found myself incapable of answering what would happen in this case, so here it is:
A hacker (
Mr Hacker
) spendsUTXO_1
andUTXO_2
inTX_1
, depositing the monetary value of allTX_1
's outputs into aService
(eg a payment processor).A legitimate user (
Mr Legit
) spendsUTXO_3
inTX_2
. Again,TX_2
's outputs targets the sameService
Both
TX_1
andTX_2
make it into the same block and get one confirmation by the network.The
Service
immediately spendsUTXO_1
andUTXO_3
inTX_3
to payMr Legit
andUTXO_2
inTX_4
to payMr Smith
.Mr Hacker
then decides to double-spendTX_1
and for that reason he createsTX_5
which "redirects" all outputs to himself.Mr Hacker
is 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_3
andTX_4
(TX_3
andTX_4
spent an output previous controlled byTX_1
which was double-spent)?Mr Legit
could see 1 confirmation forTX_2
before the double-spending. What does he see now? What doesMr Smith
see in his wallet, before and after the double-spending?The
Service
realizes 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_2
after the double-spending or does it have to do something to re-claim these outputs?How can the
Service
preventMr 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?