[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ChannelMessageHandler.cs
1
2 using org.ldk.impl;
3 using org.ldk.enums;
4 using org.ldk.util;
5 using System;
6
7 namespace org { namespace ldk { namespace structs {
8
9
10
11 /** An implementation of ChannelMessageHandler */
12 public interface ChannelMessageHandlerInterface {
13         /**Handle an incoming `open_channel` message from the given peer.
14          */
15         void handle_open_channel(byte[] their_node_id, OpenChannel msg);
16         /**Handle an incoming `open_channel2` message from the given peer.
17          */
18         void handle_open_channel_v2(byte[] their_node_id, OpenChannelV2 msg);
19         /**Handle an incoming `accept_channel` message from the given peer.
20          */
21         void handle_accept_channel(byte[] their_node_id, AcceptChannel msg);
22         /**Handle an incoming `accept_channel2` message from the given peer.
23          */
24         void handle_accept_channel_v2(byte[] their_node_id, AcceptChannelV2 msg);
25         /**Handle an incoming `funding_created` message from the given peer.
26          */
27         void handle_funding_created(byte[] their_node_id, FundingCreated msg);
28         /**Handle an incoming `funding_signed` message from the given peer.
29          */
30         void handle_funding_signed(byte[] their_node_id, FundingSigned msg);
31         /**Handle an incoming `channel_ready` message from the given peer.
32          */
33         void handle_channel_ready(byte[] their_node_id, ChannelReady msg);
34         /**Handle an incoming `shutdown` message from the given peer.
35          */
36         void handle_shutdown(byte[] their_node_id, Shutdown msg);
37         /**Handle an incoming `closing_signed` message from the given peer.
38          */
39         void handle_closing_signed(byte[] their_node_id, ClosingSigned msg);
40         /**Handle an incoming `stfu` message from the given peer.
41          */
42         void handle_stfu(byte[] their_node_id, Stfu msg);
43         /**Handle an incoming `splice` message from the given peer.
44          */
45         void handle_splice(byte[] their_node_id, Splice msg);
46         /**Handle an incoming `splice_ack` message from the given peer.
47          */
48         void handle_splice_ack(byte[] their_node_id, SpliceAck msg);
49         /**Handle an incoming `splice_locked` message from the given peer.
50          */
51         void handle_splice_locked(byte[] their_node_id, SpliceLocked msg);
52         /**Handle an incoming `tx_add_input message` from the given peer.
53          */
54         void handle_tx_add_input(byte[] their_node_id, TxAddInput msg);
55         /**Handle an incoming `tx_add_output` message from the given peer.
56          */
57         void handle_tx_add_output(byte[] their_node_id, TxAddOutput msg);
58         /**Handle an incoming `tx_remove_input` message from the given peer.
59          */
60         void handle_tx_remove_input(byte[] their_node_id, TxRemoveInput msg);
61         /**Handle an incoming `tx_remove_output` message from the given peer.
62          */
63         void handle_tx_remove_output(byte[] their_node_id, TxRemoveOutput msg);
64         /**Handle an incoming `tx_complete message` from the given peer.
65          */
66         void handle_tx_complete(byte[] their_node_id, TxComplete msg);
67         /**Handle an incoming `tx_signatures` message from the given peer.
68          */
69         void handle_tx_signatures(byte[] their_node_id, TxSignatures msg);
70         /**Handle an incoming `tx_init_rbf` message from the given peer.
71          */
72         void handle_tx_init_rbf(byte[] their_node_id, TxInitRbf msg);
73         /**Handle an incoming `tx_ack_rbf` message from the given peer.
74          */
75         void handle_tx_ack_rbf(byte[] their_node_id, TxAckRbf msg);
76         /**Handle an incoming `tx_abort message` from the given peer.
77          */
78         void handle_tx_abort(byte[] their_node_id, TxAbort msg);
79         /**Handle an incoming `update_add_htlc` message from the given peer.
80          */
81         void handle_update_add_htlc(byte[] their_node_id, UpdateAddHTLC msg);
82         /**Handle an incoming `update_fulfill_htlc` message from the given peer.
83          */
84         void handle_update_fulfill_htlc(byte[] their_node_id, UpdateFulfillHTLC msg);
85         /**Handle an incoming `update_fail_htlc` message from the given peer.
86          */
87         void handle_update_fail_htlc(byte[] their_node_id, UpdateFailHTLC msg);
88         /**Handle an incoming `update_fail_malformed_htlc` message from the given peer.
89          */
90         void handle_update_fail_malformed_htlc(byte[] their_node_id, UpdateFailMalformedHTLC msg);
91         /**Handle an incoming `commitment_signed` message from the given peer.
92          */
93         void handle_commitment_signed(byte[] their_node_id, CommitmentSigned msg);
94         /**Handle an incoming `revoke_and_ack` message from the given peer.
95          */
96         void handle_revoke_and_ack(byte[] their_node_id, RevokeAndACK msg);
97         /**Handle an incoming `update_fee` message from the given peer.
98          */
99         void handle_update_fee(byte[] their_node_id, UpdateFee msg);
100         /**Handle an incoming `announcement_signatures` message from the given peer.
101          */
102         void handle_announcement_signatures(byte[] their_node_id, AnnouncementSignatures msg);
103         /**Indicates a connection to the peer failed/an existing connection was lost.
104          */
105         void peer_disconnected(byte[] their_node_id);
106         /**Handle a peer reconnecting, possibly generating `channel_reestablish` message(s).
107          * 
108          * May return an `Err(())` if the features the peer supports are not sufficient to communicate
109          * with us. Implementors should be somewhat conservative about doing so, however, as other
110          * message handlers may still wish to communicate with this peer.
111          */
112         Result_NoneNoneZ peer_connected(byte[] their_node_id, Init msg, bool inbound);
113         /**Handle an incoming `channel_reestablish` message from the given peer.
114          */
115         void handle_channel_reestablish(byte[] their_node_id, ChannelReestablish msg);
116         /**Handle an incoming `channel_update` message from the given peer.
117          */
118         void handle_channel_update(byte[] their_node_id, ChannelUpdate msg);
119         /**Handle an incoming `error` message from the given peer.
120          */
121         void handle_error(byte[] their_node_id, ErrorMessage msg);
122         /**Gets the node feature flags which this handler itself supports. All available handlers are
123          * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
124          * which are broadcasted in our [`NodeAnnouncement`] message.
125          */
126         NodeFeatures provided_node_features();
127         /**Gets the init feature flags which should be sent to the given peer. All available handlers
128          * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
129          * which are sent in our [`Init`] message.
130          * 
131          * Note that this method is called before [`Self::peer_connected`].
132          */
133         InitFeatures provided_init_features(byte[] their_node_id);
134         /**Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports.
135          * 
136          * If it's `None`, then no particular network chain hash compatibility will be enforced when
137          * connecting to peers.
138          */
139         Option_CVec_ThirtyTwoBytesZZ get_chain_hashes();
140 }
141
142 /**
143  * A trait to describe an object which can receive channel messages.
144  * 
145  * Messages MAY be called in parallel when they originate from different `their_node_ids`, however
146  * they MUST NOT be called in parallel when the two calls have the same `their_node_id`.
147  */
148 public class ChannelMessageHandler : CommonBase {
149         internal bindings.LDKChannelMessageHandler bindings_instance;
150         internal long instance_idx;
151
152         internal ChannelMessageHandler(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
153         ~ChannelMessageHandler() {
154                 if (ptr != 0) { bindings.ChannelMessageHandler_free(ptr); }
155         }
156
157         private class LDKChannelMessageHandlerHolder { internal ChannelMessageHandler held; }
158         private class LDKChannelMessageHandlerImpl : bindings.LDKChannelMessageHandler {
159                 internal LDKChannelMessageHandlerImpl(ChannelMessageHandlerInterface arg, LDKChannelMessageHandlerHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
160                 private ChannelMessageHandlerInterface arg;
161                 private LDKChannelMessageHandlerHolder impl_holder;
162                 public void handle_open_channel(long _their_node_id, long _msg) {
163                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
164                         org.ldk.structs.OpenChannel _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.OpenChannel(null, _msg); }
165                         arg.handle_open_channel(_their_node_id_conv, _msg_hu_conv);
166                                 GC.KeepAlive(arg);
167                 }
168                 public void handle_open_channel_v2(long _their_node_id, long _msg) {
169                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
170                         org.ldk.structs.OpenChannelV2 _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.OpenChannelV2(null, _msg); }
171                         arg.handle_open_channel_v2(_their_node_id_conv, _msg_hu_conv);
172                                 GC.KeepAlive(arg);
173                 }
174                 public void handle_accept_channel(long _their_node_id, long _msg) {
175                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
176                         org.ldk.structs.AcceptChannel _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.AcceptChannel(null, _msg); }
177                         arg.handle_accept_channel(_their_node_id_conv, _msg_hu_conv);
178                                 GC.KeepAlive(arg);
179                 }
180                 public void handle_accept_channel_v2(long _their_node_id, long _msg) {
181                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
182                         org.ldk.structs.AcceptChannelV2 _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.AcceptChannelV2(null, _msg); }
183                         arg.handle_accept_channel_v2(_their_node_id_conv, _msg_hu_conv);
184                                 GC.KeepAlive(arg);
185                 }
186                 public void handle_funding_created(long _their_node_id, long _msg) {
187                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
188                         org.ldk.structs.FundingCreated _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.FundingCreated(null, _msg); }
189                         arg.handle_funding_created(_their_node_id_conv, _msg_hu_conv);
190                                 GC.KeepAlive(arg);
191                 }
192                 public void handle_funding_signed(long _their_node_id, long _msg) {
193                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
194                         org.ldk.structs.FundingSigned _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.FundingSigned(null, _msg); }
195                         arg.handle_funding_signed(_their_node_id_conv, _msg_hu_conv);
196                                 GC.KeepAlive(arg);
197                 }
198                 public void handle_channel_ready(long _their_node_id, long _msg) {
199                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
200                         org.ldk.structs.ChannelReady _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.ChannelReady(null, _msg); }
201                         arg.handle_channel_ready(_their_node_id_conv, _msg_hu_conv);
202                                 GC.KeepAlive(arg);
203                 }
204                 public void handle_shutdown(long _their_node_id, long _msg) {
205                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
206                         org.ldk.structs.Shutdown _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.Shutdown(null, _msg); }
207                         arg.handle_shutdown(_their_node_id_conv, _msg_hu_conv);
208                                 GC.KeepAlive(arg);
209                 }
210                 public void handle_closing_signed(long _their_node_id, long _msg) {
211                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
212                         org.ldk.structs.ClosingSigned _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.ClosingSigned(null, _msg); }
213                         arg.handle_closing_signed(_their_node_id_conv, _msg_hu_conv);
214                                 GC.KeepAlive(arg);
215                 }
216                 public void handle_stfu(long _their_node_id, long _msg) {
217                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
218                         org.ldk.structs.Stfu _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.Stfu(null, _msg); }
219                         arg.handle_stfu(_their_node_id_conv, _msg_hu_conv);
220                                 GC.KeepAlive(arg);
221                 }
222                 public void handle_splice(long _their_node_id, long _msg) {
223                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
224                         org.ldk.structs.Splice _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.Splice(null, _msg); }
225                         arg.handle_splice(_their_node_id_conv, _msg_hu_conv);
226                                 GC.KeepAlive(arg);
227                 }
228                 public void handle_splice_ack(long _their_node_id, long _msg) {
229                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
230                         org.ldk.structs.SpliceAck _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.SpliceAck(null, _msg); }
231                         arg.handle_splice_ack(_their_node_id_conv, _msg_hu_conv);
232                                 GC.KeepAlive(arg);
233                 }
234                 public void handle_splice_locked(long _their_node_id, long _msg) {
235                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
236                         org.ldk.structs.SpliceLocked _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.SpliceLocked(null, _msg); }
237                         arg.handle_splice_locked(_their_node_id_conv, _msg_hu_conv);
238                                 GC.KeepAlive(arg);
239                 }
240                 public void handle_tx_add_input(long _their_node_id, long _msg) {
241                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
242                         org.ldk.structs.TxAddInput _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.TxAddInput(null, _msg); }
243                         arg.handle_tx_add_input(_their_node_id_conv, _msg_hu_conv);
244                                 GC.KeepAlive(arg);
245                 }
246                 public void handle_tx_add_output(long _their_node_id, long _msg) {
247                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
248                         org.ldk.structs.TxAddOutput _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.TxAddOutput(null, _msg); }
249                         arg.handle_tx_add_output(_their_node_id_conv, _msg_hu_conv);
250                                 GC.KeepAlive(arg);
251                 }
252                 public void handle_tx_remove_input(long _their_node_id, long _msg) {
253                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
254                         org.ldk.structs.TxRemoveInput _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.TxRemoveInput(null, _msg); }
255                         arg.handle_tx_remove_input(_their_node_id_conv, _msg_hu_conv);
256                                 GC.KeepAlive(arg);
257                 }
258                 public void handle_tx_remove_output(long _their_node_id, long _msg) {
259                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
260                         org.ldk.structs.TxRemoveOutput _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.TxRemoveOutput(null, _msg); }
261                         arg.handle_tx_remove_output(_their_node_id_conv, _msg_hu_conv);
262                                 GC.KeepAlive(arg);
263                 }
264                 public void handle_tx_complete(long _their_node_id, long _msg) {
265                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
266                         org.ldk.structs.TxComplete _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.TxComplete(null, _msg); }
267                         arg.handle_tx_complete(_their_node_id_conv, _msg_hu_conv);
268                                 GC.KeepAlive(arg);
269                 }
270                 public void handle_tx_signatures(long _their_node_id, long _msg) {
271                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
272                         org.ldk.structs.TxSignatures _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.TxSignatures(null, _msg); }
273                         arg.handle_tx_signatures(_their_node_id_conv, _msg_hu_conv);
274                                 GC.KeepAlive(arg);
275                 }
276                 public void handle_tx_init_rbf(long _their_node_id, long _msg) {
277                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
278                         org.ldk.structs.TxInitRbf _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.TxInitRbf(null, _msg); }
279                         arg.handle_tx_init_rbf(_their_node_id_conv, _msg_hu_conv);
280                                 GC.KeepAlive(arg);
281                 }
282                 public void handle_tx_ack_rbf(long _their_node_id, long _msg) {
283                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
284                         org.ldk.structs.TxAckRbf _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.TxAckRbf(null, _msg); }
285                         arg.handle_tx_ack_rbf(_their_node_id_conv, _msg_hu_conv);
286                                 GC.KeepAlive(arg);
287                 }
288                 public void handle_tx_abort(long _their_node_id, long _msg) {
289                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
290                         org.ldk.structs.TxAbort _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.TxAbort(null, _msg); }
291                         arg.handle_tx_abort(_their_node_id_conv, _msg_hu_conv);
292                                 GC.KeepAlive(arg);
293                 }
294                 public void handle_update_add_htlc(long _their_node_id, long _msg) {
295                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
296                         org.ldk.structs.UpdateAddHTLC _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.UpdateAddHTLC(null, _msg); }
297                         arg.handle_update_add_htlc(_their_node_id_conv, _msg_hu_conv);
298                                 GC.KeepAlive(arg);
299                 }
300                 public void handle_update_fulfill_htlc(long _their_node_id, long _msg) {
301                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
302                         org.ldk.structs.UpdateFulfillHTLC _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.UpdateFulfillHTLC(null, _msg); }
303                         arg.handle_update_fulfill_htlc(_their_node_id_conv, _msg_hu_conv);
304                                 GC.KeepAlive(arg);
305                 }
306                 public void handle_update_fail_htlc(long _their_node_id, long _msg) {
307                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
308                         org.ldk.structs.UpdateFailHTLC _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.UpdateFailHTLC(null, _msg); }
309                         arg.handle_update_fail_htlc(_their_node_id_conv, _msg_hu_conv);
310                                 GC.KeepAlive(arg);
311                 }
312                 public void handle_update_fail_malformed_htlc(long _their_node_id, long _msg) {
313                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
314                         org.ldk.structs.UpdateFailMalformedHTLC _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.UpdateFailMalformedHTLC(null, _msg); }
315                         arg.handle_update_fail_malformed_htlc(_their_node_id_conv, _msg_hu_conv);
316                                 GC.KeepAlive(arg);
317                 }
318                 public void handle_commitment_signed(long _their_node_id, long _msg) {
319                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
320                         org.ldk.structs.CommitmentSigned _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.CommitmentSigned(null, _msg); }
321                         arg.handle_commitment_signed(_their_node_id_conv, _msg_hu_conv);
322                                 GC.KeepAlive(arg);
323                 }
324                 public void handle_revoke_and_ack(long _their_node_id, long _msg) {
325                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
326                         org.ldk.structs.RevokeAndACK _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.RevokeAndACK(null, _msg); }
327                         arg.handle_revoke_and_ack(_their_node_id_conv, _msg_hu_conv);
328                                 GC.KeepAlive(arg);
329                 }
330                 public void handle_update_fee(long _their_node_id, long _msg) {
331                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
332                         org.ldk.structs.UpdateFee _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.UpdateFee(null, _msg); }
333                         arg.handle_update_fee(_their_node_id_conv, _msg_hu_conv);
334                                 GC.KeepAlive(arg);
335                 }
336                 public void handle_announcement_signatures(long _their_node_id, long _msg) {
337                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
338                         org.ldk.structs.AnnouncementSignatures _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.AnnouncementSignatures(null, _msg); }
339                         arg.handle_announcement_signatures(_their_node_id_conv, _msg_hu_conv);
340                                 GC.KeepAlive(arg);
341                 }
342                 public void peer_disconnected(long _their_node_id) {
343                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
344                         arg.peer_disconnected(_their_node_id_conv);
345                                 GC.KeepAlive(arg);
346                 }
347                 public long peer_connected(long _their_node_id, long _msg, bool _inbound) {
348                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
349                         org.ldk.structs.Init _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.Init(null, _msg); }
350                         Result_NoneNoneZ ret = arg.peer_connected(_their_node_id_conv, _msg_hu_conv, _inbound);
351                                 GC.KeepAlive(arg);
352                         long result = ret == null ? 0 : ret.clone_ptr();
353                         return result;
354                 }
355                 public void handle_channel_reestablish(long _their_node_id, long _msg) {
356                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
357                         org.ldk.structs.ChannelReestablish _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.ChannelReestablish(null, _msg); }
358                         arg.handle_channel_reestablish(_their_node_id_conv, _msg_hu_conv);
359                                 GC.KeepAlive(arg);
360                 }
361                 public void handle_channel_update(long _their_node_id, long _msg) {
362                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
363                         org.ldk.structs.ChannelUpdate _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.ChannelUpdate(null, _msg); }
364                         arg.handle_channel_update(_their_node_id_conv, _msg_hu_conv);
365                                 GC.KeepAlive(arg);
366                 }
367                 public void handle_error(long _their_node_id, long _msg) {
368                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
369                         org.ldk.structs.ErrorMessage _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.ErrorMessage(null, _msg); }
370                         arg.handle_error(_their_node_id_conv, _msg_hu_conv);
371                                 GC.KeepAlive(arg);
372                 }
373                 public long provided_node_features() {
374                         NodeFeatures ret = arg.provided_node_features();
375                                 GC.KeepAlive(arg);
376                         long result = ret == null ? 0 : ret.clone_ptr();
377                         return result;
378                 }
379                 public long provided_init_features(long _their_node_id) {
380                         byte[] _their_node_id_conv = InternalUtils.decodeUint8Array(_their_node_id);
381                         InitFeatures ret = arg.provided_init_features(_their_node_id_conv);
382                                 GC.KeepAlive(arg);
383                         long result = ret == null ? 0 : ret.clone_ptr();
384                         return result;
385                 }
386                 public long get_chain_hashes() {
387                         Option_CVec_ThirtyTwoBytesZZ ret = arg.get_chain_hashes();
388                                 GC.KeepAlive(arg);
389                         long result = ret == null ? 0 : ret.clone_ptr();
390                         if (impl_holder.held != null) { impl_holder.held.ptrs_to.AddLast(ret); };
391                         return result;
392                 }
393         }
394
395         /** Creates a new instance of ChannelMessageHandler from a given implementation */
396         public static ChannelMessageHandler new_impl(ChannelMessageHandlerInterface arg, MessageSendEventsProviderInterface messageSendEventsProvider_impl) {
397                 LDKChannelMessageHandlerHolder impl_holder = new LDKChannelMessageHandlerHolder();
398                 LDKChannelMessageHandlerImpl impl = new LDKChannelMessageHandlerImpl(arg, impl_holder);
399                 MessageSendEventsProvider messageSendEventsProvider = MessageSendEventsProvider.new_impl(messageSendEventsProvider_impl);
400                 long[] ptr_idx = bindings.LDKChannelMessageHandler_new(impl, messageSendEventsProvider.instance_idx);
401
402                 impl_holder.held = new ChannelMessageHandler(null, ptr_idx[0]);
403                 impl_holder.held.instance_idx = ptr_idx[1];
404                 impl_holder.held.bindings_instance = impl;
405                 impl_holder.held.ptrs_to.AddLast(messageSendEventsProvider);
406                 return impl_holder.held;
407         }
408
409         /**
410          * Handle an incoming `open_channel` message from the given peer.
411          */
412         public void handle_open_channel(byte[] their_node_id, org.ldk.structs.OpenChannel msg) {
413                 bindings.ChannelMessageHandler_handle_open_channel(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
414                 GC.KeepAlive(this);
415                 GC.KeepAlive(their_node_id);
416                 GC.KeepAlive(msg);
417                 if (this != null) { this.ptrs_to.AddLast(msg); };
418         }
419
420         /**
421          * Handle an incoming `open_channel2` message from the given peer.
422          */
423         public void handle_open_channel_v2(byte[] their_node_id, org.ldk.structs.OpenChannelV2 msg) {
424                 bindings.ChannelMessageHandler_handle_open_channel_v2(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
425                 GC.KeepAlive(this);
426                 GC.KeepAlive(their_node_id);
427                 GC.KeepAlive(msg);
428                 if (this != null) { this.ptrs_to.AddLast(msg); };
429         }
430
431         /**
432          * Handle an incoming `accept_channel` message from the given peer.
433          */
434         public void handle_accept_channel(byte[] their_node_id, org.ldk.structs.AcceptChannel msg) {
435                 bindings.ChannelMessageHandler_handle_accept_channel(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
436                 GC.KeepAlive(this);
437                 GC.KeepAlive(their_node_id);
438                 GC.KeepAlive(msg);
439                 if (this != null) { this.ptrs_to.AddLast(msg); };
440         }
441
442         /**
443          * Handle an incoming `accept_channel2` message from the given peer.
444          */
445         public void handle_accept_channel_v2(byte[] their_node_id, org.ldk.structs.AcceptChannelV2 msg) {
446                 bindings.ChannelMessageHandler_handle_accept_channel_v2(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
447                 GC.KeepAlive(this);
448                 GC.KeepAlive(their_node_id);
449                 GC.KeepAlive(msg);
450                 if (this != null) { this.ptrs_to.AddLast(msg); };
451         }
452
453         /**
454          * Handle an incoming `funding_created` message from the given peer.
455          */
456         public void handle_funding_created(byte[] their_node_id, org.ldk.structs.FundingCreated msg) {
457                 bindings.ChannelMessageHandler_handle_funding_created(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
458                 GC.KeepAlive(this);
459                 GC.KeepAlive(their_node_id);
460                 GC.KeepAlive(msg);
461                 if (this != null) { this.ptrs_to.AddLast(msg); };
462         }
463
464         /**
465          * Handle an incoming `funding_signed` message from the given peer.
466          */
467         public void handle_funding_signed(byte[] their_node_id, org.ldk.structs.FundingSigned msg) {
468                 bindings.ChannelMessageHandler_handle_funding_signed(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
469                 GC.KeepAlive(this);
470                 GC.KeepAlive(their_node_id);
471                 GC.KeepAlive(msg);
472                 if (this != null) { this.ptrs_to.AddLast(msg); };
473         }
474
475         /**
476          * Handle an incoming `channel_ready` message from the given peer.
477          */
478         public void handle_channel_ready(byte[] their_node_id, org.ldk.structs.ChannelReady msg) {
479                 bindings.ChannelMessageHandler_handle_channel_ready(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
480                 GC.KeepAlive(this);
481                 GC.KeepAlive(their_node_id);
482                 GC.KeepAlive(msg);
483                 if (this != null) { this.ptrs_to.AddLast(msg); };
484         }
485
486         /**
487          * Handle an incoming `shutdown` message from the given peer.
488          */
489         public void handle_shutdown(byte[] their_node_id, org.ldk.structs.Shutdown msg) {
490                 bindings.ChannelMessageHandler_handle_shutdown(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
491                 GC.KeepAlive(this);
492                 GC.KeepAlive(their_node_id);
493                 GC.KeepAlive(msg);
494                 if (this != null) { this.ptrs_to.AddLast(msg); };
495         }
496
497         /**
498          * Handle an incoming `closing_signed` message from the given peer.
499          */
500         public void handle_closing_signed(byte[] their_node_id, org.ldk.structs.ClosingSigned msg) {
501                 bindings.ChannelMessageHandler_handle_closing_signed(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
502                 GC.KeepAlive(this);
503                 GC.KeepAlive(their_node_id);
504                 GC.KeepAlive(msg);
505                 if (this != null) { this.ptrs_to.AddLast(msg); };
506         }
507
508         /**
509          * Handle an incoming `stfu` message from the given peer.
510          */
511         public void handle_stfu(byte[] their_node_id, org.ldk.structs.Stfu msg) {
512                 bindings.ChannelMessageHandler_handle_stfu(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
513                 GC.KeepAlive(this);
514                 GC.KeepAlive(their_node_id);
515                 GC.KeepAlive(msg);
516                 if (this != null) { this.ptrs_to.AddLast(msg); };
517         }
518
519         /**
520          * Handle an incoming `splice` message from the given peer.
521          */
522         public void handle_splice(byte[] their_node_id, org.ldk.structs.Splice msg) {
523                 bindings.ChannelMessageHandler_handle_splice(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
524                 GC.KeepAlive(this);
525                 GC.KeepAlive(their_node_id);
526                 GC.KeepAlive(msg);
527                 if (this != null) { this.ptrs_to.AddLast(msg); };
528         }
529
530         /**
531          * Handle an incoming `splice_ack` message from the given peer.
532          */
533         public void handle_splice_ack(byte[] their_node_id, org.ldk.structs.SpliceAck msg) {
534                 bindings.ChannelMessageHandler_handle_splice_ack(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
535                 GC.KeepAlive(this);
536                 GC.KeepAlive(their_node_id);
537                 GC.KeepAlive(msg);
538                 if (this != null) { this.ptrs_to.AddLast(msg); };
539         }
540
541         /**
542          * Handle an incoming `splice_locked` message from the given peer.
543          */
544         public void handle_splice_locked(byte[] their_node_id, org.ldk.structs.SpliceLocked msg) {
545                 bindings.ChannelMessageHandler_handle_splice_locked(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
546                 GC.KeepAlive(this);
547                 GC.KeepAlive(their_node_id);
548                 GC.KeepAlive(msg);
549                 if (this != null) { this.ptrs_to.AddLast(msg); };
550         }
551
552         /**
553          * Handle an incoming `tx_add_input message` from the given peer.
554          */
555         public void handle_tx_add_input(byte[] their_node_id, org.ldk.structs.TxAddInput msg) {
556                 bindings.ChannelMessageHandler_handle_tx_add_input(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
557                 GC.KeepAlive(this);
558                 GC.KeepAlive(their_node_id);
559                 GC.KeepAlive(msg);
560                 if (this != null) { this.ptrs_to.AddLast(msg); };
561         }
562
563         /**
564          * Handle an incoming `tx_add_output` message from the given peer.
565          */
566         public void handle_tx_add_output(byte[] their_node_id, org.ldk.structs.TxAddOutput msg) {
567                 bindings.ChannelMessageHandler_handle_tx_add_output(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
568                 GC.KeepAlive(this);
569                 GC.KeepAlive(their_node_id);
570                 GC.KeepAlive(msg);
571                 if (this != null) { this.ptrs_to.AddLast(msg); };
572         }
573
574         /**
575          * Handle an incoming `tx_remove_input` message from the given peer.
576          */
577         public void handle_tx_remove_input(byte[] their_node_id, org.ldk.structs.TxRemoveInput msg) {
578                 bindings.ChannelMessageHandler_handle_tx_remove_input(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
579                 GC.KeepAlive(this);
580                 GC.KeepAlive(their_node_id);
581                 GC.KeepAlive(msg);
582                 if (this != null) { this.ptrs_to.AddLast(msg); };
583         }
584
585         /**
586          * Handle an incoming `tx_remove_output` message from the given peer.
587          */
588         public void handle_tx_remove_output(byte[] their_node_id, org.ldk.structs.TxRemoveOutput msg) {
589                 bindings.ChannelMessageHandler_handle_tx_remove_output(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
590                 GC.KeepAlive(this);
591                 GC.KeepAlive(their_node_id);
592                 GC.KeepAlive(msg);
593                 if (this != null) { this.ptrs_to.AddLast(msg); };
594         }
595
596         /**
597          * Handle an incoming `tx_complete message` from the given peer.
598          */
599         public void handle_tx_complete(byte[] their_node_id, org.ldk.structs.TxComplete msg) {
600                 bindings.ChannelMessageHandler_handle_tx_complete(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
601                 GC.KeepAlive(this);
602                 GC.KeepAlive(their_node_id);
603                 GC.KeepAlive(msg);
604                 if (this != null) { this.ptrs_to.AddLast(msg); };
605         }
606
607         /**
608          * Handle an incoming `tx_signatures` message from the given peer.
609          */
610         public void handle_tx_signatures(byte[] their_node_id, org.ldk.structs.TxSignatures msg) {
611                 bindings.ChannelMessageHandler_handle_tx_signatures(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
612                 GC.KeepAlive(this);
613                 GC.KeepAlive(their_node_id);
614                 GC.KeepAlive(msg);
615                 if (this != null) { this.ptrs_to.AddLast(msg); };
616         }
617
618         /**
619          * Handle an incoming `tx_init_rbf` message from the given peer.
620          */
621         public void handle_tx_init_rbf(byte[] their_node_id, org.ldk.structs.TxInitRbf msg) {
622                 bindings.ChannelMessageHandler_handle_tx_init_rbf(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
623                 GC.KeepAlive(this);
624                 GC.KeepAlive(their_node_id);
625                 GC.KeepAlive(msg);
626                 if (this != null) { this.ptrs_to.AddLast(msg); };
627         }
628
629         /**
630          * Handle an incoming `tx_ack_rbf` message from the given peer.
631          */
632         public void handle_tx_ack_rbf(byte[] their_node_id, org.ldk.structs.TxAckRbf msg) {
633                 bindings.ChannelMessageHandler_handle_tx_ack_rbf(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
634                 GC.KeepAlive(this);
635                 GC.KeepAlive(their_node_id);
636                 GC.KeepAlive(msg);
637                 if (this != null) { this.ptrs_to.AddLast(msg); };
638         }
639
640         /**
641          * Handle an incoming `tx_abort message` from the given peer.
642          */
643         public void handle_tx_abort(byte[] their_node_id, org.ldk.structs.TxAbort msg) {
644                 bindings.ChannelMessageHandler_handle_tx_abort(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
645                 GC.KeepAlive(this);
646                 GC.KeepAlive(their_node_id);
647                 GC.KeepAlive(msg);
648                 if (this != null) { this.ptrs_to.AddLast(msg); };
649         }
650
651         /**
652          * Handle an incoming `update_add_htlc` message from the given peer.
653          */
654         public void handle_update_add_htlc(byte[] their_node_id, org.ldk.structs.UpdateAddHTLC msg) {
655                 bindings.ChannelMessageHandler_handle_update_add_htlc(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
656                 GC.KeepAlive(this);
657                 GC.KeepAlive(their_node_id);
658                 GC.KeepAlive(msg);
659                 if (this != null) { this.ptrs_to.AddLast(msg); };
660         }
661
662         /**
663          * Handle an incoming `update_fulfill_htlc` message from the given peer.
664          */
665         public void handle_update_fulfill_htlc(byte[] their_node_id, org.ldk.structs.UpdateFulfillHTLC msg) {
666                 bindings.ChannelMessageHandler_handle_update_fulfill_htlc(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
667                 GC.KeepAlive(this);
668                 GC.KeepAlive(their_node_id);
669                 GC.KeepAlive(msg);
670                 if (this != null) { this.ptrs_to.AddLast(msg); };
671         }
672
673         /**
674          * Handle an incoming `update_fail_htlc` message from the given peer.
675          */
676         public void handle_update_fail_htlc(byte[] their_node_id, org.ldk.structs.UpdateFailHTLC msg) {
677                 bindings.ChannelMessageHandler_handle_update_fail_htlc(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
678                 GC.KeepAlive(this);
679                 GC.KeepAlive(their_node_id);
680                 GC.KeepAlive(msg);
681                 if (this != null) { this.ptrs_to.AddLast(msg); };
682         }
683
684         /**
685          * Handle an incoming `update_fail_malformed_htlc` message from the given peer.
686          */
687         public void handle_update_fail_malformed_htlc(byte[] their_node_id, org.ldk.structs.UpdateFailMalformedHTLC msg) {
688                 bindings.ChannelMessageHandler_handle_update_fail_malformed_htlc(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
689                 GC.KeepAlive(this);
690                 GC.KeepAlive(their_node_id);
691                 GC.KeepAlive(msg);
692                 if (this != null) { this.ptrs_to.AddLast(msg); };
693         }
694
695         /**
696          * Handle an incoming `commitment_signed` message from the given peer.
697          */
698         public void handle_commitment_signed(byte[] their_node_id, org.ldk.structs.CommitmentSigned msg) {
699                 bindings.ChannelMessageHandler_handle_commitment_signed(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
700                 GC.KeepAlive(this);
701                 GC.KeepAlive(their_node_id);
702                 GC.KeepAlive(msg);
703                 if (this != null) { this.ptrs_to.AddLast(msg); };
704         }
705
706         /**
707          * Handle an incoming `revoke_and_ack` message from the given peer.
708          */
709         public void handle_revoke_and_ack(byte[] their_node_id, org.ldk.structs.RevokeAndACK msg) {
710                 bindings.ChannelMessageHandler_handle_revoke_and_ack(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
711                 GC.KeepAlive(this);
712                 GC.KeepAlive(their_node_id);
713                 GC.KeepAlive(msg);
714                 if (this != null) { this.ptrs_to.AddLast(msg); };
715         }
716
717         /**
718          * Handle an incoming `update_fee` message from the given peer.
719          */
720         public void handle_update_fee(byte[] their_node_id, org.ldk.structs.UpdateFee msg) {
721                 bindings.ChannelMessageHandler_handle_update_fee(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
722                 GC.KeepAlive(this);
723                 GC.KeepAlive(their_node_id);
724                 GC.KeepAlive(msg);
725                 if (this != null) { this.ptrs_to.AddLast(msg); };
726         }
727
728         /**
729          * Handle an incoming `announcement_signatures` message from the given peer.
730          */
731         public void handle_announcement_signatures(byte[] their_node_id, org.ldk.structs.AnnouncementSignatures msg) {
732                 bindings.ChannelMessageHandler_handle_announcement_signatures(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
733                 GC.KeepAlive(this);
734                 GC.KeepAlive(their_node_id);
735                 GC.KeepAlive(msg);
736                 if (this != null) { this.ptrs_to.AddLast(msg); };
737         }
738
739         /**
740          * Indicates a connection to the peer failed/an existing connection was lost.
741          */
742         public void peer_disconnected(byte[] their_node_id) {
743                 bindings.ChannelMessageHandler_peer_disconnected(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)));
744                 GC.KeepAlive(this);
745                 GC.KeepAlive(their_node_id);
746         }
747
748         /**
749          * Handle a peer reconnecting, possibly generating `channel_reestablish` message(s).
750          * 
751          * May return an `Err(())` if the features the peer supports are not sufficient to communicate
752          * with us. Implementors should be somewhat conservative about doing so, however, as other
753          * message handlers may still wish to communicate with this peer.
754          */
755         public Result_NoneNoneZ peer_connected(byte[] their_node_id, org.ldk.structs.Init msg, bool inbound) {
756                 long ret = bindings.ChannelMessageHandler_peer_connected(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr, inbound);
757                 GC.KeepAlive(this);
758                 GC.KeepAlive(their_node_id);
759                 GC.KeepAlive(msg);
760                 GC.KeepAlive(inbound);
761                 if (ret >= 0 && ret <= 4096) { return null; }
762                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
763                 if (this != null) { this.ptrs_to.AddLast(msg); };
764                 return ret_hu_conv;
765         }
766
767         /**
768          * Handle an incoming `channel_reestablish` message from the given peer.
769          */
770         public void handle_channel_reestablish(byte[] their_node_id, org.ldk.structs.ChannelReestablish msg) {
771                 bindings.ChannelMessageHandler_handle_channel_reestablish(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
772                 GC.KeepAlive(this);
773                 GC.KeepAlive(their_node_id);
774                 GC.KeepAlive(msg);
775                 if (this != null) { this.ptrs_to.AddLast(msg); };
776         }
777
778         /**
779          * Handle an incoming `channel_update` message from the given peer.
780          */
781         public void handle_channel_update(byte[] their_node_id, org.ldk.structs.ChannelUpdate msg) {
782                 bindings.ChannelMessageHandler_handle_channel_update(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
783                 GC.KeepAlive(this);
784                 GC.KeepAlive(their_node_id);
785                 GC.KeepAlive(msg);
786                 if (this != null) { this.ptrs_to.AddLast(msg); };
787         }
788
789         /**
790          * Handle an incoming `error` message from the given peer.
791          */
792         public void handle_error(byte[] their_node_id, org.ldk.structs.ErrorMessage msg) {
793                 bindings.ChannelMessageHandler_handle_error(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)), msg == null ? 0 : msg.ptr);
794                 GC.KeepAlive(this);
795                 GC.KeepAlive(their_node_id);
796                 GC.KeepAlive(msg);
797                 if (this != null) { this.ptrs_to.AddLast(msg); };
798         }
799
800         /**
801          * Gets the node feature flags which this handler itself supports. All available handlers are
802          * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
803          * which are broadcasted in our [`NodeAnnouncement`] message.
804          */
805         public NodeFeatures provided_node_features() {
806                 long ret = bindings.ChannelMessageHandler_provided_node_features(this.ptr);
807                 GC.KeepAlive(this);
808                 if (ret >= 0 && ret <= 4096) { return null; }
809                 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
810                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
811                 return ret_hu_conv;
812         }
813
814         /**
815          * Gets the init feature flags which should be sent to the given peer. All available handlers
816          * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
817          * which are sent in our [`Init`] message.
818          * 
819          * Note that this method is called before [`Self::peer_connected`].
820          */
821         public InitFeatures provided_init_features(byte[] their_node_id) {
822                 long ret = bindings.ChannelMessageHandler_provided_init_features(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(their_node_id, 33)));
823                 GC.KeepAlive(this);
824                 GC.KeepAlive(their_node_id);
825                 if (ret >= 0 && ret <= 4096) { return null; }
826                 org.ldk.structs.InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InitFeatures(null, ret); }
827                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
828                 return ret_hu_conv;
829         }
830
831         /**
832          * Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports.
833          * 
834          * If it's `None`, then no particular network chain hash compatibility will be enforced when
835          * connecting to peers.
836          */
837         public Option_CVec_ThirtyTwoBytesZZ get_chain_hashes() {
838                 long ret = bindings.ChannelMessageHandler_get_chain_hashes(this.ptr);
839                 GC.KeepAlive(this);
840                 if (ret >= 0 && ret <= 4096) { return null; }
841                 org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ ret_hu_conv = org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ.constr_from_ptr(ret);
842                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
843                 return ret_hu_conv;
844         }
845
846 }
847 } } }