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?
You will find the answer to your question in BOLT 02 in the section about the
from there I quote:
update_fulfill_htlcdoesn't SHA256 hash to the corresponding HTLC
payment_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 (
But I did not double check in the implementations