X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=inline;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FRecord.java;h=6e9bd3e625d690a1ae5bda24024b3bb829df088c;hb=ffdd56c967087cba7548599934585b8a9a3102e2;hp=a172a2729d62f5a0477242dc544031bf51ade335;hpb=47341beaeecf907f422f126500baf586d54a0d41;p=ldk-java diff --git a/src/main/java/org/ldk/structs/Record.java b/src/main/java/org/ldk/structs/Record.java index a172a272..6e9bd3e6 100644 --- a/src/main/java/org/ldk/structs/Record.java +++ b/src/main/java/org/ldk/structs/Record.java @@ -39,6 +39,66 @@ public class Record extends CommonBase { Reference.reachabilityFence(val); } + /** + * The node id of the peer pertaining to the logged record. + * + * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be + * `None`, depending on if the peer information is readily available in LDK when the log is + * generated. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public byte[] get_peer_id() { + byte[] ret = bindings.Record_get_peer_id(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * The node id of the peer pertaining to the logged record. + * + * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be + * `None`, depending on if the peer information is readily available in LDK when the log is + * generated. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + public void set_peer_id(@Nullable byte[] val) { + bindings.Record_set_peer_id(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * The channel id of the channel pertaining to the logged record. May be a temporary id before + * the channel has been funded. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public ChannelId get_channel_id() { + long ret = bindings.Record_get_channel_id(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * The channel id of the channel pertaining to the logged record. May be a temporary id before + * the channel has been funded. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + public void set_channel_id(@Nullable org.ldk.structs.ChannelId val) { + bindings.Record_set_channel_id(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; + } + /** * The message body. */ @@ -111,6 +171,28 @@ public class Record extends CommonBase { Reference.reachabilityFence(val); } + /** + * Constructs a new Record given each field + * + * Note that peer_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that channel_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + public static Record of(org.ldk.enums.Level level_arg, @Nullable byte[] peer_id_arg, @Nullable org.ldk.structs.ChannelId channel_id_arg, java.lang.String args_arg, java.lang.String module_path_arg, java.lang.String file_arg, int line_arg) { + long ret = bindings.Record_new(level_arg, InternalUtils.check_arr_len(peer_id_arg, 33), channel_id_arg == null ? 0 : channel_id_arg.ptr, args_arg, module_path_arg, file_arg, line_arg); + Reference.reachabilityFence(level_arg); + Reference.reachabilityFence(peer_id_arg); + Reference.reachabilityFence(channel_id_arg); + Reference.reachabilityFence(args_arg); + Reference.reachabilityFence(module_path_arg); + Reference.reachabilityFence(file_arg); + Reference.reachabilityFence(line_arg); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Record ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Record(null, ret); } + 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(channel_id_arg); }; + return ret_hu_conv; + } + long clone_ptr() { long ret = bindings.Record_clone_ptr(this.ptr); Reference.reachabilityFence(this); @@ -125,7 +207,7 @@ public class Record extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Record ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Record(null, ret); } - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; }