For testing purposes, I want to reduce the number of confirmations required until a LDK-based Lightning node deems a channel ready for operation.
How can I accomplish this?
According to the BOLT #2 specs, the non-funding counterparty indicates which confirmation depth it is willing to accept via the minimum_depth
field in the accept_channel
message.
In LDK you can configure this for inbound channels via ChannelHandshakeConfig::minimum_depth
and the opening counterparty can limit what maximum value it is willing to accept via ChannelHandshakeLimits::max_minimum_depth
.
Note that you may also want to enable zero confirmation channels. For outbound channels you can simply enable this via setting ChannelHandshakeLimits::trust_own_fundings_0conf
. As inbound zero confirmation channels are a risk for the accepting party, LDK requires you to manually check and accept each such channel. You can enable this by setting UserConfig::manually_accept_inbound_channels
, upon which you'll start receiving an OpenChannelRequest
event for each inbound channel. For each request you want to accept you then need to call ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
, or can force-close the channel otherwise.