6 namespace org { namespace ldk { namespace structs {
9 * A trait to describe an object which can receive channel messages.
11 * Messages MAY be called in parallel when they originate from different their_node_ids, however
12 * they MUST NOT be called in parallel when the two calls have the same their_node_id.
14 public class ChannelMessageHandler : CommonBase {
15 internal readonly bindings.LDKChannelMessageHandler bindings_instance;
16 internal ChannelMessageHandler(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
17 private ChannelMessageHandler(bindings.LDKChannelMessageHandler arg, bindings.LDKMessageSendEventsProvider MessageSendEventsProvider) : base(bindings.LDKChannelMessageHandler_new(arg, MessageSendEventsProvider)) {
18 this.ptrs_to.AddLast(arg);
19 this.ptrs_to.AddLast(MessageSendEventsProvider);
20 this.bindings_instance = arg;
22 ~ChannelMessageHandler() {
23 if (ptr != 0) { bindings.ChannelMessageHandler_free(ptr); }
26 public interface ChannelMessageHandlerInterface {
28 * Handle an incoming open_channel message from the given peer.
30 void handle_open_channel(byte[] _their_node_id, InitFeatures _their_features, OpenChannel _msg);
32 * Handle an incoming accept_channel message from the given peer.
34 void handle_accept_channel(byte[] _their_node_id, InitFeatures _their_features, AcceptChannel _msg);
36 * Handle an incoming funding_created message from the given peer.
38 void handle_funding_created(byte[] _their_node_id, FundingCreated _msg);
40 * Handle an incoming funding_signed message from the given peer.
42 void handle_funding_signed(byte[] _their_node_id, FundingSigned _msg);
44 * Handle an incoming channel_ready message from the given peer.
46 void handle_channel_ready(byte[] _their_node_id, ChannelReady _msg);
48 * Handle an incoming shutdown message from the given peer.
50 void handle_shutdown(byte[] _their_node_id, InitFeatures _their_features, Shutdown _msg);
52 * Handle an incoming closing_signed message from the given peer.
54 void handle_closing_signed(byte[] _their_node_id, ClosingSigned _msg);
56 * Handle an incoming update_add_htlc message from the given peer.
58 void handle_update_add_htlc(byte[] _their_node_id, UpdateAddHTLC _msg);
60 * Handle an incoming update_fulfill_htlc message from the given peer.
62 void handle_update_fulfill_htlc(byte[] _their_node_id, UpdateFulfillHTLC _msg);
64 * Handle an incoming update_fail_htlc message from the given peer.
66 void handle_update_fail_htlc(byte[] _their_node_id, UpdateFailHTLC _msg);
68 * Handle an incoming update_fail_malformed_htlc message from the given peer.
70 void handle_update_fail_malformed_htlc(byte[] _their_node_id, UpdateFailMalformedHTLC _msg);
72 * Handle an incoming commitment_signed message from the given peer.
74 void handle_commitment_signed(byte[] _their_node_id, CommitmentSigned _msg);
76 * Handle an incoming revoke_and_ack message from the given peer.
78 void handle_revoke_and_ack(byte[] _their_node_id, RevokeAndACK _msg);
80 * Handle an incoming update_fee message from the given peer.
82 void handle_update_fee(byte[] _their_node_id, UpdateFee _msg);
84 * Handle an incoming announcement_signatures message from the given peer.
86 void handle_announcement_signatures(byte[] _their_node_id, AnnouncementSignatures _msg);
88 * Indicates a connection to the peer failed/an existing connection was lost. If no connection
89 * is believed to be possible in the future (eg they're sending us messages we don't
90 * understand or indicate they require unknown feature bits), no_connection_possible is set
91 * and any outstanding channels should be failed.
93 * Note that in some rare cases this may be called without a corresponding
94 * [`Self::peer_connected`].
96 void peer_disconnected(byte[] _their_node_id, bool _no_connection_possible);
98 * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
100 * May return an `Err(())` if the features the peer supports are not sufficient to communicate
101 * with us. Implementors should be somewhat conservative about doing so, however, as other
102 * message handlers may still wish to communicate with this peer.
104 Result_NoneNoneZ peer_connected(byte[] _their_node_id, Init _msg);
106 * Handle an incoming channel_reestablish message from the given peer.
108 void handle_channel_reestablish(byte[] _their_node_id, ChannelReestablish _msg);
110 * Handle an incoming channel update from the given peer.
112 void handle_channel_update(byte[] _their_node_id, ChannelUpdate _msg);
114 * Handle an incoming error message from the given peer.
116 void handle_error(byte[] _their_node_id, ErrorMessage _msg);
118 * Gets the node feature flags which this handler itself supports. All available handlers are
119 * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
120 * which are broadcasted in our [`NodeAnnouncement`] message.
122 NodeFeatures provided_node_features();
124 * Gets the init feature flags which should be sent to the given peer. All available handlers
125 * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
126 * which are sent in our [`Init`] message.
128 * Note that this method is called before [`Self::peer_connected`].
130 InitFeatures provided_init_features(byte[] _their_node_id);
132 private class LDKChannelMessageHandlerHolder { internal ChannelMessageHandler held; }
133 private class LDKChannelMessageHandlerImpl : bindings.LDKChannelMessageHandler {
134 internal LDKChannelMessageHandlerImpl(ChannelMessageHandlerInterface arg, LDKChannelMessageHandlerHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
135 private ChannelMessageHandlerInterface arg;
136 private LDKChannelMessageHandlerHolder impl_holder;
137 public void handle_open_channel(byte[] _their_node_id, long _their_features, long _msg) {
138 org.ldk.structs.InitFeatures _their_features_hu_conv = null; if (_their_features < 0 || _their_features > 4096) { _their_features_hu_conv = new org.ldk.structs.InitFeatures(null, _their_features); }
139 if (_their_features_hu_conv != null) { _their_features_hu_conv.ptrs_to.AddLast(this); };
140 org.ldk.structs.OpenChannel _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.OpenChannel(null, _msg); }
141 arg.handle_open_channel(_their_node_id, _their_features_hu_conv, _msg_hu_conv);
144 public void handle_accept_channel(byte[] _their_node_id, long _their_features, long _msg) {
145 org.ldk.structs.InitFeatures _their_features_hu_conv = null; if (_their_features < 0 || _their_features > 4096) { _their_features_hu_conv = new org.ldk.structs.InitFeatures(null, _their_features); }
146 if (_their_features_hu_conv != null) { _their_features_hu_conv.ptrs_to.AddLast(this); };
147 org.ldk.structs.AcceptChannel _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.AcceptChannel(null, _msg); }
148 arg.handle_accept_channel(_their_node_id, _their_features_hu_conv, _msg_hu_conv);
151 public void handle_funding_created(byte[] _their_node_id, long _msg) {
152 org.ldk.structs.FundingCreated _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.FundingCreated(null, _msg); }
153 arg.handle_funding_created(_their_node_id, _msg_hu_conv);
156 public void handle_funding_signed(byte[] _their_node_id, long _msg) {
157 org.ldk.structs.FundingSigned _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.FundingSigned(null, _msg); }
158 arg.handle_funding_signed(_their_node_id, _msg_hu_conv);
161 public void handle_channel_ready(byte[] _their_node_id, long _msg) {
162 org.ldk.structs.ChannelReady _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.ChannelReady(null, _msg); }
163 arg.handle_channel_ready(_their_node_id, _msg_hu_conv);
166 public void handle_shutdown(byte[] _their_node_id, long _their_features, long _msg) {
167 org.ldk.structs.InitFeatures _their_features_hu_conv = null; if (_their_features < 0 || _their_features > 4096) { _their_features_hu_conv = new org.ldk.structs.InitFeatures(null, _their_features); }
168 org.ldk.structs.Shutdown _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.Shutdown(null, _msg); }
169 arg.handle_shutdown(_their_node_id, _their_features_hu_conv, _msg_hu_conv);
172 public void handle_closing_signed(byte[] _their_node_id, long _msg) {
173 org.ldk.structs.ClosingSigned _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.ClosingSigned(null, _msg); }
174 arg.handle_closing_signed(_their_node_id, _msg_hu_conv);
177 public void handle_update_add_htlc(byte[] _their_node_id, long _msg) {
178 org.ldk.structs.UpdateAddHTLC _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.UpdateAddHTLC(null, _msg); }
179 arg.handle_update_add_htlc(_their_node_id, _msg_hu_conv);
182 public void handle_update_fulfill_htlc(byte[] _their_node_id, long _msg) {
183 org.ldk.structs.UpdateFulfillHTLC _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.UpdateFulfillHTLC(null, _msg); }
184 arg.handle_update_fulfill_htlc(_their_node_id, _msg_hu_conv);
187 public void handle_update_fail_htlc(byte[] _their_node_id, long _msg) {
188 org.ldk.structs.UpdateFailHTLC _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.UpdateFailHTLC(null, _msg); }
189 arg.handle_update_fail_htlc(_their_node_id, _msg_hu_conv);
192 public void handle_update_fail_malformed_htlc(byte[] _their_node_id, long _msg) {
193 org.ldk.structs.UpdateFailMalformedHTLC _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.UpdateFailMalformedHTLC(null, _msg); }
194 arg.handle_update_fail_malformed_htlc(_their_node_id, _msg_hu_conv);
197 public void handle_commitment_signed(byte[] _their_node_id, long _msg) {
198 org.ldk.structs.CommitmentSigned _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.CommitmentSigned(null, _msg); }
199 arg.handle_commitment_signed(_their_node_id, _msg_hu_conv);
202 public void handle_revoke_and_ack(byte[] _their_node_id, long _msg) {
203 org.ldk.structs.RevokeAndACK _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.RevokeAndACK(null, _msg); }
204 arg.handle_revoke_and_ack(_their_node_id, _msg_hu_conv);
207 public void handle_update_fee(byte[] _their_node_id, long _msg) {
208 org.ldk.structs.UpdateFee _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.UpdateFee(null, _msg); }
209 arg.handle_update_fee(_their_node_id, _msg_hu_conv);
212 public void handle_announcement_signatures(byte[] _their_node_id, long _msg) {
213 org.ldk.structs.AnnouncementSignatures _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.AnnouncementSignatures(null, _msg); }
214 arg.handle_announcement_signatures(_their_node_id, _msg_hu_conv);
217 public void peer_disconnected(byte[] _their_node_id, bool _no_connection_possible) {
218 arg.peer_disconnected(_their_node_id, _no_connection_possible);
221 public long peer_connected(byte[] _their_node_id, long _msg) {
222 org.ldk.structs.Init _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.Init(null, _msg); }
223 Result_NoneNoneZ ret = arg.peer_connected(_their_node_id, _msg_hu_conv);
225 long result = ret == null ? 0 : ret.clone_ptr();
228 public void handle_channel_reestablish(byte[] _their_node_id, long _msg) {
229 org.ldk.structs.ChannelReestablish _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.ChannelReestablish(null, _msg); }
230 arg.handle_channel_reestablish(_their_node_id, _msg_hu_conv);
233 public void handle_channel_update(byte[] _their_node_id, long _msg) {
234 org.ldk.structs.ChannelUpdate _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.ChannelUpdate(null, _msg); }
235 arg.handle_channel_update(_their_node_id, _msg_hu_conv);
238 public void handle_error(byte[] _their_node_id, long _msg) {
239 org.ldk.structs.ErrorMessage _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.ErrorMessage(null, _msg); }
240 arg.handle_error(_their_node_id, _msg_hu_conv);
243 public long provided_node_features() {
244 NodeFeatures ret = arg.provided_node_features();
246 long result = ret == null ? 0 : ret.clone_ptr();
249 public long provided_init_features(byte[] _their_node_id) {
250 InitFeatures ret = arg.provided_init_features(_their_node_id);
252 long result = ret == null ? 0 : ret.clone_ptr();
256 public static ChannelMessageHandler new_impl(ChannelMessageHandlerInterface arg, MessageSendEventsProvider.MessageSendEventsProviderInterface MessageSendEventsProvider_impl) {
257 LDKChannelMessageHandlerHolder impl_holder = new LDKChannelMessageHandlerHolder();
258 impl_holder.held = new ChannelMessageHandler(new LDKChannelMessageHandlerImpl(arg, impl_holder), MessageSendEventsProvider.new_impl(MessageSendEventsProvider_impl).bindings_instance);
259 return impl_holder.held;
263 * Gets the underlying MessageSendEventsProvider.
265 public MessageSendEventsProvider get_message_send_events_provider() {
266 MessageSendEventsProvider res = new MessageSendEventsProvider(null, bindings.LDKChannelMessageHandler_get_MessageSendEventsProvider(this.ptr));
267 this.ptrs_to.AddLast(res);
272 * Handle an incoming open_channel message from the given peer.
274 public void handle_open_channel(byte[] their_node_id, org.ldk.structs.InitFeatures their_features, org.ldk.structs.OpenChannel msg) {
275 bindings.ChannelMessageHandler_handle_open_channel(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : their_features.ptr, msg == null ? 0 : msg.ptr);
277 GC.KeepAlive(their_node_id);
278 GC.KeepAlive(their_features);
280 if (this != null) { this.ptrs_to.AddLast(their_features); };
281 if (this != null) { this.ptrs_to.AddLast(msg); };
285 * Handle an incoming accept_channel message from the given peer.
287 public void handle_accept_channel(byte[] their_node_id, org.ldk.structs.InitFeatures their_features, org.ldk.structs.AcceptChannel msg) {
288 bindings.ChannelMessageHandler_handle_accept_channel(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : their_features.ptr, msg == null ? 0 : msg.ptr);
290 GC.KeepAlive(their_node_id);
291 GC.KeepAlive(their_features);
293 if (this != null) { this.ptrs_to.AddLast(their_features); };
294 if (this != null) { this.ptrs_to.AddLast(msg); };
298 * Handle an incoming funding_created message from the given peer.
300 public void handle_funding_created(byte[] their_node_id, org.ldk.structs.FundingCreated msg) {
301 bindings.ChannelMessageHandler_handle_funding_created(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
303 GC.KeepAlive(their_node_id);
305 if (this != null) { this.ptrs_to.AddLast(msg); };
309 * Handle an incoming funding_signed message from the given peer.
311 public void handle_funding_signed(byte[] their_node_id, org.ldk.structs.FundingSigned msg) {
312 bindings.ChannelMessageHandler_handle_funding_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
314 GC.KeepAlive(their_node_id);
316 if (this != null) { this.ptrs_to.AddLast(msg); };
320 * Handle an incoming channel_ready message from the given peer.
322 public void handle_channel_ready(byte[] their_node_id, org.ldk.structs.ChannelReady msg) {
323 bindings.ChannelMessageHandler_handle_channel_ready(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
325 GC.KeepAlive(their_node_id);
327 if (this != null) { this.ptrs_to.AddLast(msg); };
331 * Handle an incoming shutdown message from the given peer.
333 public void handle_shutdown(byte[] their_node_id, org.ldk.structs.InitFeatures their_features, org.ldk.structs.Shutdown msg) {
334 bindings.ChannelMessageHandler_handle_shutdown(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : their_features.ptr, msg == null ? 0 : msg.ptr);
336 GC.KeepAlive(their_node_id);
337 GC.KeepAlive(their_features);
339 if (this != null) { this.ptrs_to.AddLast(their_features); };
340 if (this != null) { this.ptrs_to.AddLast(msg); };
344 * Handle an incoming closing_signed message from the given peer.
346 public void handle_closing_signed(byte[] their_node_id, org.ldk.structs.ClosingSigned msg) {
347 bindings.ChannelMessageHandler_handle_closing_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
349 GC.KeepAlive(their_node_id);
351 if (this != null) { this.ptrs_to.AddLast(msg); };
355 * Handle an incoming update_add_htlc message from the given peer.
357 public void handle_update_add_htlc(byte[] their_node_id, org.ldk.structs.UpdateAddHTLC msg) {
358 bindings.ChannelMessageHandler_handle_update_add_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
360 GC.KeepAlive(their_node_id);
362 if (this != null) { this.ptrs_to.AddLast(msg); };
366 * Handle an incoming update_fulfill_htlc message from the given peer.
368 public void handle_update_fulfill_htlc(byte[] their_node_id, org.ldk.structs.UpdateFulfillHTLC msg) {
369 bindings.ChannelMessageHandler_handle_update_fulfill_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
371 GC.KeepAlive(their_node_id);
373 if (this != null) { this.ptrs_to.AddLast(msg); };
377 * Handle an incoming update_fail_htlc message from the given peer.
379 public void handle_update_fail_htlc(byte[] their_node_id, org.ldk.structs.UpdateFailHTLC msg) {
380 bindings.ChannelMessageHandler_handle_update_fail_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
382 GC.KeepAlive(their_node_id);
384 if (this != null) { this.ptrs_to.AddLast(msg); };
388 * Handle an incoming update_fail_malformed_htlc message from the given peer.
390 public void handle_update_fail_malformed_htlc(byte[] their_node_id, org.ldk.structs.UpdateFailMalformedHTLC msg) {
391 bindings.ChannelMessageHandler_handle_update_fail_malformed_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
393 GC.KeepAlive(their_node_id);
395 if (this != null) { this.ptrs_to.AddLast(msg); };
399 * Handle an incoming commitment_signed message from the given peer.
401 public void handle_commitment_signed(byte[] their_node_id, org.ldk.structs.CommitmentSigned msg) {
402 bindings.ChannelMessageHandler_handle_commitment_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
404 GC.KeepAlive(their_node_id);
406 if (this != null) { this.ptrs_to.AddLast(msg); };
410 * Handle an incoming revoke_and_ack message from the given peer.
412 public void handle_revoke_and_ack(byte[] their_node_id, org.ldk.structs.RevokeAndACK msg) {
413 bindings.ChannelMessageHandler_handle_revoke_and_ack(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
415 GC.KeepAlive(their_node_id);
417 if (this != null) { this.ptrs_to.AddLast(msg); };
421 * Handle an incoming update_fee message from the given peer.
423 public void handle_update_fee(byte[] their_node_id, org.ldk.structs.UpdateFee msg) {
424 bindings.ChannelMessageHandler_handle_update_fee(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
426 GC.KeepAlive(their_node_id);
428 if (this != null) { this.ptrs_to.AddLast(msg); };
432 * Handle an incoming announcement_signatures message from the given peer.
434 public void handle_announcement_signatures(byte[] their_node_id, org.ldk.structs.AnnouncementSignatures msg) {
435 bindings.ChannelMessageHandler_handle_announcement_signatures(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
437 GC.KeepAlive(their_node_id);
439 if (this != null) { this.ptrs_to.AddLast(msg); };
443 * Indicates a connection to the peer failed/an existing connection was lost. If no connection
444 * is believed to be possible in the future (eg they're sending us messages we don't
445 * understand or indicate they require unknown feature bits), no_connection_possible is set
446 * and any outstanding channels should be failed.
448 * Note that in some rare cases this may be called without a corresponding
449 * [`Self::peer_connected`].
451 public void peer_disconnected(byte[] their_node_id, bool no_connection_possible) {
452 bindings.ChannelMessageHandler_peer_disconnected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), no_connection_possible);
454 GC.KeepAlive(their_node_id);
455 GC.KeepAlive(no_connection_possible);
459 * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
461 * May return an `Err(())` if the features the peer supports are not sufficient to communicate
462 * with us. Implementors should be somewhat conservative about doing so, however, as other
463 * message handlers may still wish to communicate with this peer.
465 public Result_NoneNoneZ peer_connected(byte[] their_node_id, org.ldk.structs.Init msg) {
466 long ret = bindings.ChannelMessageHandler_peer_connected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
468 GC.KeepAlive(their_node_id);
470 if (ret >= 0 && ret <= 4096) { return null; }
471 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
472 if (this != null) { this.ptrs_to.AddLast(msg); };
477 * Handle an incoming channel_reestablish message from the given peer.
479 public void handle_channel_reestablish(byte[] their_node_id, org.ldk.structs.ChannelReestablish msg) {
480 bindings.ChannelMessageHandler_handle_channel_reestablish(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
482 GC.KeepAlive(their_node_id);
484 if (this != null) { this.ptrs_to.AddLast(msg); };
488 * Handle an incoming channel update from the given peer.
490 public void handle_channel_update(byte[] their_node_id, org.ldk.structs.ChannelUpdate msg) {
491 bindings.ChannelMessageHandler_handle_channel_update(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
493 GC.KeepAlive(their_node_id);
495 if (this != null) { this.ptrs_to.AddLast(msg); };
499 * Handle an incoming error message from the given peer.
501 public void handle_error(byte[] their_node_id, org.ldk.structs.ErrorMessage msg) {
502 bindings.ChannelMessageHandler_handle_error(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
504 GC.KeepAlive(their_node_id);
506 if (this != null) { this.ptrs_to.AddLast(msg); };
510 * Gets the node feature flags which this handler itself supports. All available handlers are
511 * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
512 * which are broadcasted in our [`NodeAnnouncement`] message.
514 public NodeFeatures provided_node_features() {
515 long ret = bindings.ChannelMessageHandler_provided_node_features(this.ptr);
517 if (ret >= 0 && ret <= 4096) { return null; }
518 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
519 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
524 * Gets the init feature flags which should be sent to the given peer. All available handlers
525 * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
526 * which are sent in our [`Init`] message.
528 * Note that this method is called before [`Self::peer_connected`].
530 public InitFeatures provided_init_features(byte[] their_node_id) {
531 long ret = bindings.ChannelMessageHandler_provided_init_features(this.ptr, InternalUtils.check_arr_len(their_node_id, 33));
533 GC.KeepAlive(their_node_id);
534 if (ret >= 0 && ret <= 4096) { return null; }
535 org.ldk.structs.InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InitFeatures(null, ret); }
536 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };