X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FCommitmentUpdate.java;h=e9e4b971bb716cb57e3c5680de69deacad8f9b97;hb=65a17b9ef4884736783566e30e075ca59b472cc7;hp=dbd15bc6b45046202c7e90c72dddcc631d975cc8;hpb=b0c50b891cbca28d3bd1d86276c132ff5221d8e4;p=ldk-java diff --git a/src/main/java/org/ldk/structs/CommitmentUpdate.java b/src/main/java/org/ldk/structs/CommitmentUpdate.java index dbd15bc6..e9e4b971 100644 --- a/src/main/java/org/ldk/structs/CommitmentUpdate.java +++ b/src/main/java/org/ldk/structs/CommitmentUpdate.java @@ -53,9 +53,13 @@ public class CommitmentUpdate extends CommonBase { /** * An update_fee message which should be sent + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ + @Nullable public UpdateFee get_update_fee() { long ret = bindings.CommitmentUpdate_get_update_fee(this.ptr); + if (ret < 1024) { return null; } UpdateFee ret_hu_conv = new UpdateFee(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; @@ -63,8 +67,10 @@ public class CommitmentUpdate extends CommonBase { /** * An update_fee message which should be sent + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public void set_update_fee(UpdateFee val) { + public void set_update_fee(@Nullable UpdateFee val) { bindings.CommitmentUpdate_set_update_fee(this.ptr, val == null ? 0 : val.ptr & ~1); this.ptrs_to.add(val); } @@ -74,6 +80,7 @@ public class CommitmentUpdate extends CommonBase { */ public CommitmentSigned get_commitment_signed() { long ret = bindings.CommitmentUpdate_get_commitment_signed(this.ptr); + if (ret < 1024) { return null; } CommitmentSigned ret_hu_conv = new CommitmentSigned(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; @@ -92,6 +99,7 @@ public class CommitmentUpdate extends CommonBase { */ public static CommitmentUpdate of(UpdateAddHTLC[] update_add_htlcs_arg, UpdateFulfillHTLC[] update_fulfill_htlcs_arg, UpdateFailHTLC[] update_fail_htlcs_arg, UpdateFailMalformedHTLC[] update_fail_malformed_htlcs_arg, UpdateFee update_fee_arg, CommitmentSigned commitment_signed_arg) { long ret = bindings.CommitmentUpdate_new(Arrays.stream(update_add_htlcs_arg).mapToLong(update_add_htlcs_arg_conv_15 -> update_add_htlcs_arg_conv_15 == null ? 0 : update_add_htlcs_arg_conv_15.ptr & ~1).toArray(), Arrays.stream(update_fulfill_htlcs_arg).mapToLong(update_fulfill_htlcs_arg_conv_19 -> update_fulfill_htlcs_arg_conv_19 == null ? 0 : update_fulfill_htlcs_arg_conv_19.ptr & ~1).toArray(), Arrays.stream(update_fail_htlcs_arg).mapToLong(update_fail_htlcs_arg_conv_16 -> update_fail_htlcs_arg_conv_16 == null ? 0 : update_fail_htlcs_arg_conv_16.ptr & ~1).toArray(), Arrays.stream(update_fail_malformed_htlcs_arg).mapToLong(update_fail_malformed_htlcs_arg_conv_25 -> update_fail_malformed_htlcs_arg_conv_25 == null ? 0 : update_fail_malformed_htlcs_arg_conv_25.ptr & ~1).toArray(), update_fee_arg == null ? 0 : update_fee_arg.ptr & ~1, commitment_signed_arg == null ? 0 : commitment_signed_arg.ptr & ~1); + if (ret < 1024) { return null; } CommitmentUpdate ret_hu_conv = new CommitmentUpdate(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); /* TODO 2 UpdateAddHTLC */; @@ -108,6 +116,7 @@ public class CommitmentUpdate extends CommonBase { */ public CommitmentUpdate clone() { long ret = bindings.CommitmentUpdate_clone(this.ptr); + if (ret < 1024) { return null; } CommitmentUpdate ret_hu_conv = new CommitmentUpdate(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv;