X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FFilesystemPersister.java;h=118a806bad299ab2e7390b2283439fe7530547d7;hb=eab9331afd014558a982441138e222999a9955d1;hp=fe70a48428943f0e7a8ad9d75113ab761af7c4ca;hpb=db1a11032b4164540a2d3403696be12bbca70e94;p=ldk-java diff --git a/src/main/java/org/ldk/structs/FilesystemPersister.java b/src/main/java/org/ldk/structs/FilesystemPersister.java index fe70a484..118a806b 100644 --- a/src/main/java/org/ldk/structs/FilesystemPersister.java +++ b/src/main/java/org/ldk/structs/FilesystemPersister.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; @@ -36,9 +37,10 @@ public class FilesystemPersister extends CommonBase { */ public static FilesystemPersister of(java.lang.String path_to_channel_data) { long ret = bindings.FilesystemPersister_new(path_to_channel_data); - if (ret < 1024) { return null; } - FilesystemPersister ret_hu_conv = new FilesystemPersister(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); + Reference.reachabilityFence(path_to_channel_data); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.FilesystemPersister ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FilesystemPersister(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; return ret_hu_conv; } @@ -47,29 +49,22 @@ public class FilesystemPersister extends CommonBase { */ public String get_data_dir() { String ret = bindings.FilesystemPersister_get_data_dir(this.ptr); + Reference.reachabilityFence(this); return ret; } /** * Read `ChannelMonitor`s from disk. */ - public Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ read_channelmonitors(KeysInterface keys_manager) { - long ret = bindings.FilesystemPersister_read_channelmonitors(this.ptr, keys_manager == null ? 0 : keys_manager.ptr); - if (ret < 1024) { return null; } + public Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ read_channelmonitors(org.ldk.structs.EntropySource entropy_source, org.ldk.structs.SignerProvider signer_provider) { + long ret = bindings.FilesystemPersister_read_channelmonitors(this.ptr, entropy_source == null ? 0 : entropy_source.ptr, signer_provider == null ? 0 : signer_provider.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(entropy_source); + Reference.reachabilityFence(signer_provider); + if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret); - this.ptrs_to.add(keys_manager); - return ret_hu_conv; - } - - /** - * Constructs a new Persist which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is - */ - public Persist as_Persist() { - long ret = bindings.FilesystemPersister_as_Persist(this.ptr); - if (ret < 1024) { return null; } - Persist ret_hu_conv = new Persist(null, ret); - ret_hu_conv.ptrs_to.add(this); + if (this != null) { this.ptrs_to.add(entropy_source); }; + if (this != null) { this.ptrs_to.add(signer_provider); }; return ret_hu_conv; }