X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FCommitmentTransaction.java;h=276a69d05befe92ec30c0115d5a0861851d02f35;hb=c6bac88847b7c09560af81f00ba8dd3c2ebe3a19;hp=70b0ab5a0c33e02f8f82c16380ad85e91ef4c3b8;hpb=17113550a5fefab21f39f27fbfe02646b8db53ae;p=ldk-java diff --git a/src/main/java/org/ldk/structs/CommitmentTransaction.java b/src/main/java/org/ldk/structs/CommitmentTransaction.java index 70b0ab5a..276a69d0 100644 --- a/src/main/java/org/ldk/structs/CommitmentTransaction.java +++ b/src/main/java/org/ldk/structs/CommitmentTransaction.java @@ -4,10 +4,11 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import javax.annotation.Nullable; /** - * This class tracks the per-transaction information needed to build a commitment transaction and to + * This class tracks the per-transaction information needed to build a commitment transaction and will * actually build it and sign. It is used for holder transactions that we sign only when needed * and for transactions we sign for the counterparty. * @@ -28,7 +29,8 @@ public class CommitmentTransaction extends CommonBase { */ public CommitmentTransaction clone() { long ret = bindings.CommitmentTransaction_clone(this.ptr); - CommitmentTransaction ret_hu_conv = new CommitmentTransaction(null, ret); + if (ret >= 0 && ret <= 4096) { return null; } + CommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CommitmentTransaction(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -44,8 +46,9 @@ public class CommitmentTransaction extends CommonBase { /** * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write */ - public static Result_CommitmentTransactionDecodeErrorZ constructor_read(byte[] ser) { + public static Result_CommitmentTransactionDecodeErrorZ read(byte[] ser) { long ret = bindings.CommitmentTransaction_read(ser); + if (ret >= 0 && ret <= 4096) { return null; } Result_CommitmentTransactionDecodeErrorZ ret_hu_conv = Result_CommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } @@ -88,11 +91,12 @@ public class CommitmentTransaction extends CommonBase { * Applies a wrapper which allows access to these fields. * * This should only be used if you fully trust the builder of this object. It should not - * \tbe used by an external signer - instead use the verify function. + * be used by an external signer - instead use the verify function. */ public TrustedCommitmentTransaction trust() { long ret = bindings.CommitmentTransaction_trust(this.ptr); - TrustedCommitmentTransaction ret_hu_conv = new TrustedCommitmentTransaction(null, ret); + if (ret >= 0 && ret <= 4096) { return null; } + TrustedCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new TrustedCommitmentTransaction(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -107,6 +111,7 @@ public class CommitmentTransaction extends CommonBase { */ public Result_TrustedCommitmentTransactionNoneZ verify(DirectedChannelTransactionParameters channel_parameters, ChannelPublicKeys broadcaster_keys, ChannelPublicKeys countersignatory_keys) { long ret = bindings.CommitmentTransaction_verify(this.ptr, channel_parameters == null ? 0 : channel_parameters.ptr & ~1, broadcaster_keys == null ? 0 : broadcaster_keys.ptr & ~1, countersignatory_keys == null ? 0 : countersignatory_keys.ptr & ~1); + if (ret >= 0 && ret <= 4096) { return null; } Result_TrustedCommitmentTransactionNoneZ ret_hu_conv = Result_TrustedCommitmentTransactionNoneZ.constr_from_ptr(ret); this.ptrs_to.add(channel_parameters); this.ptrs_to.add(broadcaster_keys);