2
0
From the offered HTLC Outputs,
# To remote node with revocation key
OP_DUP OP_HASH160 <RIPEMD160(SHA256(revocationpubkey))> OP_EQUAL
OP_IF
OP_CHECKSIG
OP_ELSE
<remote_htlcpubkey> OP_SWAP OP_SIZE 32 OP_EQUAL
OP_NOTIF
# To local node via HTLC-timeout transaction (timelocked).
OP_DROP 2 OP_SWAP <local_htlcpubkey> 2 OP_CHECKMULTISIG
OP_ELSE
# To remote node with preimage.
OP_HASH160 <RIPEMD160(payment_hash)> OP_EQUALVERIFY
OP_CHECKSIG
OP_ENDIF
OP_ENDIF
With the following conditions,
- a
locktimeis set to be 600900 in the HTLC-Timeout transaction. - the remote node has the
payment_secret. - the local node wants to timeout the latest commitment transaction.
From my understanding, to timeout the latest commitment transaction, the local node has to,
- broadcast the commitment transaction at blockheight 600900;
- immediately broadcast the HTLC-Timeout transaction;
- wait a few days to spend the HTLC-Timeout transaction once the specified timelock value has passed.
Meanwhile, the remote node with the payment_secret can spend the commitment transaction too. Will this cause a race condition/double spend in the Bitcoin network? If so, how can it be resolve?
Thank you for your answer! Yet the local commitment tx needs to be broadcasted with the htlc-timeout tx, otherwise, there would be no race condition. I'm wondering whether it's the preimage holder's responsibility to avoid the race condition? – yyforyongyu – 2019-10-25T07:57:42.293