X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FAccess.java;h=a244405e27a95fdab3e93194f0afd5009a978c2e;hb=6fe917116a65d7b62123226c4240d77ea2719783;hp=b52d295c9cd8d075e4f0bb1ce3037c1c47e6dedf;hpb=ba1af51214a8ea2de62b84cd23b6145173c71752;p=ldk-java diff --git a/src/main/java/org/ldk/structs/Access.java b/src/main/java/org/ldk/structs/Access.java index b52d295c..a244405e 100644 --- a/src/main/java/org/ldk/structs/Access.java +++ b/src/main/java/org/ldk/structs/Access.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; /** @@ -40,7 +41,8 @@ public class Access extends CommonBase { impl_holder.held = new Access(new bindings.LDKAccess() { @Override public long get_utxo(byte[] genesis_hash, long short_channel_id) { Result_TxOutAccessErrorZ ret = arg.get_utxo(genesis_hash, short_channel_id); - long result = ret != null ? ret.ptr : 0; + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); return result; } }); @@ -54,8 +56,11 @@ public class Access extends CommonBase { * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id */ public Result_TxOutAccessErrorZ get_utxo(byte[] genesis_hash, long short_channel_id) { - long ret = bindings.Access_get_utxo(this.ptr, genesis_hash, short_channel_id); - if (ret < 1024) { return null; } + long ret = bindings.Access_get_utxo(this.ptr, InternalUtils.check_arr_len(genesis_hash, 32), short_channel_id); + Reference.reachabilityFence(this); + Reference.reachabilityFence(genesis_hash); + Reference.reachabilityFence(short_channel_id); + if (ret >= 0 && ret <= 4096) { return null; } Result_TxOutAccessErrorZ ret_hu_conv = Result_TxOutAccessErrorZ.constr_from_ptr(ret); return ret_hu_conv; }