X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FTrustedCommitmentTransaction.java;h=1590d438c6d2054bed30846eb187117bdc0907d8;hb=1854b5cebef22ace9e9e4dd191f609818df9ce08;hp=5f425d9433dcc82493b5b74e5ae2f0b74dcb8a12;hpb=db1a11032b4164540a2d3403696be12bbca70e94;p=ldk-java diff --git a/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java b/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java index 5f425d94..1590d438 100644 --- a/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java +++ b/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -29,6 +30,7 @@ public class TrustedCommitmentTransaction extends CommonBase { */ public byte[] txid() { byte[] ret = bindings.TrustedCommitmentTransaction_txid(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -37,8 +39,9 @@ public class TrustedCommitmentTransaction extends CommonBase { */ public BuiltCommitmentTransaction built_transaction() { long ret = bindings.TrustedCommitmentTransaction_built_transaction(this.ptr); - if (ret < 1024) { return null; } - BuiltCommitmentTransaction ret_hu_conv = new BuiltCommitmentTransaction(null, ret); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + BuiltCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BuiltCommitmentTransaction(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -48,12 +51,22 @@ public class TrustedCommitmentTransaction extends CommonBase { */ public TxCreationKeys keys() { long ret = bindings.TrustedCommitmentTransaction_keys(this.ptr); - if (ret < 1024) { return null; } - TxCreationKeys ret_hu_conv = new TxCreationKeys(null, ret); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + TxCreationKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new TxCreationKeys(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } + /** + * Should anchors be used. + */ + public boolean opt_anchors() { + boolean ret = bindings.TrustedCommitmentTransaction_opt_anchors(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Get a signature for each HTLC which was included in the commitment transaction (ie for * which HTLCOutputInCommitment::transaction_output_index.is_some()). @@ -61,8 +74,11 @@ public class TrustedCommitmentTransaction extends CommonBase { * The returned Vec has one entry for each HTLC, and in the same order. */ public Result_CVec_SignatureZNoneZ get_htlc_sigs(byte[] htlc_base_key, DirectedChannelTransactionParameters channel_parameters) { - long ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, htlc_base_key, channel_parameters == null ? 0 : channel_parameters.ptr & ~1); - if (ret < 1024) { return null; } + long ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, InternalUtils.check_arr_len(htlc_base_key, 32), channel_parameters == null ? 0 : channel_parameters.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(htlc_base_key); + Reference.reachabilityFence(channel_parameters); + if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_SignatureZNoneZ ret_hu_conv = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret); this.ptrs_to.add(channel_parameters); return ret_hu_conv;