BTW does BTC even supply for such a mechanism that it can cancel all payments if one fails ? Otherwise nobody would use it (who wants to pay 80% of a product and thus not receive the product) and your example isn't even valid
Yes, there is a mechanism to cancel a payment. Anyways, currently it isn't even possible to have a partial payment. The way that routing works is that the sender chooses the nodes to send through and will only initiate the process if it knows that the payment will happen (barring circumstances involving malicious actors or unforseen circumstances).
Actually I don't think this is correct. In A -> B -> C then C first finalizes payment from B by sending the pre-image to B. Then B does the same with A, exactly like explained here:
https://en.bitcoin.it/wiki/Hashed_Timelock_Contracts How is this different from a lending situation ? You ask your friend to pay for the pizza and after he paid for the pizza, you pay him.
No, that's not how it actually works on the technical level.
At the technical level, every node in the route first creates an HTLC offered output and HTLC received output in the channels that the payment is being routed through. This effectively locks in the coins and the order of those outputs being created is not guaranteed. I.e. A could offer the HTLC to B before B offers to C, in which case B owes A money. But just as likely is B offers C the HTLC output before it receives the HTLC from A, in which case A owes B money. In either case, neither party actually gets any money, so no money actually exchanged hands nor is anything actually owed. If B fails to offer the HTLC C, A will get his money back when the HTLC times out and B will not be able to have gotten any of that money at all. When the preimage is passed down the route from D to A (let's add one additional hop for this example), none of the parties in the route is able to get more money than they are supposed to even if they don't reveal the preimage to the next person. With lending money, the lender can steal the money, but in LN, the "lenders" (i.e. nodes in the route) cannot.
The reason for this is slightly complicated. In a route A -> B -> C -> D, D must reveal the preimage R in order to be paid. He can do this by either broadcasting the C -> D Commitment transaction and the HTLC success transaction (so he spends the HTLC output from the commitment tx) or by telling C what R is (and thus keep the channel open). If he broadcasts the HTLC success, then both B and C know what R is since R is in that HTLC success and can immediately broadcast their HTLC success transactions, so they are paid and pay money at exactly the same time.
If D gives C R and they settle off chain (to keep the channel open) but C refuses to give B R, he is actually out money since he has already settled the HTLC offered output but not his HTLC received. C is now short the money that he gave to D. Note that this is different from lending because this is not B refusing to give C his money but rather C refusing to take it. The only way C can take that money is if he gives B R or if he broadcasts the commitment transaction and HTLC success transaction. Either way, B will get R and he will end up paying the money to C as that is how HTLCs work.
The payment of the HTLCs is guaranteed because of the commitment transactions. HTLCs are part of the commitment transaction which is signed by both parties in the channel. In the B -> C channel, B cannot revert his HTLC without C agreeing to revert it. If he chose to broadcast an old commitment which did not have this HTLC, then he will be subject to C's revocation transaction which can take all of B's money. The way that HTLCs work is that if you can show that you know R, then the payment is guaranteed because you can spend that output. So once C knows R, his payment is guaranteed unless he waits too long and the HTLC times out. But then that is still not lending as B did not refuse to pay C but rather C refused to take money from B.
So in no way is this actually lending. No node has more money than they are supposed to. HTLCs are not a promise that you will give them the money (as it is with lending) but rather a guarantee that they
will get the money. Nodes must forward R down the route otherwise they will be losing money. There is no situation where a node can get more money than they are supposed.
Note that this only works when R goes from D -> A. If it went from A -> D, then it would be lending and a node could defraud the next node in the route. But LN goes the other way, so that is not a problem.