]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/ChannelManager.java
[Java] Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / ChannelManager.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * Manager which keeps track of a number of channels and sends messages to the appropriate
13  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
14  * 
15  * Implements [`ChannelMessageHandler`], handling the multi-channel parts and passing things through
16  * to individual Channels.
17  * 
18  * Implements [`Writeable`] to write out all channel state to disk. Implies [`peer_disconnected`] for
19  * all peers during write/read (though does not modify this instance, only the instance being
20  * serialized). This will result in any channels which have not yet exchanged [`funding_created`] (i.e.,
21  * called [`funding_transaction_generated`] for outbound channels) being closed.
22  * 
23  * Note that you can be a bit lazier about writing out `ChannelManager` than you can be with
24  * [`ChannelMonitor`]. With [`ChannelMonitor`] you MUST write each monitor update out to disk before
25  * returning from [`chain::Watch::watch_channel`]/[`update_channel`], with ChannelManagers, writing updates
26  * happens out-of-band (and will prevent any other `ChannelManager` operations from occurring during
27  * the serialization process). If the deserialized version is out-of-date compared to the
28  * [`ChannelMonitor`] passed by reference to [`read`], those channels will be force-closed based on the
29  * `ChannelMonitor` state and no funds will be lost (mod on-chain transaction fees).
30  * 
31  * Note that the deserializer is only implemented for `(`[`BlockHash`]`, `[`ChannelManager`]`)`, which
32  * tells you the last block hash which was connected. You should get the best block tip before using the manager.
33  * See [`chain::Listen`] and [`chain::Confirm`] for more details.
34  * 
35  * Note that `ChannelManager` is responsible for tracking liveness of its channels and generating
36  * [`ChannelUpdate`] messages informing peers that the channel is temporarily disabled. To avoid
37  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
38  * offline for a full minute. In order to track this, you must call
39  * [`timer_tick_occurred`] roughly once per minute, though it doesn't have to be perfect.
40  * 
41  * To avoid trivial DoS issues, `ChannelManager` limits the number of inbound connections and
42  * inbound channels without confirmed funding transactions. This may result in nodes which we do
43  * not have a channel with being unable to connect to us or open new channels with us if we have
44  * many peers with unfunded channels.
45  * 
46  * Because it is an indication of trust, inbound channels which we've accepted as 0conf are
47  * exempted from the count of unfunded channels. Similarly, outbound channels and connections are
48  * never limited. Please ensure you limit the count of such channels yourself.
49  * 
50  * Rather than using a plain `ChannelManager`, it is preferable to use either a [`SimpleArcChannelManager`]
51  * a [`SimpleRefChannelManager`], for conciseness. See their documentation for more details, but
52  * essentially you should default to using a [`SimpleRefChannelManager`], and use a
53  * [`SimpleArcChannelManager`] when you require a `ChannelManager` with a static lifetime, such as when
54  * you're using lightning-net-tokio.
55  * 
56  * [`peer_disconnected`]: msgs::ChannelMessageHandler::peer_disconnected
57  * [`funding_created`]: msgs::FundingCreated
58  * [`funding_transaction_generated`]: Self::funding_transaction_generated
59  * [`BlockHash`]: bitcoin::hash_types::BlockHash
60  * [`update_channel`]: chain::Watch::update_channel
61  * [`ChannelUpdate`]: msgs::ChannelUpdate
62  * [`timer_tick_occurred`]: Self::timer_tick_occurred
63  * [`read`]: ReadableArgs::read
64  */
65 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
66 public class ChannelManager extends CommonBase {
67         ChannelManager(Object _dummy, long ptr) { super(ptr); }
68         @Override @SuppressWarnings("deprecation")
69         protected void finalize() throws Throwable {
70                 super.finalize();
71                 if (ptr != 0) { bindings.ChannelManager_free(ptr); }
72         }
73
74         /**
75          * Constructs a new `ChannelManager` to hold several channels and route between them.
76          * 
77          * This is the main \"logic hub\" for all channel-related actions, and implements
78          * [`ChannelMessageHandler`].
79          * 
80          * Non-proportional fees are fixed according to our risk using the provided fee estimator.
81          * 
82          * Users need to notify the new `ChannelManager` when a new block is connected or
83          * disconnected using its [`block_connected`] and [`block_disconnected`] methods, starting
84          * from after [`params.best_block.block_hash`]. See [`chain::Listen`] and [`chain::Confirm`] for
85          * more details.
86          * 
87          * [`block_connected`]: chain::Listen::block_connected
88          * [`block_disconnected`]: chain::Listen::block_disconnected
89          * [`params.best_block.block_hash`]: chain::BestBlock::block_hash
90          */
91         public static ChannelManager of(org.ldk.structs.FeeEstimator fee_est, org.ldk.structs.Watch chain_monitor, org.ldk.structs.BroadcasterInterface tx_broadcaster, org.ldk.structs.Router router, org.ldk.structs.Logger logger, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.SignerProvider signer_provider, org.ldk.structs.UserConfig config, org.ldk.structs.ChainParameters params) {
92                 long ret = bindings.ChannelManager_new(fee_est.ptr, chain_monitor.ptr, tx_broadcaster.ptr, router.ptr, logger.ptr, entropy_source.ptr, node_signer.ptr, signer_provider.ptr, config == null ? 0 : config.ptr, params == null ? 0 : params.ptr);
93                 Reference.reachabilityFence(fee_est);
94                 Reference.reachabilityFence(chain_monitor);
95                 Reference.reachabilityFence(tx_broadcaster);
96                 Reference.reachabilityFence(router);
97                 Reference.reachabilityFence(logger);
98                 Reference.reachabilityFence(entropy_source);
99                 Reference.reachabilityFence(node_signer);
100                 Reference.reachabilityFence(signer_provider);
101                 Reference.reachabilityFence(config);
102                 Reference.reachabilityFence(params);
103                 if (ret >= 0 && ret <= 4096) { return null; }
104                 org.ldk.structs.ChannelManager ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelManager(null, ret); }
105                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
106                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_est); };
107                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(chain_monitor); };
108                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(tx_broadcaster); };
109                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(router); };
110                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
111                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
112                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
113                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(signer_provider); };
114                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(config); };
115                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(params); };
116                 return ret_hu_conv;
117         }
118
119         /**
120          * Gets the current configuration applied to all new channels.
121          */
122         public UserConfig get_current_default_configuration() {
123                 long ret = bindings.ChannelManager_get_current_default_configuration(this.ptr);
124                 Reference.reachabilityFence(this);
125                 if (ret >= 0 && ret <= 4096) { return null; }
126                 org.ldk.structs.UserConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UserConfig(null, ret); }
127                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
128                 return ret_hu_conv;
129         }
130
131         /**
132          * Creates a new outbound channel to the given remote node and with the given value.
133          * 
134          * `user_channel_id` will be provided back as in
135          * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
136          * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a
137          * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it
138          * is simply copied to events and otherwise ignored.
139          * 
140          * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
141          * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
142          * 
143          * Note that we do not check if you are currently connected to the given peer. If no
144          * connection is available, the outbound `open_channel` message may fail to send, resulting in
145          * the channel eventually being silently forgotten (dropped on reload).
146          * 
147          * Returns the new Channel's temporary `channel_id`. This ID will appear as
148          * [`Event::FundingGenerationReady::temporary_channel_id`] and in
149          * [`ChannelDetails::channel_id`] until after
150          * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
151          * one derived from the funding transaction's TXID. If the counterparty rejects the channel
152          * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
153          * 
154          * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
155          * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
156          * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
157          * 
158          * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
159          */
160         public Result__u832APIErrorZ create_channel(byte[] their_network_key, long channel_value_satoshis, long push_msat, org.ldk.util.UInt128 user_channel_id, @Nullable org.ldk.structs.UserConfig override_config) {
161                 long ret = bindings.ChannelManager_create_channel(this.ptr, InternalUtils.check_arr_len(their_network_key, 33), channel_value_satoshis, push_msat, user_channel_id.getLEBytes(), override_config == null ? 0 : override_config.ptr);
162                 Reference.reachabilityFence(this);
163                 Reference.reachabilityFence(their_network_key);
164                 Reference.reachabilityFence(channel_value_satoshis);
165                 Reference.reachabilityFence(push_msat);
166                 Reference.reachabilityFence(user_channel_id);
167                 Reference.reachabilityFence(override_config);
168                 if (ret >= 0 && ret <= 4096) { return null; }
169                 Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret);
170                 if (this != null) { this.ptrs_to.add(override_config); };
171                 return ret_hu_conv;
172         }
173
174         /**
175          * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for
176          * more information.
177          */
178         public ChannelDetails[] list_channels() {
179                 long[] ret = bindings.ChannelManager_list_channels(this.ptr);
180                 Reference.reachabilityFence(this);
181                 int ret_conv_16_len = ret.length;
182                 ChannelDetails[] ret_conv_16_arr = new ChannelDetails[ret_conv_16_len];
183                 for (int q = 0; q < ret_conv_16_len; q++) {
184                         long ret_conv_16 = ret[q];
185                         org.ldk.structs.ChannelDetails ret_conv_16_hu_conv = null; if (ret_conv_16 < 0 || ret_conv_16 > 4096) { ret_conv_16_hu_conv = new org.ldk.structs.ChannelDetails(null, ret_conv_16); }
186                         if (ret_conv_16_hu_conv != null) { ret_conv_16_hu_conv.ptrs_to.add(this); };
187                         ret_conv_16_arr[q] = ret_conv_16_hu_conv;
188                 }
189                 return ret_conv_16_arr;
190         }
191
192         /**
193          * Gets the list of usable channels, in random order. Useful as an argument to
194          * [`Router::find_route`] to ensure non-announced channels are used.
195          * 
196          * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
197          * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
198          * are.
199          */
200         public ChannelDetails[] list_usable_channels() {
201                 long[] ret = bindings.ChannelManager_list_usable_channels(this.ptr);
202                 Reference.reachabilityFence(this);
203                 int ret_conv_16_len = ret.length;
204                 ChannelDetails[] ret_conv_16_arr = new ChannelDetails[ret_conv_16_len];
205                 for (int q = 0; q < ret_conv_16_len; q++) {
206                         long ret_conv_16 = ret[q];
207                         org.ldk.structs.ChannelDetails ret_conv_16_hu_conv = null; if (ret_conv_16 < 0 || ret_conv_16 > 4096) { ret_conv_16_hu_conv = new org.ldk.structs.ChannelDetails(null, ret_conv_16); }
208                         if (ret_conv_16_hu_conv != null) { ret_conv_16_hu_conv.ptrs_to.add(this); };
209                         ret_conv_16_arr[q] = ret_conv_16_hu_conv;
210                 }
211                 return ret_conv_16_arr;
212         }
213
214         /**
215          * Gets the list of channels we have with a given counterparty, in random order.
216          */
217         public ChannelDetails[] list_channels_with_counterparty(byte[] counterparty_node_id) {
218                 long[] ret = bindings.ChannelManager_list_channels_with_counterparty(this.ptr, InternalUtils.check_arr_len(counterparty_node_id, 33));
219                 Reference.reachabilityFence(this);
220                 Reference.reachabilityFence(counterparty_node_id);
221                 int ret_conv_16_len = ret.length;
222                 ChannelDetails[] ret_conv_16_arr = new ChannelDetails[ret_conv_16_len];
223                 for (int q = 0; q < ret_conv_16_len; q++) {
224                         long ret_conv_16 = ret[q];
225                         org.ldk.structs.ChannelDetails ret_conv_16_hu_conv = null; if (ret_conv_16 < 0 || ret_conv_16 > 4096) { ret_conv_16_hu_conv = new org.ldk.structs.ChannelDetails(null, ret_conv_16); }
226                         if (ret_conv_16_hu_conv != null) { ret_conv_16_hu_conv.ptrs_to.add(this); };
227                         ret_conv_16_arr[q] = ret_conv_16_hu_conv;
228                 }
229                 return ret_conv_16_arr;
230         }
231
232         /**
233          * Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a
234          * successful path, or have unresolved HTLCs.
235          * 
236          * This can be useful for payments that may have been prepared, but ultimately not sent, as a
237          * result of a crash. If such a payment exists, is not listed here, and an
238          * [`Event::PaymentSent`] has not been received, you may consider resending the payment.
239          * 
240          * [`Event::PaymentSent`]: events::Event::PaymentSent
241          */
242         public RecentPaymentDetails[] list_recent_payments() {
243                 long[] ret = bindings.ChannelManager_list_recent_payments(this.ptr);
244                 Reference.reachabilityFence(this);
245                 int ret_conv_22_len = ret.length;
246                 RecentPaymentDetails[] ret_conv_22_arr = new RecentPaymentDetails[ret_conv_22_len];
247                 for (int w = 0; w < ret_conv_22_len; w++) {
248                         long ret_conv_22 = ret[w];
249                         org.ldk.structs.RecentPaymentDetails ret_conv_22_hu_conv = org.ldk.structs.RecentPaymentDetails.constr_from_ptr(ret_conv_22);
250                         if (ret_conv_22_hu_conv != null) { ret_conv_22_hu_conv.ptrs_to.add(this); };
251                         ret_conv_22_arr[w] = ret_conv_22_hu_conv;
252                 }
253                 return ret_conv_22_arr;
254         }
255
256         /**
257          * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
258          * will be accepted on the given channel, and after additional timeout/the closing of all
259          * pending HTLCs, the channel will be closed on chain.
260          * 
261          * If we are the channel initiator, we will pay between our [`Background`] and
262          * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
263          * estimate.
264          * If our counterparty is the channel initiator, we will require a channel closing
265          * transaction feerate of at least our [`Background`] feerate or the feerate which
266          * would appear on a force-closure transaction, whichever is lower. We will allow our
267          * counterparty to pay as much fee as they'd like, however.
268          * 
269          * May generate a [`SendShutdown`] message event on success, which should be relayed.
270          * 
271          * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
272          * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
273          * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
274          * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
275          */
276         public Result_NoneAPIErrorZ close_channel(byte[] channel_id, byte[] counterparty_node_id) {
277                 long ret = bindings.ChannelManager_close_channel(this.ptr, InternalUtils.check_arr_len(channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33));
278                 Reference.reachabilityFence(this);
279                 Reference.reachabilityFence(channel_id);
280                 Reference.reachabilityFence(counterparty_node_id);
281                 if (ret >= 0 && ret <= 4096) { return null; }
282                 Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
283                 return ret_hu_conv;
284         }
285
286         /**
287          * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
288          * will be accepted on the given channel, and after additional timeout/the closing of all
289          * pending HTLCs, the channel will be closed on chain.
290          * 
291          * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
292          * the channel being closed or not:
293          * If we are the channel initiator, we will pay at least this feerate on the closing
294          * transaction. The upper-bound is set by
295          * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
296          * estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
297          * If our counterparty is the channel initiator, we will refuse to accept a channel closure
298          * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
299          * will appear on a force-closure transaction, whichever is lower).
300          * 
301          * May generate a [`SendShutdown`] message event on success, which should be relayed.
302          * 
303          * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
304          * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
305          * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
306          * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
307          */
308         public Result_NoneAPIErrorZ close_channel_with_target_feerate(byte[] channel_id, byte[] counterparty_node_id, int target_feerate_sats_per_1000_weight) {
309                 long ret = bindings.ChannelManager_close_channel_with_target_feerate(this.ptr, InternalUtils.check_arr_len(channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), target_feerate_sats_per_1000_weight);
310                 Reference.reachabilityFence(this);
311                 Reference.reachabilityFence(channel_id);
312                 Reference.reachabilityFence(counterparty_node_id);
313                 Reference.reachabilityFence(target_feerate_sats_per_1000_weight);
314                 if (ret >= 0 && ret <= 4096) { return null; }
315                 Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
316                 return ret_hu_conv;
317         }
318
319         /**
320          * Force closes a channel, immediately broadcasting the latest local transaction(s) and
321          * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
322          * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
323          * channel.
324          */
325         public Result_NoneAPIErrorZ force_close_broadcasting_latest_txn(byte[] channel_id, byte[] counterparty_node_id) {
326                 long ret = bindings.ChannelManager_force_close_broadcasting_latest_txn(this.ptr, InternalUtils.check_arr_len(channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33));
327                 Reference.reachabilityFence(this);
328                 Reference.reachabilityFence(channel_id);
329                 Reference.reachabilityFence(counterparty_node_id);
330                 if (ret >= 0 && ret <= 4096) { return null; }
331                 Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
332                 return ret_hu_conv;
333         }
334
335         /**
336          * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting
337          * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the
338          * `counterparty_node_id` isn't the counterparty of the corresponding channel.
339          * 
340          * You can always get the latest local transaction(s) to broadcast from
341          * [`ChannelMonitor::get_latest_holder_commitment_txn`].
342          */
343         public Result_NoneAPIErrorZ force_close_without_broadcasting_txn(byte[] channel_id, byte[] counterparty_node_id) {
344                 long ret = bindings.ChannelManager_force_close_without_broadcasting_txn(this.ptr, InternalUtils.check_arr_len(channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33));
345                 Reference.reachabilityFence(this);
346                 Reference.reachabilityFence(channel_id);
347                 Reference.reachabilityFence(counterparty_node_id);
348                 if (ret >= 0 && ret <= 4096) { return null; }
349                 Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
350                 return ret_hu_conv;
351         }
352
353         /**
354          * Force close all channels, immediately broadcasting the latest local commitment transaction
355          * for each to the chain and rejecting new HTLCs on each.
356          */
357         public void force_close_all_channels_broadcasting_latest_txn() {
358                 bindings.ChannelManager_force_close_all_channels_broadcasting_latest_txn(this.ptr);
359                 Reference.reachabilityFence(this);
360         }
361
362         /**
363          * Force close all channels rejecting new HTLCs on each but without broadcasting the latest
364          * local transaction(s).
365          */
366         public void force_close_all_channels_without_broadcasting_txn() {
367                 bindings.ChannelManager_force_close_all_channels_without_broadcasting_txn(this.ptr);
368                 Reference.reachabilityFence(this);
369         }
370
371         /**
372          * Sends a payment along a given route.
373          * 
374          * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`]
375          * fields for more info.
376          * 
377          * May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via
378          * [`PeerManager::process_events`]).
379          * 
380          * # Avoiding Duplicate Payments
381          * 
382          * If a pending payment is currently in-flight with the same [`PaymentId`] provided, this
383          * method will error with an [`APIError::InvalidRoute`]. Note, however, that once a payment
384          * is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an
385          * [`Event::PaymentSent`] or [`Event::PaymentFailed`]) LDK will not stop you from sending a
386          * second payment with the same [`PaymentId`].
387          * 
388          * Thus, in order to ensure duplicate payments are not sent, you should implement your own
389          * tracking of payments, including state to indicate once a payment has completed. Because you
390          * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should
391          * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the
392          * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes.
393          * 
394          * Additionally, in the scenario where we begin the process of sending a payment, but crash
395          * before `send_payment` returns (or prior to [`ChannelMonitorUpdate`] persistence if you're
396          * using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See
397          * [`ChannelManager::list_recent_payments`] for more information.
398          * 
399          * # Possible Error States on [`PaymentSendFailure`]
400          * 
401          * Each path may have a different return value, and [`PaymentSendFailure`] may return a `Vec` with
402          * each entry matching the corresponding-index entry in the route paths, see
403          * [`PaymentSendFailure`] for more info.
404          * 
405          * In general, a path may raise:
406          * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee,
407          * node public key) is specified.
408          * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates
409          * (including due to previous monitor update failure or new permanent monitor update
410          * failure).
411          * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the
412          * relevant updates.
413          * 
414          * Note that depending on the type of the [`PaymentSendFailure`] the HTLC may have been
415          * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
416          * different route unless you intend to pay twice!
417          * 
418          * [`Event::PaymentSent`]: events::Event::PaymentSent
419          * [`Event::PaymentFailed`]: events::Event::PaymentFailed
420          * [`UpdateHTLCs`]: events::MessageSendEvent::UpdateHTLCs
421          * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
422          * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
423          */
424         public Result_NonePaymentSendFailureZ send_payment_with_route(org.ldk.structs.Route route, byte[] payment_hash, org.ldk.structs.RecipientOnionFields recipient_onion, byte[] payment_id) {
425                 long ret = bindings.ChannelManager_send_payment_with_route(this.ptr, route == null ? 0 : route.ptr, InternalUtils.check_arr_len(payment_hash, 32), recipient_onion == null ? 0 : recipient_onion.ptr, InternalUtils.check_arr_len(payment_id, 32));
426                 Reference.reachabilityFence(this);
427                 Reference.reachabilityFence(route);
428                 Reference.reachabilityFence(payment_hash);
429                 Reference.reachabilityFence(recipient_onion);
430                 Reference.reachabilityFence(payment_id);
431                 if (ret >= 0 && ret <= 4096) { return null; }
432                 Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ.constr_from_ptr(ret);
433                 if (this != null) { this.ptrs_to.add(route); };
434                 if (this != null) { this.ptrs_to.add(recipient_onion); };
435                 return ret_hu_conv;
436         }
437
438         /**
439          * Similar to [`ChannelManager::send_payment`], but will automatically find a route based on
440          * `route_params` and retry failed payment paths based on `retry_strategy`.
441          */
442         public Result_NoneRetryableSendFailureZ send_payment(byte[] payment_hash, org.ldk.structs.RecipientOnionFields recipient_onion, byte[] payment_id, org.ldk.structs.RouteParameters route_params, org.ldk.structs.Retry retry_strategy) {
443                 long ret = bindings.ChannelManager_send_payment(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), recipient_onion == null ? 0 : recipient_onion.ptr, InternalUtils.check_arr_len(payment_id, 32), route_params == null ? 0 : route_params.ptr, retry_strategy.ptr);
444                 Reference.reachabilityFence(this);
445                 Reference.reachabilityFence(payment_hash);
446                 Reference.reachabilityFence(recipient_onion);
447                 Reference.reachabilityFence(payment_id);
448                 Reference.reachabilityFence(route_params);
449                 Reference.reachabilityFence(retry_strategy);
450                 if (ret >= 0 && ret <= 4096) { return null; }
451                 Result_NoneRetryableSendFailureZ ret_hu_conv = Result_NoneRetryableSendFailureZ.constr_from_ptr(ret);
452                 if (this != null) { this.ptrs_to.add(recipient_onion); };
453                 if (this != null) { this.ptrs_to.add(route_params); };
454                 if (this != null) { this.ptrs_to.add(retry_strategy); };
455                 return ret_hu_conv;
456         }
457
458         /**
459          * Signals that no further retries for the given payment should occur. Useful if you have a
460          * pending outbound payment with retries remaining, but wish to stop retrying the payment before
461          * retries are exhausted.
462          * 
463          * If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon
464          * as there are no remaining pending HTLCs for this payment.
465          * 
466          * Note that calling this method does *not* prevent a payment from succeeding. You must still
467          * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
468          * determine the ultimate status of a payment.
469          * 
470          * If an [`Event::PaymentFailed`] event is generated and we restart without this
471          * [`ChannelManager`] having been persisted, another [`Event::PaymentFailed`] may be generated.
472          * 
473          * [`Event::PaymentFailed`]: events::Event::PaymentFailed
474          * [`Event::PaymentSent`]: events::Event::PaymentSent
475          */
476         public void abandon_payment(byte[] payment_id) {
477                 bindings.ChannelManager_abandon_payment(this.ptr, InternalUtils.check_arr_len(payment_id, 32));
478                 Reference.reachabilityFence(this);
479                 Reference.reachabilityFence(payment_id);
480         }
481
482         /**
483          * Send a spontaneous payment, which is a payment that does not require the recipient to have
484          * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
485          * the preimage, it must be a cryptographically secure random value that no intermediate node
486          * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
487          * never reach the recipient.
488          * 
489          * See [`send_payment`] documentation for more details on the return value of this function
490          * and idempotency guarantees provided by the [`PaymentId`] key.
491          * 
492          * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
493          * [`send_payment`] for more information about the risks of duplicate preimage usage.
494          * 
495          * Note that `route` must have exactly one path.
496          * 
497          * [`send_payment`]: Self::send_payment
498          * 
499          * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
500          */
501         public Result_PaymentHashPaymentSendFailureZ send_spontaneous_payment(org.ldk.structs.Route route, @Nullable byte[] payment_preimage, org.ldk.structs.RecipientOnionFields recipient_onion, byte[] payment_id) {
502                 long ret = bindings.ChannelManager_send_spontaneous_payment(this.ptr, route == null ? 0 : route.ptr, InternalUtils.check_arr_len(payment_preimage, 32), recipient_onion == null ? 0 : recipient_onion.ptr, InternalUtils.check_arr_len(payment_id, 32));
503                 Reference.reachabilityFence(this);
504                 Reference.reachabilityFence(route);
505                 Reference.reachabilityFence(payment_preimage);
506                 Reference.reachabilityFence(recipient_onion);
507                 Reference.reachabilityFence(payment_id);
508                 if (ret >= 0 && ret <= 4096) { return null; }
509                 Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret);
510                 if (this != null) { this.ptrs_to.add(route); };
511                 if (this != null) { this.ptrs_to.add(recipient_onion); };
512                 return ret_hu_conv;
513         }
514
515         /**
516          * Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route
517          * based on `route_params` and retry failed payment paths based on `retry_strategy`.
518          * 
519          * See [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous
520          * payments.
521          * 
522          * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend
523          * 
524          * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
525          */
526         public Result_PaymentHashRetryableSendFailureZ send_spontaneous_payment_with_retry(@Nullable byte[] payment_preimage, org.ldk.structs.RecipientOnionFields recipient_onion, byte[] payment_id, org.ldk.structs.RouteParameters route_params, org.ldk.structs.Retry retry_strategy) {
527                 long ret = bindings.ChannelManager_send_spontaneous_payment_with_retry(this.ptr, InternalUtils.check_arr_len(payment_preimage, 32), recipient_onion == null ? 0 : recipient_onion.ptr, InternalUtils.check_arr_len(payment_id, 32), route_params == null ? 0 : route_params.ptr, retry_strategy.ptr);
528                 Reference.reachabilityFence(this);
529                 Reference.reachabilityFence(payment_preimage);
530                 Reference.reachabilityFence(recipient_onion);
531                 Reference.reachabilityFence(payment_id);
532                 Reference.reachabilityFence(route_params);
533                 Reference.reachabilityFence(retry_strategy);
534                 if (ret >= 0 && ret <= 4096) { return null; }
535                 Result_PaymentHashRetryableSendFailureZ ret_hu_conv = Result_PaymentHashRetryableSendFailureZ.constr_from_ptr(ret);
536                 if (this != null) { this.ptrs_to.add(recipient_onion); };
537                 if (this != null) { this.ptrs_to.add(route_params); };
538                 if (this != null) { this.ptrs_to.add(retry_strategy); };
539                 return ret_hu_conv;
540         }
541
542         /**
543          * Send a payment that is probing the given route for liquidity. We calculate the
544          * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows
545          * us to easily discern them from real payments.
546          */
547         public Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ send_probe(org.ldk.structs.Path path) {
548                 long ret = bindings.ChannelManager_send_probe(this.ptr, path == null ? 0 : path.ptr);
549                 Reference.reachabilityFence(this);
550                 Reference.reachabilityFence(path);
551                 if (ret >= 0 && ret <= 4096) { return null; }
552                 Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret);
553                 if (this != null) { this.ptrs_to.add(path); };
554                 return ret_hu_conv;
555         }
556
557         /**
558          * Call this upon creation of a funding transaction for the given channel.
559          * 
560          * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
561          * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
562          * 
563          * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation
564          * across the p2p network.
565          * 
566          * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
567          * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
568          * 
569          * May panic if the output found in the funding transaction is duplicative with some other
570          * channel (note that this should be trivially prevented by using unique funding transaction
571          * keys per-channel).
572          * 
573          * Do NOT broadcast the funding transaction yourself. When we have safely received our
574          * counterparty's signature the funding transaction will automatically be broadcast via the
575          * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
576          * 
577          * Note that this includes RBF or similar transaction replacement strategies - lightning does
578          * not currently support replacing a funding transaction on an existing channel. Instead,
579          * create a new channel with a conflicting funding transaction.
580          * 
581          * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend
582          * the wallet software generating the funding transaction to apply anti-fee sniping as
583          * implemented by Bitcoin Core wallet. See <https://bitcoinops.org/en/topics/fee-sniping/>
584          * for more details.
585          * 
586          * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady
587          * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed
588          */
589         public Result_NoneAPIErrorZ funding_transaction_generated(byte[] temporary_channel_id, byte[] counterparty_node_id, byte[] funding_transaction) {
590                 long ret = bindings.ChannelManager_funding_transaction_generated(this.ptr, InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), funding_transaction);
591                 Reference.reachabilityFence(this);
592                 Reference.reachabilityFence(temporary_channel_id);
593                 Reference.reachabilityFence(counterparty_node_id);
594                 Reference.reachabilityFence(funding_transaction);
595                 if (ret >= 0 && ret <= 4096) { return null; }
596                 Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
597                 return ret_hu_conv;
598         }
599
600         /**
601          * Atomically updates the [`ChannelConfig`] for the given channels.
602          * 
603          * Once the updates are applied, each eligible channel (advertised with a known short channel
604          * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
605          * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
606          * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
607          * 
608          * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
609          * `counterparty_node_id` is provided.
610          * 
611          * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
612          * below [`MIN_CLTV_EXPIRY_DELTA`].
613          * 
614          * If an error is returned, none of the updates should be considered applied.
615          * 
616          * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
617          * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
618          * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
619          * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
620          * [`ChannelUpdate`]: msgs::ChannelUpdate
621          * [`ChannelUnavailable`]: APIError::ChannelUnavailable
622          * [`APIMisuseError`]: APIError::APIMisuseError
623          */
624         public Result_NoneAPIErrorZ update_channel_config(byte[] counterparty_node_id, byte[][] channel_ids, org.ldk.structs.ChannelConfig config) {
625                 long ret = bindings.ChannelManager_update_channel_config(this.ptr, InternalUtils.check_arr_len(counterparty_node_id, 33), channel_ids != null ? Arrays.stream(channel_ids).map(channel_ids_conv_8 -> InternalUtils.check_arr_len(channel_ids_conv_8, 32)).toArray(byte[][]::new) : null, config == null ? 0 : config.ptr);
626                 Reference.reachabilityFence(this);
627                 Reference.reachabilityFence(counterparty_node_id);
628                 Reference.reachabilityFence(channel_ids);
629                 Reference.reachabilityFence(config);
630                 if (ret >= 0 && ret <= 4096) { return null; }
631                 Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
632                 if (this != null) { this.ptrs_to.add(config); };
633                 return ret_hu_conv;
634         }
635
636         /**
637          * Attempts to forward an intercepted HTLC over the provided channel id and with the provided
638          * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event.
639          * 
640          * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time
641          * channel to a receiving node if the node lacks sufficient inbound liquidity.
642          * 
643          * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use
644          * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the
645          * receiver's invoice route hints. These route hints will signal to LDK to generate an
646          * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or
647          * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event.
648          * 
649          * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop
650          * you from forwarding more than you received.
651          * 
652          * Errors if the event was not handled in time, in which case the HTLC was automatically failed
653          * backwards.
654          * 
655          * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
656          * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
657          */
658         public Result_NoneAPIErrorZ forward_intercepted_htlc(byte[] intercept_id, byte[] next_hop_channel_id, byte[] next_node_id, long amt_to_forward_msat) {
659                 long ret = bindings.ChannelManager_forward_intercepted_htlc(this.ptr, InternalUtils.check_arr_len(intercept_id, 32), InternalUtils.check_arr_len(next_hop_channel_id, 32), InternalUtils.check_arr_len(next_node_id, 33), amt_to_forward_msat);
660                 Reference.reachabilityFence(this);
661                 Reference.reachabilityFence(intercept_id);
662                 Reference.reachabilityFence(next_hop_channel_id);
663                 Reference.reachabilityFence(next_node_id);
664                 Reference.reachabilityFence(amt_to_forward_msat);
665                 if (ret >= 0 && ret <= 4096) { return null; }
666                 Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
667                 return ret_hu_conv;
668         }
669
670         /**
671          * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to
672          * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`].
673          * 
674          * Errors if the event was not handled in time, in which case the HTLC was automatically failed
675          * backwards.
676          * 
677          * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
678          */
679         public Result_NoneAPIErrorZ fail_intercepted_htlc(byte[] intercept_id) {
680                 long ret = bindings.ChannelManager_fail_intercepted_htlc(this.ptr, InternalUtils.check_arr_len(intercept_id, 32));
681                 Reference.reachabilityFence(this);
682                 Reference.reachabilityFence(intercept_id);
683                 if (ret >= 0 && ret <= 4096) { return null; }
684                 Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
685                 return ret_hu_conv;
686         }
687
688         /**
689          * Processes HTLCs which are pending waiting on random forward delay.
690          * 
691          * Should only really ever be called in response to a PendingHTLCsForwardable event.
692          * Will likely generate further events.
693          */
694         public void process_pending_htlc_forwards() {
695                 bindings.ChannelManager_process_pending_htlc_forwards(this.ptr);
696                 Reference.reachabilityFence(this);
697         }
698
699         /**
700          * Performs actions which should happen on startup and roughly once per minute thereafter.
701          * 
702          * This currently includes:
703          * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
704          * Broadcasting [`ChannelUpdate`] messages if we've been disconnected from our peer for more
705          * than a minute, informing the network that they should no longer attempt to route over
706          * the channel.
707          * Expiring a channel's previous [`ChannelConfig`] if necessary to only allow forwarding HTLCs
708          * with the current [`ChannelConfig`].
709          * Removing peers which have disconnected but and no longer have any channels.
710          * 
711          * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate
712          * estimate fetches.
713          * 
714          * [`ChannelUpdate`]: msgs::ChannelUpdate
715          * [`ChannelConfig`]: crate::util::config::ChannelConfig
716          */
717         public void timer_tick_occurred() {
718                 bindings.ChannelManager_timer_tick_occurred(this.ptr);
719                 Reference.reachabilityFence(this);
720         }
721
722         /**
723          * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
724          * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources
725          * along the path (including in our own channel on which we received it).
726          * 
727          * Note that in some cases around unclean shutdown, it is possible the payment may have
728          * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
729          * second copy of) the [`events::Event::PaymentClaimable`] event. Alternatively, the payment
730          * may have already been failed automatically by LDK if it was nearing its expiration time.
731          * 
732          * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
733          * [`ChannelManager::claim_funds`]), you should still monitor for
734          * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
735          * startup during which time claims that were in-progress at shutdown may be replayed.
736          */
737         public void fail_htlc_backwards(byte[] payment_hash) {
738                 bindings.ChannelManager_fail_htlc_backwards(this.ptr, InternalUtils.check_arr_len(payment_hash, 32));
739                 Reference.reachabilityFence(this);
740                 Reference.reachabilityFence(payment_hash);
741         }
742
743         /**
744          * This is a variant of [`ChannelManager::fail_htlc_backwards`] that allows you to specify the
745          * reason for the failure.
746          * 
747          * See [`FailureCode`] for valid failure codes.
748          */
749         public void fail_htlc_backwards_with_reason(byte[] payment_hash, org.ldk.enums.FailureCode failure_code) {
750                 bindings.ChannelManager_fail_htlc_backwards_with_reason(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), failure_code);
751                 Reference.reachabilityFence(this);
752                 Reference.reachabilityFence(payment_hash);
753                 Reference.reachabilityFence(failure_code);
754         }
755
756         /**
757          * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any
758          * [`MessageSendEvent`]s needed to claim the payment.
759          * 
760          * This method is guaranteed to ensure the payment has been claimed but only if the current
761          * height is strictly below [`Event::PaymentClaimable::claim_deadline`]. To avoid race
762          * conditions, you should wait for an [`Event::PaymentClaimed`] before considering the payment
763          * successful. It will generally be available in the next [`process_pending_events`] call.
764          * 
765          * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
766          * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable`
767          * event matches your expectation. If you fail to do so and call this method, you may provide
768          * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
769          * 
770          * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
771          * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline
772          * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed
773          * [`process_pending_events`]: EventsProvider::process_pending_events
774          * [`create_inbound_payment`]: Self::create_inbound_payment
775          * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
776          */
777         public void claim_funds(byte[] payment_preimage) {
778                 bindings.ChannelManager_claim_funds(this.ptr, InternalUtils.check_arr_len(payment_preimage, 32));
779                 Reference.reachabilityFence(this);
780                 Reference.reachabilityFence(payment_preimage);
781         }
782
783         /**
784          * Gets the node_id held by this ChannelManager
785          */
786         public byte[] get_our_node_id() {
787                 byte[] ret = bindings.ChannelManager_get_our_node_id(this.ptr);
788                 Reference.reachabilityFence(this);
789                 return ret;
790         }
791
792         /**
793          * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
794          * 
795          * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
796          * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
797          * the channel.
798          * 
799          * The `user_channel_id` parameter will be provided back in
800          * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
801          * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
802          * 
803          * Note that this method will return an error and reject the channel, if it requires support
804          * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
805          * used to accept such channels.
806          * 
807          * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
808          * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
809          */
810         public Result_NoneAPIErrorZ accept_inbound_channel(byte[] temporary_channel_id, byte[] counterparty_node_id, org.ldk.util.UInt128 user_channel_id) {
811                 long ret = bindings.ChannelManager_accept_inbound_channel(this.ptr, InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), user_channel_id.getLEBytes());
812                 Reference.reachabilityFence(this);
813                 Reference.reachabilityFence(temporary_channel_id);
814                 Reference.reachabilityFence(counterparty_node_id);
815                 Reference.reachabilityFence(user_channel_id);
816                 if (ret >= 0 && ret <= 4096) { return null; }
817                 Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
818                 return ret_hu_conv;
819         }
820
821         /**
822          * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
823          * it as confirmed immediately.
824          * 
825          * The `user_channel_id` parameter will be provided back in
826          * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
827          * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
828          * 
829          * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
830          * and (if the counterparty agrees), enables forwarding of payments immediately.
831          * 
832          * This fully trusts that the counterparty has honestly and correctly constructed the funding
833          * transaction and blindly assumes that it will eventually confirm.
834          * 
835          * If it does not confirm before we decide to close the channel, or if the funding transaction
836          * does not pay to the correct script the correct amount, *you will lose funds*.
837          * 
838          * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
839          * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
840          */
841         public Result_NoneAPIErrorZ accept_inbound_channel_from_trusted_peer_0conf(byte[] temporary_channel_id, byte[] counterparty_node_id, org.ldk.util.UInt128 user_channel_id) {
842                 long ret = bindings.ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(this.ptr, InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), user_channel_id.getLEBytes());
843                 Reference.reachabilityFence(this);
844                 Reference.reachabilityFence(temporary_channel_id);
845                 Reference.reachabilityFence(counterparty_node_id);
846                 Reference.reachabilityFence(user_channel_id);
847                 if (ret >= 0 && ret <= 4096) { return null; }
848                 Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
849                 return ret_hu_conv;
850         }
851
852         /**
853          * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
854          * to pay us.
855          * 
856          * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
857          * [`PaymentHash`] and [`PaymentPreimage`] for you.
858          * 
859          * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`], which
860          * will have the [`PaymentClaimable::purpose`] be [`PaymentPurpose::InvoicePayment`] with
861          * its [`PaymentPurpose::InvoicePayment::payment_preimage`] field filled in. That should then be
862          * passed directly to [`claim_funds`].
863          * 
864          * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
865          * 
866          * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
867          * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
868          * 
869          * # Note
870          * 
871          * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
872          * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
873          * 
874          * Errors if `min_value_msat` is greater than total bitcoin supply.
875          * 
876          * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
877          * on versions of LDK prior to 0.0.114.
878          * 
879          * [`claim_funds`]: Self::claim_funds
880          * [`PaymentClaimable`]: events::Event::PaymentClaimable
881          * [`PaymentClaimable::purpose`]: events::Event::PaymentClaimable::purpose
882          * [`PaymentPurpose::InvoicePayment`]: events::PaymentPurpose::InvoicePayment
883          * [`PaymentPurpose::InvoicePayment::payment_preimage`]: events::PaymentPurpose::InvoicePayment::payment_preimage
884          * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
885          */
886         public Result_C2Tuple_PaymentHashPaymentSecretZNoneZ create_inbound_payment(org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
887                 long ret = bindings.ChannelManager_create_inbound_payment(this.ptr, min_value_msat.ptr, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr);
888                 Reference.reachabilityFence(this);
889                 Reference.reachabilityFence(min_value_msat);
890                 Reference.reachabilityFence(invoice_expiry_delta_secs);
891                 Reference.reachabilityFence(min_final_cltv_expiry_delta);
892                 if (ret >= 0 && ret <= 4096) { return null; }
893                 Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret);
894                 if (this != null) { this.ptrs_to.add(min_value_msat); };
895                 if (this != null) { this.ptrs_to.add(min_final_cltv_expiry_delta); };
896                 return ret_hu_conv;
897         }
898
899         /**
900          * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
901          * serialized state with LDK node(s) running 0.0.103 and earlier.
902          * 
903          * May panic if `invoice_expiry_delta_secs` is greater than one year.
904          * 
905          * # Note
906          * This method is deprecated and will be removed soon.
907          * 
908          * [`create_inbound_payment`]: Self::create_inbound_payment
909          */
910         public Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ create_inbound_payment_legacy(org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs) {
911                 long ret = bindings.ChannelManager_create_inbound_payment_legacy(this.ptr, min_value_msat.ptr, invoice_expiry_delta_secs);
912                 Reference.reachabilityFence(this);
913                 Reference.reachabilityFence(min_value_msat);
914                 Reference.reachabilityFence(invoice_expiry_delta_secs);
915                 if (ret >= 0 && ret <= 4096) { return null; }
916                 Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.constr_from_ptr(ret);
917                 if (this != null) { this.ptrs_to.add(min_value_msat); };
918                 return ret_hu_conv;
919         }
920
921         /**
922          * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
923          * stored external to LDK.
924          * 
925          * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a
926          * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
927          * the `min_value_msat` provided here, if one is provided.
928          * 
929          * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
930          * note that LDK will not stop you from registering duplicate payment hashes for inbound
931          * payments.
932          * 
933          * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
934          * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
935          * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the
936          * sender \"proof-of-payment\" unless they have paid the required amount.
937          * 
938          * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
939          * in excess of the current time. This should roughly match the expiry time set in the invoice.
940          * After this many seconds, we will remove the inbound payment, resulting in any attempts to
941          * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
942          * invoices when no timeout is set.
943          * 
944          * Note that we use block header time to time-out pending inbound payments (with some margin
945          * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
946          * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry.
947          * If you need exact expiry semantics, you should enforce them upon receipt of
948          * [`PaymentClaimable`].
949          * 
950          * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry_delta`
951          * set to at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
952          * 
953          * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
954          * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
955          * 
956          * # Note
957          * 
958          * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
959          * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
960          * 
961          * Errors if `min_value_msat` is greater than total bitcoin supply.
962          * 
963          * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
964          * on versions of LDK prior to 0.0.114.
965          * 
966          * [`create_inbound_payment`]: Self::create_inbound_payment
967          * [`PaymentClaimable`]: events::Event::PaymentClaimable
968          */
969         public Result_PaymentSecretNoneZ create_inbound_payment_for_hash(byte[] payment_hash, org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry) {
970                 long ret = bindings.ChannelManager_create_inbound_payment_for_hash(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), min_value_msat.ptr, invoice_expiry_delta_secs, min_final_cltv_expiry.ptr);
971                 Reference.reachabilityFence(this);
972                 Reference.reachabilityFence(payment_hash);
973                 Reference.reachabilityFence(min_value_msat);
974                 Reference.reachabilityFence(invoice_expiry_delta_secs);
975                 Reference.reachabilityFence(min_final_cltv_expiry);
976                 if (ret >= 0 && ret <= 4096) { return null; }
977                 Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret);
978                 if (this != null) { this.ptrs_to.add(min_value_msat); };
979                 if (this != null) { this.ptrs_to.add(min_final_cltv_expiry); };
980                 return ret_hu_conv;
981         }
982
983         /**
984          * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
985          * serialized state with LDK node(s) running 0.0.103 and earlier.
986          * 
987          * May panic if `invoice_expiry_delta_secs` is greater than one year.
988          * 
989          * # Note
990          * This method is deprecated and will be removed soon.
991          * 
992          * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
993          */
994         public Result_PaymentSecretAPIErrorZ create_inbound_payment_for_hash_legacy(byte[] payment_hash, org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs) {
995                 long ret = bindings.ChannelManager_create_inbound_payment_for_hash_legacy(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), min_value_msat.ptr, invoice_expiry_delta_secs);
996                 Reference.reachabilityFence(this);
997                 Reference.reachabilityFence(payment_hash);
998                 Reference.reachabilityFence(min_value_msat);
999                 Reference.reachabilityFence(invoice_expiry_delta_secs);
1000                 if (ret >= 0 && ret <= 4096) { return null; }
1001                 Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret);
1002                 if (this != null) { this.ptrs_to.add(min_value_msat); };
1003                 return ret_hu_conv;
1004         }
1005
1006         /**
1007          * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
1008          * previously returned from [`create_inbound_payment`].
1009          * 
1010          * [`create_inbound_payment`]: Self::create_inbound_payment
1011          */
1012         public Result_PaymentPreimageAPIErrorZ get_payment_preimage(byte[] payment_hash, byte[] payment_secret) {
1013                 long ret = bindings.ChannelManager_get_payment_preimage(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), InternalUtils.check_arr_len(payment_secret, 32));
1014                 Reference.reachabilityFence(this);
1015                 Reference.reachabilityFence(payment_hash);
1016                 Reference.reachabilityFence(payment_secret);
1017                 if (ret >= 0 && ret <= 4096) { return null; }
1018                 Result_PaymentPreimageAPIErrorZ ret_hu_conv = Result_PaymentPreimageAPIErrorZ.constr_from_ptr(ret);
1019                 return ret_hu_conv;
1020         }
1021
1022         /**
1023          * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
1024          * are used when constructing the phantom invoice's route hints.
1025          * 
1026          * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
1027          */
1028         public long get_phantom_scid() {
1029                 long ret = bindings.ChannelManager_get_phantom_scid(this.ptr);
1030                 Reference.reachabilityFence(this);
1031                 return ret;
1032         }
1033
1034         /**
1035          * Gets route hints for use in receiving [phantom node payments].
1036          * 
1037          * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
1038          */
1039         public PhantomRouteHints get_phantom_route_hints() {
1040                 long ret = bindings.ChannelManager_get_phantom_route_hints(this.ptr);
1041                 Reference.reachabilityFence(this);
1042                 if (ret >= 0 && ret <= 4096) { return null; }
1043                 org.ldk.structs.PhantomRouteHints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PhantomRouteHints(null, ret); }
1044                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1045                 return ret_hu_conv;
1046         }
1047
1048         /**
1049          * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are
1050          * used when constructing the route hints for HTLCs intended to be intercepted. See
1051          * [`ChannelManager::forward_intercepted_htlc`].
1052          * 
1053          * Note that this method is not guaranteed to return unique values, you may need to call it a few
1054          * times to get a unique scid.
1055          */
1056         public long get_intercept_scid() {
1057                 long ret = bindings.ChannelManager_get_intercept_scid(this.ptr);
1058                 Reference.reachabilityFence(this);
1059                 return ret;
1060         }
1061
1062         /**
1063          * Gets inflight HTLC information by processing pending outbound payments that are in
1064          * our channels. May be used during pathfinding to account for in-use channel liquidity.
1065          */
1066         public InFlightHtlcs compute_inflight_htlcs() {
1067                 long ret = bindings.ChannelManager_compute_inflight_htlcs(this.ptr);
1068                 Reference.reachabilityFence(this);
1069                 if (ret >= 0 && ret <= 4096) { return null; }
1070                 org.ldk.structs.InFlightHtlcs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InFlightHtlcs(null, ret); }
1071                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1072                 return ret_hu_conv;
1073         }
1074
1075         /**
1076          * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
1077          * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
1078          */
1079         public MessageSendEventsProvider as_MessageSendEventsProvider() {
1080                 long ret = bindings.ChannelManager_as_MessageSendEventsProvider(this.ptr);
1081                 Reference.reachabilityFence(this);
1082                 if (ret >= 0 && ret <= 4096) { return null; }
1083                 MessageSendEventsProvider ret_hu_conv = new MessageSendEventsProvider(null, ret);
1084                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1085                 return ret_hu_conv;
1086         }
1087
1088         /**
1089          * Constructs a new EventsProvider which calls the relevant methods on this_arg.
1090          * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
1091          */
1092         public EventsProvider as_EventsProvider() {
1093                 long ret = bindings.ChannelManager_as_EventsProvider(this.ptr);
1094                 Reference.reachabilityFence(this);
1095                 if (ret >= 0 && ret <= 4096) { return null; }
1096                 EventsProvider ret_hu_conv = new EventsProvider(null, ret);
1097                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1098                 return ret_hu_conv;
1099         }
1100
1101         /**
1102          * Constructs a new Listen which calls the relevant methods on this_arg.
1103          * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
1104          */
1105         public Listen as_Listen() {
1106                 long ret = bindings.ChannelManager_as_Listen(this.ptr);
1107                 Reference.reachabilityFence(this);
1108                 if (ret >= 0 && ret <= 4096) { return null; }
1109                 Listen ret_hu_conv = new Listen(null, ret);
1110                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1111                 return ret_hu_conv;
1112         }
1113
1114         /**
1115          * Constructs a new Confirm which calls the relevant methods on this_arg.
1116          * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
1117          */
1118         public Confirm as_Confirm() {
1119                 long ret = bindings.ChannelManager_as_Confirm(this.ptr);
1120                 Reference.reachabilityFence(this);
1121                 if (ret >= 0 && ret <= 4096) { return null; }
1122                 Confirm ret_hu_conv = new Confirm(null, ret);
1123                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1124                 return ret_hu_conv;
1125         }
1126
1127         /**
1128          * Gets a [`Future`] that completes when this [`ChannelManager`] needs to be persisted.
1129          * 
1130          * Note that callbacks registered on the [`Future`] MUST NOT call back into this
1131          * [`ChannelManager`] and should instead register actions to be taken later.
1132          */
1133         public Future get_persistable_update_future() {
1134                 long ret = bindings.ChannelManager_get_persistable_update_future(this.ptr);
1135                 Reference.reachabilityFence(this);
1136                 if (ret >= 0 && ret <= 4096) { return null; }
1137                 org.ldk.structs.Future ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Future(null, ret); }
1138                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1139                 return ret_hu_conv;
1140         }
1141
1142         /**
1143          * Gets the latest best block which was connected either via the [`chain::Listen`] or
1144          * [`chain::Confirm`] interfaces.
1145          */
1146         public BestBlock current_best_block() {
1147                 long ret = bindings.ChannelManager_current_best_block(this.ptr);
1148                 Reference.reachabilityFence(this);
1149                 if (ret >= 0 && ret <= 4096) { return null; }
1150                 org.ldk.structs.BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BestBlock(null, ret); }
1151                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1152                 return ret_hu_conv;
1153         }
1154
1155         /**
1156          * Fetches the set of [`NodeFeatures`] flags which are provided by or required by
1157          * [`ChannelManager`].
1158          */
1159         public NodeFeatures node_features() {
1160                 long ret = bindings.ChannelManager_node_features(this.ptr);
1161                 Reference.reachabilityFence(this);
1162                 if (ret >= 0 && ret <= 4096) { return null; }
1163                 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
1164                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1165                 return ret_hu_conv;
1166         }
1167
1168         /**
1169          * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by
1170          * [`ChannelManager`].
1171          */
1172         public ChannelFeatures channel_features() {
1173                 long ret = bindings.ChannelManager_channel_features(this.ptr);
1174                 Reference.reachabilityFence(this);
1175                 if (ret >= 0 && ret <= 4096) { return null; }
1176                 org.ldk.structs.ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelFeatures(null, ret); }
1177                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1178                 return ret_hu_conv;
1179         }
1180
1181         /**
1182          * Fetches the set of [`ChannelTypeFeatures`] flags which are provided by or required by
1183          * [`ChannelManager`].
1184          */
1185         public ChannelTypeFeatures channel_type_features() {
1186                 long ret = bindings.ChannelManager_channel_type_features(this.ptr);
1187                 Reference.reachabilityFence(this);
1188                 if (ret >= 0 && ret <= 4096) { return null; }
1189                 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
1190                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1191                 return ret_hu_conv;
1192         }
1193
1194         /**
1195          * Fetches the set of [`InitFeatures`] flags which are provided by or required by
1196          * [`ChannelManager`].
1197          */
1198         public InitFeatures init_features() {
1199                 long ret = bindings.ChannelManager_init_features(this.ptr);
1200                 Reference.reachabilityFence(this);
1201                 if (ret >= 0 && ret <= 4096) { return null; }
1202                 org.ldk.structs.InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InitFeatures(null, ret); }
1203                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1204                 return ret_hu_conv;
1205         }
1206
1207         /**
1208          * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
1209          * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
1210          */
1211         public ChannelMessageHandler as_ChannelMessageHandler() {
1212                 long ret = bindings.ChannelManager_as_ChannelMessageHandler(this.ptr);
1213                 Reference.reachabilityFence(this);
1214                 if (ret >= 0 && ret <= 4096) { return null; }
1215                 ChannelMessageHandler ret_hu_conv = new ChannelMessageHandler(null, ret);
1216                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1217                 return ret_hu_conv;
1218         }
1219
1220         /**
1221          * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
1222          */
1223         public byte[] write() {
1224                 byte[] ret = bindings.ChannelManager_write(this.ptr);
1225                 Reference.reachabilityFence(this);
1226                 return ret;
1227         }
1228
1229 }