I recently had this problem IRL: tried to pay in a coffee shop with LN, but my channel partner was "sleeping", so after a while I paid in cash. Then, 5 min later, the server comes back online, the LN payment went through and I had to go get my cash back.

lightning-wallet.com doesn't seem to have a stop button, but I think this (IMHO important) usage scenario is just not possible in the protocol right now, is it? The BOLTs say: "For simplicity, a node can only remove HTLCs added by the other node. There are four reasons for removing an HTLC: the payment preimage is supplied, it has timed out, it has failed to route, or it is malformed.".

So I guess the question is, why is this not possible today? Just a UI problem, a protocol shortcoming that will be fixed, or is there a deeper reason why it CAN'T be possible?


First of all: it is in fact not possible at this time to sort a stuck payment. The htlcs are a contract in which you agree to fulfill a payment if the routing node provides a preimage within a time window (the timelock). Assume you would be allowed to remove an htlc before the timelock, not only would this be a breach to the contract but it could easily result in a behavior in which you could initiate a payment, the merchant would claim the money, and while the preimage is propagated back to you, you would cancel your htlc causing the routing node to lose money.

Obviously as a protocol extension we could think about making a different onion request "abort routing" which would inform all nodes on the path to abort. This would have to be executed from the recipient back to the sender and would mitigate the above mentioned way of abusive behavior.

However such a new onion request would mean that everyone on the path is responsive to it. If that was the case in the first place the payment would not have been stuck.

It is always hard for mathematicians (like me) to claim something is impossible. But I think in this case we have it by design impossible / undesirable to cancel htlcs from the sender side. (I am happy to be proven wrong and would enjoy a discussion on the lightning dev ml as I think from a UI / UX perspective your request is totally reasonable)

Also keep in mind what removing an htlc currently means. The state of the channel is changed.

  • Thank you for the quick answer. I think in this case, there wasn't even an HTLC agreed upon yet (the first channel partner was "sleeping", whatever that means). So I guess there are many possible answers and subtleties depending on the precise timing. But I think we should have a better UX story here, and think closely about the possible cases. – stefanwouldgo Apr 23 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.