What is happening when a channel is pending when opened? How long does it usually take? To open a channel with a node you're already connected to you don't need to get consensus from all the other connected nodes (as you would if you were sending a transaction on chain) so why the wait?
2 Answers
Opening a channel involves sending an on-chain transaction (with a multisig output controlled by the channel’s participants), so when the channel is ‘pending’ it simply means this transaction is not yet confirmed. How long it takes the transaction to confirm depends on the same factors as any other transaction.
Further, the participants will often wait for a certain number of transaction confirmations before starting to make channel payments. The number of confirmations required is negotiated in the minimum_depth
parameter of the accept_channel
message. From BOLT 2:
The
funding_locked
message indicates that the funding transaction has reached theminimum_depth
asked for inaccept_channel
. Once both nodes have sent this, the channel enters normal operating mode
(thanks to @jnewbery for the added info)
-
@selfishminer you should add your edit as a separate answer since it is a complete re-write compared to mine, but I think it is helpful.– chytrikNov 7, 2018 at 10:08
-
1"Once the transaction confirms..." the participants actually wait for a certain number of confirmations before starting to make channel payments. The number of confirmations required is negotiated in the
minimum_depth
parameter of theaccept_channel
message. From BOLT 2: "Thefunding_locked
message indicates that the funding transaction has reached theminimum_depth
asked for inaccept_channel
. Once both nodes have sent this, the channel enters normal operating mode."– jnewberyNov 30, 2018 at 2:51 -
@jnewbery thanks for the clarification/extra info, I've edited the answer to include it– chytrikNov 30, 2018 at 3:04
What is happening when a channel is pending when opened? How long does it usually take?
A node establishes a channel by sending an open_channel message to its desired peer. This message specifies the parameters under which the channel will operate (e.g. the number of bitcoin the channel will be funded with and the cost to route payments through the channel). The channel counterparty must reply with the accept channel message, one parameter of which is minimum_depth
, wherein the number of confirmations the funding transaction must have (before the channel can be used) is specified. This protects channel participants from losing money in the event the funding transaction is double spent.
To open a channel with a node you're already connected to you don't need to get consensus from all the other connected nodes (as you would if you were sending a transaction on chain) so why the wait?
Establishing a network connection with a node is only one step in the process of establishing a lightning channel. The funds must first be secured in a multisignature output (2-of-2, with one key from each channel participant). Moving the funds to a multisignature output can only be done with an on-chain transaction. Without this step there is no way to restrict one party from stealing the funds outright. Once the funds have been moved to such an output, channel participants can make lightning transactions.