66 */
77public enum ConfirmationTarget {
88 /**
9- * We'd like a transaction to confirm in the future, but don't want to commit most of the fees
10- * required to do so yet. The remaining fees will come via a Child-Pays-For-Parent (CPFP) fee
11- * bump of the transaction.
9+ * We have some funds available on chain which we need to spend prior to some expiry time at
10+ * which point our counterparty may be able to steal them. Generally we have in the high tens
11+ * to low hundreds of blocks to get our transaction on-chain, but we shouldn't risk too low a
12+ * fee - this should be a relatively high priority feerate.
13+ */
14+ LDKConfirmationTarget_OnChainSweep ,
15+ /**
16+ * The highest feerate we will allow our channel counterparty to have in a non-anchor channel.
17+ *
18+ * This is the feerate on the transaction which we (or our counterparty) will broadcast in
19+ * order to close the channel unilaterally. Because our counterparty must ensure they can
20+ * always broadcast the latest state, this value being too low will cause immediate
21+ * force-closures.
1222 *
13- * The feerate returned should be the absolute minimum feerate required to enter most node
14- * mempools across the network. Note that if you are not able to obtain this feerate estimate,
15- * you should likely use the furthest-out estimate allowed by your fee estimator.
23+ * Allowing this value to be too high can allow our counterparty to burn our HTLC outputs to
24+ * dust, which can result in HTLCs failing or force-closures (when the dust HTLCs exceed
25+ * [`ChannelConfig::max_dust_htlc_exposure`]).
26+ *
27+ * Because most nodes use a feerate estimate which is based on a relatively high priority
28+ * transaction entering the current mempool, setting this to a small multiple of your current
29+ * high priority feerate estimate should suffice.
30+ *
31+ * [`ChannelConfig::max_dust_htlc_exposure`]: crate::util::config::ChannelConfig::max_dust_htlc_exposure
1632 */
17- LDKConfirmationTarget_MempoolMinimum ,
33+ LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee ,
1834 /**
19- * We are happy with a transaction confirming slowly, at least within a day or so worth of
20- * blocks.
35+ * This is the lowest feerate we will allow our channel counterparty to have in an anchor
36+ * channel in order to close the channel if a channel party goes away.
37+ *
38+ * This needs to be sufficient to get into the mempool when the channel needs to
39+ * be force-closed. Setting too high may result in force-closures if our counterparty attempts
40+ * to use a lower feerate. Because this is for anchor channels, we can always bump the feerate
41+ * later; the feerate here only needs to be sufficient to enter the mempool.
42+ *
43+ * A good estimate is the expected mempool minimum at the time of force-closure. Obviously this
44+ * is not an estimate which is very easy to calculate because we do not know the future. Using
45+ * a simple long-term fee estimate or tracking of the mempool minimum is a good approach to
46+ * ensure you can always close the channel. A future change to Bitcoin's P2P network
47+ * (package relay) may obviate the need for this entirely.
2148 */
22- LDKConfirmationTarget_Background ,
49+ LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee ,
2350 /**
24- * We'd like a transaction to confirm without major delayed, i.e., within the next 12-24 blocks.
51+ * The lowest feerate we will allow our channel counterparty to have in a non-anchor channel.
52+ *
53+ * This is the feerate on the transaction which we (or our counterparty) will broadcast in
54+ * order to close the channel if a channel party goes away. Setting this value too high will
55+ * cause immediate force-closures in order to avoid having an unbroadcastable state.
56+ *
57+ * This feerate represents the fee we pick now, which must be sufficient to enter a block at an
58+ * arbitrary time in the future. Obviously this is not an estimate which is very easy to
59+ * calculate. This can leave channels subject to being unable to close if feerates rise, and in
60+ * general you should prefer anchor channels to ensure you can increase the feerate when the
61+ * transactions need broadcasting.
62+ *
63+ * Do note some fee estimators round up to the next full sat/vbyte (ie 250 sats per kw),
64+ * causing occasional issues with feerate disagreements between an initiator that wants a
65+ * feerate of 1.1 sat/vbyte and a receiver that wants 1.1 rounded up to 2. If your fee
66+ * estimator rounds subtracting 250 to your desired feerate here can help avoid this issue.
67+ *
68+ * [`ChannelConfig::max_dust_htlc_exposure`]: crate::util::config::ChannelConfig::max_dust_htlc_exposure
2569 */
26- LDKConfirmationTarget_Normal ,
70+ LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee ,
2771 /**
28- * We'd like a transaction to confirm in the next few blocks.
72+ * This is the feerate on the transaction which we (or our counterparty) will broadcast in
73+ * order to close the channel if a channel party goes away.
74+ *
75+ * This needs to be sufficient to get into the mempool when the channel needs to
76+ * be force-closed. Setting too low may result in force-closures. Because this is for anchor
77+ * channels, it can be a low value as we can always bump the feerate later.
78+ *
79+ * A good estimate is the expected mempool minimum at the time of force-closure. Obviously this
80+ * is not an estimate which is very easy to calculate because we do not know the future. Using
81+ * a simple long-term fee estimate or tracking of the mempool minimum is a good approach to
82+ * ensure you can always close the channel. A future change to Bitcoin's P2P network
83+ * (package relay) may obviate the need for this entirely.
84+ */
85+ LDKConfirmationTarget_AnchorChannelFee ,
86+ /**
87+ * Lightning is built around the ability to broadcast a transaction in the future to close our
88+ * channel and claim all pending funds. In order to do so, non-anchor channels are built with
89+ * transactions which we need to be able to broadcast at some point in the future.
90+ *
91+ * This feerate represents the fee we pick now, which must be sufficient to enter a block at an
92+ * arbitrary time in the future. Obviously this is not an estimate which is very easy to
93+ * calculate, so most lightning nodes use some relatively high-priority feerate using the
94+ * current mempool. This leaves channels subject to being unable to close if feerates rise, and
95+ * in general you should prefer anchor channels to ensure you can increase the feerate when the
96+ * transactions need broadcasting.
97+ *
98+ * Since this should represent the feerate of a channel close that does not need fee
99+ * bumping, this is also used as an upper bound for our attempted feerate when doing cooperative
100+ * closure of any channel.
101+ */
102+ LDKConfirmationTarget_NonAnchorChannelFee ,
103+ /**
104+ * When cooperatively closing a channel, this is the minimum feerate we will accept.
105+ * Recommended at least within a day or so worth of blocks.
106+ *
107+ * This will also be used when initiating a cooperative close of a channel. When closing a
108+ * channel you can override this fee by using
109+ * [`ChannelManager::close_channel_with_feerate_and_script`].
110+ *
111+ * [`ChannelManager::close_channel_with_feerate_and_script`]: crate::ln::channelmanager::ChannelManager::close_channel_with_feerate_and_script
29112 */
30- LDKConfirmationTarget_HighPriority ,
113+ LDKConfirmationTarget_ChannelCloseMinimum ,
31114 ; static native void init ();
32115 static { init (); }
33116}
0 commit comments