X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FRapidGossipSync.java;h=cb5d67015780d8553a9ddea9321b507df2043104;hb=300b54d26fe5ed89f472ef821ebf67d56c917e49;hp=e95b351191b717ff224623d5e3fcaebca3fd7319;hpb=47341beaeecf907f422f126500baf586d54a0d41;p=ldk-java diff --git a/src/main/java/org/ldk/structs/RapidGossipSync.java b/src/main/java/org/ldk/structs/RapidGossipSync.java index e95b3511..cb5d6701 100644 --- a/src/main/java/org/ldk/structs/RapidGossipSync.java +++ b/src/main/java/org/ldk/structs/RapidGossipSync.java @@ -9,7 +9,8 @@ import javax.annotation.Nullable; /** - * Rapid Gossip Sync struct + * The main Rapid Gossip Sync object. + * * See [crate-level documentation] for usage. * * [crate-level documentation]: crate @@ -24,37 +25,37 @@ public class RapidGossipSync extends CommonBase { } /** - * Instantiate a new [`RapidGossipSync`] instance + * Instantiate a new [`RapidGossipSync`] instance. */ public static RapidGossipSync of(NetworkGraph network_graph) { - long ret = bindings.RapidGossipSync_new(network_graph == null ? 0 : network_graph.ptr & ~1); + long ret = bindings.RapidGossipSync_new(network_graph == null ? 0 : network_graph.ptr); Reference.reachabilityFence(network_graph); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.RapidGossipSync ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RapidGossipSync(null, ret); } - ret_hu_conv.ptrs_to.add(ret_hu_conv); - ret_hu_conv.ptrs_to.add(network_graph); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(network_graph); }; return ret_hu_conv; } /** - * Sync gossip data from a file + * Update network graph from binary data. * Returns the last sync timestamp to be used the next time rapid sync data is queried. * - * `network_graph`: The network graph to apply the updates to + * `network_graph`: network graph to be updated * - * `sync_path`: Path to the file where the gossip update data is located + * `update_data`: `&[u8]` binary stream that comprises the update data */ - public Result_u32GraphSyncErrorZ sync_network_graph_with_file_path(java.lang.String sync_path) { - long ret = bindings.RapidGossipSync_sync_network_graph_with_file_path(this.ptr, sync_path); + public Result_u32GraphSyncErrorZ update_network_graph(byte[] update_data) { + long ret = bindings.RapidGossipSync_update_network_graph(this.ptr, update_data); Reference.reachabilityFence(this); - Reference.reachabilityFence(sync_path); + Reference.reachabilityFence(update_data); if (ret >= 0 && ret <= 4096) { return null; } Result_u32GraphSyncErrorZ ret_hu_conv = Result_u32GraphSyncErrorZ.constr_from_ptr(ret); return ret_hu_conv; } /** - * Returns whether a rapid gossip sync has completed at least once + * Returns whether a rapid gossip sync has completed at least once. */ public boolean is_initial_sync_complete() { boolean ret = bindings.RapidGossipSync_is_initial_sync_complete(this.ptr); @@ -62,21 +63,4 @@ public class RapidGossipSync extends CommonBase { return ret; } - /** - * Update network graph from binary data. - * Returns the last sync timestamp to be used the next time rapid sync data is queried. - * - * `network_graph`: network graph to be updated - * - * `update_data`: `&[u8]` binary stream that comprises the update data - */ - public Result_u32GraphSyncErrorZ update_network_graph(byte[] update_data) { - long ret = bindings.RapidGossipSync_update_network_graph(this.ptr, update_data); - Reference.reachabilityFence(this); - Reference.reachabilityFence(update_data); - if (ret >= 0 && ret <= 4096) { return null; } - Result_u32GraphSyncErrorZ ret_hu_conv = Result_u32GraphSyncErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - }