X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FAcceptChannel.java;h=ada6053ccc4d8674ad118b70276de89cf16f5710;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=4e19d30ebf5c228d6d2c965c2ad4093e0e594bb0;hpb=17113550a5fefab21f39f27fbfe02646b8db53ae;p=ldk-java diff --git a/src/main/java/org/ldk/structs/AcceptChannel.java b/src/main/java/org/ldk/structs/AcceptChannel.java index 4e19d30e..ada6053c 100644 --- a/src/main/java/org/ldk/structs/AcceptChannel.java +++ b/src/main/java/org/ldk/structs/AcceptChannel.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import javax.annotation.Nullable; /** @@ -30,7 +31,7 @@ public class AcceptChannel extends CommonBase { * A temporary channel ID, until the funding outpoint is announced */ public void set_temporary_channel_id(byte[] val) { - bindings.AcceptChannel_set_temporary_channel_id(this.ptr, val); + bindings.AcceptChannel_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); } /** @@ -150,7 +151,7 @@ public class AcceptChannel extends CommonBase { * The sender's key controlling the funding transaction */ public void set_funding_pubkey(byte[] val) { - bindings.AcceptChannel_set_funding_pubkey(this.ptr, val); + bindings.AcceptChannel_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33)); } /** @@ -165,7 +166,7 @@ public class AcceptChannel extends CommonBase { * Used to derive a revocation key for transactions broadcast by counterparty */ public void set_revocation_basepoint(byte[] val) { - bindings.AcceptChannel_set_revocation_basepoint(this.ptr, val); + bindings.AcceptChannel_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); } /** @@ -180,7 +181,7 @@ public class AcceptChannel extends CommonBase { * A payment key to sender for transactions broadcast by counterparty */ public void set_payment_point(byte[] val) { - bindings.AcceptChannel_set_payment_point(this.ptr, val); + bindings.AcceptChannel_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33)); } /** @@ -195,7 +196,7 @@ public class AcceptChannel extends CommonBase { * Used to derive a payment key to sender for transactions broadcast by sender */ public void set_delayed_payment_basepoint(byte[] val) { - bindings.AcceptChannel_set_delayed_payment_basepoint(this.ptr, val); + bindings.AcceptChannel_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); } /** @@ -210,7 +211,7 @@ public class AcceptChannel extends CommonBase { * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty */ public void set_htlc_basepoint(byte[] val) { - bindings.AcceptChannel_set_htlc_basepoint(this.ptr, val); + bindings.AcceptChannel_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); } /** @@ -225,7 +226,12 @@ public class AcceptChannel extends CommonBase { * The first to-be-broadcast-by-sender transaction's per commitment point */ public void set_first_per_commitment_point(byte[] val) { - bindings.AcceptChannel_set_first_per_commitment_point(this.ptr, val); + bindings.AcceptChannel_set_first_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33)); + } + + long clone_ptr() { + long ret = bindings.AcceptChannel_clone_ptr(this.ptr); + return ret; } /** @@ -233,7 +239,8 @@ public class AcceptChannel extends CommonBase { */ public AcceptChannel clone() { long ret = bindings.AcceptChannel_clone(this.ptr); - AcceptChannel ret_hu_conv = new AcceptChannel(null, ret); + if (ret >= 0 && ret <= 4096) { return null; } + AcceptChannel ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new AcceptChannel(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -249,8 +256,9 @@ public class AcceptChannel extends CommonBase { /** * Read a AcceptChannel from a byte array, created by AcceptChannel_write */ - public static Result_AcceptChannelDecodeErrorZ constructor_read(byte[] ser) { + public static Result_AcceptChannelDecodeErrorZ read(byte[] ser) { long ret = bindings.AcceptChannel_read(ser); + if (ret >= 0 && ret <= 4096) { return null; } Result_AcceptChannelDecodeErrorZ ret_hu_conv = Result_AcceptChannelDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; }