X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FWatch.java;h=0aa8e92a5b3ddc731769949f55820e6fd080bf7d;hb=13cdf8bde340072288b39a5e29f0946d3e095ad4;hp=8888d28d42d2e973054a933dd9b9404858226b7e;hpb=9aa1eebc40df06586c7ab12f7c8eb22ebcb8b365;p=ldk-java diff --git a/src/main/java/org/ldk/structs/Watch.java b/src/main/java/org/ldk/structs/Watch.java index 8888d28d..0aa8e92a 100644 --- a/src/main/java/org/ldk/structs/Watch.java +++ b/src/main/java/org/ldk/structs/Watch.java @@ -78,16 +78,16 @@ public class Watch extends CommonBase { * For details on asynchronous [`ChannelMonitor`] updating and returning * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`]. */ - MonitorEvent[] release_pending_monitor_events(); + ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ[] release_pending_monitor_events(); } private static class LDKWatchHolder { Watch held; } public static Watch new_impl(WatchInterface arg) { final LDKWatchHolder impl_holder = new LDKWatchHolder(); impl_holder.held = new Watch(new bindings.LDKWatch() { @Override public long watch_channel(long funding_txo, long monitor) { - OutPoint funding_txo_hu_conv = null; if (funding_txo < 0 || funding_txo > 4096) { funding_txo_hu_conv = new OutPoint(null, funding_txo); } + org.ldk.structs.OutPoint funding_txo_hu_conv = null; if (funding_txo < 0 || funding_txo > 4096) { funding_txo_hu_conv = new org.ldk.structs.OutPoint(null, funding_txo); } funding_txo_hu_conv.ptrs_to.add(this); - ChannelMonitor monitor_hu_conv = null; if (monitor < 0 || monitor > 4096) { monitor_hu_conv = new ChannelMonitor(null, monitor); } + org.ldk.structs.ChannelMonitor monitor_hu_conv = null; if (monitor < 0 || monitor > 4096) { monitor_hu_conv = new org.ldk.structs.ChannelMonitor(null, monitor); } monitor_hu_conv.ptrs_to.add(this); Result_NoneChannelMonitorUpdateErrZ ret = arg.watch_channel(funding_txo_hu_conv, monitor_hu_conv); Reference.reachabilityFence(arg); @@ -95,9 +95,9 @@ public class Watch extends CommonBase { return result; } @Override public long update_channel(long funding_txo, long update) { - OutPoint funding_txo_hu_conv = null; if (funding_txo < 0 || funding_txo > 4096) { funding_txo_hu_conv = new OutPoint(null, funding_txo); } + org.ldk.structs.OutPoint funding_txo_hu_conv = null; if (funding_txo < 0 || funding_txo > 4096) { funding_txo_hu_conv = new org.ldk.structs.OutPoint(null, funding_txo); } funding_txo_hu_conv.ptrs_to.add(this); - ChannelMonitorUpdate update_hu_conv = null; if (update < 0 || update > 4096) { update_hu_conv = new ChannelMonitorUpdate(null, update); } + org.ldk.structs.ChannelMonitorUpdate update_hu_conv = null; if (update < 0 || update > 4096) { update_hu_conv = new org.ldk.structs.ChannelMonitorUpdate(null, update); } update_hu_conv.ptrs_to.add(this); Result_NoneChannelMonitorUpdateErrZ ret = arg.update_channel(funding_txo_hu_conv, update_hu_conv); Reference.reachabilityFence(arg); @@ -105,9 +105,9 @@ public class Watch extends CommonBase { return result; } @Override public long[] release_pending_monitor_events() { - MonitorEvent[] ret = arg.release_pending_monitor_events(); + ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ[] ret = arg.release_pending_monitor_events(); Reference.reachabilityFence(arg); - long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_14 -> ret_conv_14 == null ? 0 : ret_conv_14.clone_ptr()).toArray() : null; + long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_49 -> ret_conv_49 == null ? 0 : ret_conv_49.clone_ptr()).toArray() : null; return result; } }); @@ -128,12 +128,14 @@ public class Watch extends CommonBase { * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected */ public Result_NoneChannelMonitorUpdateErrZ watch_channel(OutPoint funding_txo, ChannelMonitor monitor) { - long ret = bindings.Watch_watch_channel(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1, monitor == null ? 0 : monitor.ptr & ~1); + long ret = bindings.Watch_watch_channel(this.ptr, funding_txo == null ? 0 : funding_txo.ptr, monitor == null ? 0 : monitor.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(funding_txo); Reference.reachabilityFence(monitor); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneChannelMonitorUpdateErrZ ret_hu_conv = Result_NoneChannelMonitorUpdateErrZ.constr_from_ptr(ret); + this.ptrs_to.add(funding_txo); + this.ptrs_to.add(monitor); return ret_hu_conv; } @@ -146,12 +148,14 @@ public class Watch extends CommonBase { * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor */ public Result_NoneChannelMonitorUpdateErrZ update_channel(OutPoint funding_txo, ChannelMonitorUpdate update) { - long ret = bindings.Watch_update_channel(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1, update == null ? 0 : update.ptr & ~1); + long ret = bindings.Watch_update_channel(this.ptr, funding_txo == null ? 0 : funding_txo.ptr, update == null ? 0 : update.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(funding_txo); Reference.reachabilityFence(update); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneChannelMonitorUpdateErrZ ret_hu_conv = Result_NoneChannelMonitorUpdateErrZ.constr_from_ptr(ret); + this.ptrs_to.add(funding_txo); + this.ptrs_to.add(update); return ret_hu_conv; } @@ -166,18 +170,18 @@ public class Watch extends CommonBase { * For details on asynchronous [`ChannelMonitor`] updating and returning * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`]. */ - public MonitorEvent[] release_pending_monitor_events() { + public ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ[] release_pending_monitor_events() { long[] ret = bindings.Watch_release_pending_monitor_events(this.ptr); Reference.reachabilityFence(this); - int ret_conv_14_len = ret.length; - MonitorEvent[] ret_conv_14_arr = new MonitorEvent[ret_conv_14_len]; - for (int o = 0; o < ret_conv_14_len; o++) { - long ret_conv_14 = ret[o]; - org.ldk.structs.MonitorEvent ret_conv_14_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret_conv_14); - ret_conv_14_hu_conv.ptrs_to.add(this); - ret_conv_14_arr[o] = ret_conv_14_hu_conv; + int ret_conv_49_len = ret.length; + ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ[] ret_conv_49_arr = new ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ[ret_conv_49_len]; + for (int x = 0; x < ret_conv_49_len; x++) { + long ret_conv_49 = ret[x]; + ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_hu_conv = new ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ(null, ret_conv_49); + ret_conv_49_hu_conv.ptrs_to.add(this); + ret_conv_49_arr[x] = ret_conv_49_hu_conv; } - return ret_conv_14_arr; + return ret_conv_49_arr; } }