X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FRoutingMessageHandler.java;h=eb6198717c4e1ac1a1070ab8a77ed2d00f4df30c;hb=c6bac88847b7c09560af81f00ba8dd3c2ebe3a19;hp=fc7b1281e9ef528a0a774c56f2d11f375ad6d66b;hpb=f6c75b182a7786062a4966e8939701ef59092509;p=ldk-java diff --git a/src/main/java/org/ldk/structs/RoutingMessageHandler.java b/src/main/java/org/ldk/structs/RoutingMessageHandler.java index fc7b1281..eb619871 100644 --- a/src/main/java/org/ldk/structs/RoutingMessageHandler.java +++ b/src/main/java/org/ldk/structs/RoutingMessageHandler.java @@ -96,19 +96,19 @@ public class RoutingMessageHandler extends CommonBase { final LDKRoutingMessageHandlerHolder impl_holder = new LDKRoutingMessageHandlerHolder(); impl_holder.held = new RoutingMessageHandler(new bindings.LDKRoutingMessageHandler() { @Override public long handle_node_announcement(long msg) { - NodeAnnouncement msg_hu_conv = new NodeAnnouncement(null, msg); + NodeAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new NodeAnnouncement(null, msg); } Result_boolLightningErrorZ ret = arg.handle_node_announcement(msg_hu_conv); long result = ret != null ? ret.ptr : 0; return result; } @Override public long handle_channel_announcement(long msg) { - ChannelAnnouncement msg_hu_conv = new ChannelAnnouncement(null, msg); + ChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelAnnouncement(null, msg); } Result_boolLightningErrorZ ret = arg.handle_channel_announcement(msg_hu_conv); long result = ret != null ? ret.ptr : 0; return result; } @Override public long handle_channel_update(long msg) { - ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg); + ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelUpdate(null, msg); } Result_boolLightningErrorZ ret = arg.handle_channel_update(msg_hu_conv); long result = ret != null ? ret.ptr : 0; return result; @@ -121,36 +121,35 @@ public class RoutingMessageHandler extends CommonBase { @Override public long[] get_next_node_announcements(byte[] starting_point, byte batch_amount) { NodeAnnouncement[] ret = arg.get_next_node_announcements(starting_point, batch_amount); long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_18 -> ret_conv_18 == null ? 0 : ret_conv_18.ptr & ~1).toArray() : null; - for (NodeAnnouncement ret_conv_18: ret) { impl_holder.held.ptrs_to.add(ret_conv_18); }; return result; } @Override public void sync_routing_table(byte[] their_node_id, long init) { - Init init_hu_conv = new Init(null, init); + Init init_hu_conv = null; if (init < 0 || init > 4096) { init_hu_conv = new Init(null, init); } arg.sync_routing_table(their_node_id, init_hu_conv); } @Override public long handle_reply_channel_range(byte[] their_node_id, long msg) { - ReplyChannelRange msg_hu_conv = new ReplyChannelRange(null, msg); + ReplyChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ReplyChannelRange(null, msg); } msg_hu_conv.ptrs_to.add(this); Result_NoneLightningErrorZ ret = arg.handle_reply_channel_range(their_node_id, msg_hu_conv); long result = ret != null ? ret.ptr : 0; return result; } @Override public long handle_reply_short_channel_ids_end(byte[] their_node_id, long msg) { - ReplyShortChannelIdsEnd msg_hu_conv = new ReplyShortChannelIdsEnd(null, msg); + ReplyShortChannelIdsEnd msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ReplyShortChannelIdsEnd(null, msg); } msg_hu_conv.ptrs_to.add(this); Result_NoneLightningErrorZ ret = arg.handle_reply_short_channel_ids_end(their_node_id, msg_hu_conv); long result = ret != null ? ret.ptr : 0; return result; } @Override public long handle_query_channel_range(byte[] their_node_id, long msg) { - QueryChannelRange msg_hu_conv = new QueryChannelRange(null, msg); + QueryChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new QueryChannelRange(null, msg); } msg_hu_conv.ptrs_to.add(this); Result_NoneLightningErrorZ ret = arg.handle_query_channel_range(their_node_id, msg_hu_conv); long result = ret != null ? ret.ptr : 0; return result; } @Override public long handle_query_short_channel_ids(byte[] their_node_id, long msg) { - QueryShortChannelIds msg_hu_conv = new QueryShortChannelIds(null, msg); + QueryShortChannelIds msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new QueryShortChannelIds(null, msg); } msg_hu_conv.ptrs_to.add(this); Result_NoneLightningErrorZ ret = arg.handle_query_short_channel_ids(their_node_id, msg_hu_conv); long result = ret != null ? ret.ptr : 0; @@ -175,7 +174,7 @@ public class RoutingMessageHandler extends CommonBase { */ public Result_boolLightningErrorZ handle_node_announcement(NodeAnnouncement msg) { long ret = bindings.RoutingMessageHandler_handle_node_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1); - if (ret < 1024) { return null; } + if (ret >= 0 && ret <= 4096) { return null; } Result_boolLightningErrorZ ret_hu_conv = Result_boolLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); return ret_hu_conv; @@ -187,7 +186,7 @@ public class RoutingMessageHandler extends CommonBase { */ public Result_boolLightningErrorZ handle_channel_announcement(ChannelAnnouncement msg) { long ret = bindings.RoutingMessageHandler_handle_channel_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1); - if (ret < 1024) { return null; } + if (ret >= 0 && ret <= 4096) { return null; } Result_boolLightningErrorZ ret_hu_conv = Result_boolLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); return ret_hu_conv; @@ -199,7 +198,7 @@ public class RoutingMessageHandler extends CommonBase { */ public Result_boolLightningErrorZ handle_channel_update(ChannelUpdate msg) { long ret = bindings.RoutingMessageHandler_handle_channel_update(this.ptr, msg == null ? 0 : msg.ptr & ~1); - if (ret < 1024) { return null; } + if (ret >= 0 && ret <= 4096) { return null; } Result_boolLightningErrorZ ret_hu_conv = Result_boolLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); return ret_hu_conv; @@ -235,7 +234,7 @@ public class RoutingMessageHandler extends CommonBase { NodeAnnouncement[] ret_conv_18_arr = new NodeAnnouncement[ret.length]; for (int s = 0; s < ret.length; s++) { long ret_conv_18 = ret[s]; - NodeAnnouncement ret_conv_18_hu_conv = new NodeAnnouncement(null, ret_conv_18); + NodeAnnouncement ret_conv_18_hu_conv = null; if (ret_conv_18 < 0 || ret_conv_18 > 4096) { ret_conv_18_hu_conv = new NodeAnnouncement(null, ret_conv_18); } ret_conv_18_hu_conv.ptrs_to.add(this); ret_conv_18_arr[s] = ret_conv_18_hu_conv; } @@ -259,9 +258,8 @@ public class RoutingMessageHandler extends CommonBase { */ public Result_NoneLightningErrorZ handle_reply_channel_range(byte[] their_node_id, ReplyChannelRange msg) { long ret = bindings.RoutingMessageHandler_handle_reply_channel_range(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1); - if (ret < 1024) { return null; } + if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); - this.ptrs_to.add(msg); return ret_hu_conv; } @@ -273,9 +271,8 @@ public class RoutingMessageHandler extends CommonBase { */ public Result_NoneLightningErrorZ handle_reply_short_channel_ids_end(byte[] their_node_id, ReplyShortChannelIdsEnd msg) { long ret = bindings.RoutingMessageHandler_handle_reply_short_channel_ids_end(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1); - if (ret < 1024) { return null; } + if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); - this.ptrs_to.add(msg); return ret_hu_conv; } @@ -285,9 +282,8 @@ public class RoutingMessageHandler extends CommonBase { */ public Result_NoneLightningErrorZ handle_query_channel_range(byte[] their_node_id, QueryChannelRange msg) { long ret = bindings.RoutingMessageHandler_handle_query_channel_range(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1); - if (ret < 1024) { return null; } + if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); - this.ptrs_to.add(msg); return ret_hu_conv; } @@ -297,9 +293,8 @@ public class RoutingMessageHandler extends CommonBase { */ public Result_NoneLightningErrorZ handle_query_short_channel_ids(byte[] their_node_id, QueryShortChannelIds msg) { long ret = bindings.RoutingMessageHandler_handle_query_short_channel_ids(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1); - if (ret < 1024) { return null; } + if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); - this.ptrs_to.add(msg); return ret_hu_conv; }