0
I think I understand HTLCs, at least if they are on chain. I also have a basic understanding of how off chain channel looks like.
I understand it as follows. It is a 2-of-2 multisig transaction output, which is on chain and confirmed sufficiently. Before this transaction was put on chain, the parties created another transaction, which they haven't published yet. This second transaction is necessary in case either party would not be cooperative to provide its signature for the initial multisig.
This second transaction pays each party the agreed final balance as per current status of the channel. This transaction is ready to go on chain, it is fully signed, the parties just decided not to publish it yet because they may want to replace this second transaction with different finalising transaction.
Now the question is – When a payment is to be done through this channel using HTLC, what are the inputs to it? Is the output of the original multisig? If so, how would you do 2 or more HTLCs at the same time (i.e. you have enough liquidity on the channel to do multiple payments, but it takes time to finish current payment when someone wants to pay through you again)?
What would be the inputs for those other HTLCs? Exactly when is the finalising transaction spending the initial multisig updated in the database of the participants?
And would you need to close the channel and put a transaction on chain in case a single HTLC payment fails?
So multiple unfinished HTLCs would just be added as extra outputs and you could have many outputs in that commitment tx (e.g. 20 outputs)? – Wapac – 2019-05-25T09:31:12.177
Also, is it thus necessary to close the channel if single one out of all currently unfinished HTLCs fails? – Wapac – 2019-05-25T10:07:44.173
You can have up to 483 concurrent htlcs. If an onion fails the htlc is removed no need to settle the channel on chain. But if the channels fails (for some other reason) and needs to be settled all htlcs will be resolved onchain – Rene Pickhardt – 2019-05-25T19:45:20.113
Could you please elaborate on that? What do you mean by onion fails? When can channel fail? My question here was what happens if a single routed payment is not finished (i.e. times out), does this cause what you call channel fail? – Wapac – 2019-05-26T09:34:46.403
No that causes that the routing process stops which means that the htlc is not forwarded and an error is send back so that the previous htlcs can also be cancled. The Channel fails usually off someone breaches the protocol. For example if wrongful data is sent over the transport layer (this would actually fail the connection which in turn will lead to failure of the channel). If a node fails the channel the most recent commitment tx is broadcast and a force close is initiated / executed – Rene Pickhardt – 2019-05-27T11:52:08.097