Consider a multi-hop Lightning payment from Alice via Bob to Charlie. Charlie creates an invoice, Alice finds a route and forwards the payment, now Charlie is expected to redeem the payment by revealing the preimage to Bob. If Charlie tries to redeem the payment using an incorrect preimage, does Bob cancel the payment altogether, or does Charlie get "a second chance" to redeem it?
1 Answer
You will find the answer to your question in BOLT 02 in the section about the update_fulfill_htlc message
from there I quote:
If the
payment_preimage
value inupdate_fulfill_htlc
doesn't SHA256 hash to the corresponding HTLCpayment_hash
[the receiving node] MUST fail the channel.
This goes for every local HTLC so if Charlie sends the wrong payment_preimage
Bob will fail the channel with Chralie. If Bob alters the preimage
Alice will fail the channel.
Whoever fails the channel should fail the onion as the path does not exist anymore. Reading BOLT 04 I guess it returns
type: PERM|8 (
permanent_channel_failure
)
But I did not double check in the implementations
-
interestingly enough I just realized that the person trying to release a wrong preimage might get a second chance. Failing the channel should be collaboratively in which case the HTLCs will timeout first before publishing a closing transaction. However if the channel is closed with a force close the HTLC is now onchain and there it could be claimed with the correct preimage (which obviously comes with additional onchain fees for the transaction redeeming the HTLC) Jul 19, 2019 at 10:54