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