+ if (this != null) { this.ptrs_to.add(msg); };
+ }
+
+ /**
+ * Handle an incoming `update_fail_malformed_htlc` message from the given peer.
+ */
+ public void handle_update_fail_malformed_htlc(byte[] their_node_id, org.ldk.structs.UpdateFailMalformedHTLC msg) {
+ bindings.ChannelMessageHandler_handle_update_fail_malformed_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(their_node_id);
+ Reference.reachabilityFence(msg);
+ if (this != null) { this.ptrs_to.add(msg); };
+ }
+
+ /**
+ * Handle an incoming `commitment_signed` message from the given peer.
+ */
+ public void handle_commitment_signed(byte[] their_node_id, org.ldk.structs.CommitmentSigned msg) {
+ bindings.ChannelMessageHandler_handle_commitment_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(their_node_id);
+ Reference.reachabilityFence(msg);
+ if (this != null) { this.ptrs_to.add(msg); };
+ }
+
+ /**
+ * Handle an incoming `revoke_and_ack` message from the given peer.
+ */
+ public void handle_revoke_and_ack(byte[] their_node_id, org.ldk.structs.RevokeAndACK msg) {
+ bindings.ChannelMessageHandler_handle_revoke_and_ack(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(their_node_id);
+ Reference.reachabilityFence(msg);
+ if (this != null) { this.ptrs_to.add(msg); };
+ }
+
+ /**
+ * Handle an incoming `update_fee` message from the given peer.
+ */
+ public void handle_update_fee(byte[] their_node_id, org.ldk.structs.UpdateFee msg) {
+ bindings.ChannelMessageHandler_handle_update_fee(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(their_node_id);
+ Reference.reachabilityFence(msg);
+ if (this != null) { this.ptrs_to.add(msg); };
+ }
+
+ /**
+ * Handle an incoming `announcement_signatures` message from the given peer.
+ */
+ public void handle_announcement_signatures(byte[] their_node_id, org.ldk.structs.AnnouncementSignatures msg) {
+ bindings.ChannelMessageHandler_handle_announcement_signatures(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(their_node_id);
+ Reference.reachabilityFence(msg);
+ if (this != null) { this.ptrs_to.add(msg); };
+ }
+
+ /**
+ * Indicates a connection to the peer failed/an existing connection was lost.
+ */
+ public void peer_disconnected(byte[] their_node_id) {
+ bindings.ChannelMessageHandler_peer_disconnected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33));
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(their_node_id);
+ }
+
+ /**
+ * Handle a peer reconnecting, possibly generating `channel_reestablish` message(s).
+ *
+ * May return an `Err(())` if the features the peer supports are not sufficient to communicate
+ * with us. Implementors should be somewhat conservative about doing so, however, as other
+ * message handlers may still wish to communicate with this peer.
+ */
+ public Result_NoneNoneZ peer_connected(byte[] their_node_id, org.ldk.structs.Init msg, boolean inbound) {
+ long ret = bindings.ChannelMessageHandler_peer_connected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr, inbound);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(their_node_id);
+ Reference.reachabilityFence(msg);
+ Reference.reachabilityFence(inbound);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
+ if (this != null) { this.ptrs_to.add(msg); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Handle an incoming `channel_reestablish` message from the given peer.
+ */
+ public void handle_channel_reestablish(byte[] their_node_id, org.ldk.structs.ChannelReestablish msg) {
+ bindings.ChannelMessageHandler_handle_channel_reestablish(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(their_node_id);
+ Reference.reachabilityFence(msg);
+ if (this != null) { this.ptrs_to.add(msg); };
+ }
+
+ /**
+ * Handle an incoming `channel_update` message from the given peer.
+ */
+ public void handle_channel_update(byte[] their_node_id, org.ldk.structs.ChannelUpdate msg) {
+ bindings.ChannelMessageHandler_handle_channel_update(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(their_node_id);
+ Reference.reachabilityFence(msg);
+ if (this != null) { this.ptrs_to.add(msg); };
+ }
+
+ /**
+ * Handle an incoming `error` message from the given peer.
+ */
+ public void handle_error(byte[] their_node_id, org.ldk.structs.ErrorMessage msg) {
+ bindings.ChannelMessageHandler_handle_error(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(their_node_id);
+ Reference.reachabilityFence(msg);
+ if (this != null) { this.ptrs_to.add(msg); };
+ }
+
+ /**
+ * Gets the node feature flags which this handler itself supports. All available handlers are
+ * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
+ * which are broadcasted in our [`NodeAnnouncement`] message.
+ */
+ public NodeFeatures provided_node_features() {
+ long ret = bindings.ChannelMessageHandler_provided_node_features(this.ptr);
+ Reference.reachabilityFence(this);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Gets the init feature flags which should be sent to the given peer. All available handlers
+ * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
+ * which are sent in our [`Init`] message.
+ *
+ * Note that this method is called before [`Self::peer_connected`].
+ */
+ public InitFeatures provided_init_features(byte[] their_node_id) {
+ long ret = bindings.ChannelMessageHandler_provided_init_features(this.ptr, InternalUtils.check_arr_len(their_node_id, 33));
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(their_node_id);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InitFeatures(null, ret); }
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports.
+ *
+ * If it's `None`, then no particular network chain hash compatibility will be enforced when
+ * connecting to peers.
+ */
+ public Option_CVec_ThirtyTwoBytesZZ get_chain_hashes() {
+ long ret = bindings.ChannelMessageHandler_get_chain_hashes(this.ptr);
+ Reference.reachabilityFence(this);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ ret_hu_conv = org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
+ return ret_hu_conv;