X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FMonitorEvent.java;h=5ba0cc37f2b87fa30d87994a1aeafae2fd9e7926;hb=d2925e24ac4643ec22eb73495f0424e27def2545;hp=da40b184d900a8d90979bfa5e506dd087a2eab34;hpb=99d1a3bd6dc5c7ed1499b30bfc2b4c66ffaf858a;p=ldk-java diff --git a/src/main/java/org/ldk/structs/MonitorEvent.java b/src/main/java/org/ldk/structs/MonitorEvent.java index da40b184..5ba0cc37 100644 --- a/src/main/java/org/ldk/structs/MonitorEvent.java +++ b/src/main/java/org/ldk/structs/MonitorEvent.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; @@ -35,6 +36,9 @@ public class MonitorEvent extends CommonBase { assert false; return null; // Unreachable without extending the (internal) bindings interface } + /** + * A monitor event containing an HTLCUpdate. + */ public final static class HTLCEvent extends MonitorEvent { public final HTLCUpdate htlc_event; private HTLCEvent(long ptr, bindings.LDKMonitorEvent.HTLCEvent obj) { @@ -45,6 +49,9 @@ public class MonitorEvent extends CommonBase { this.htlc_event = htlc_event_hu_conv; } } + /** + * A monitor event that the Channel's commitment transaction was confirmed. + */ public final static class CommitmentTxConfirmed extends MonitorEvent { public final OutPoint commitment_tx_confirmed; private CommitmentTxConfirmed(long ptr, bindings.LDKMonitorEvent.CommitmentTxConfirmed obj) { @@ -55,6 +62,12 @@ public class MonitorEvent extends CommonBase { this.commitment_tx_confirmed = commitment_tx_confirmed_hu_conv; } } + /** + * Indicates a [`ChannelMonitor`] update has completed. See + * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used. + * + * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure + */ public final static class UpdateCompleted extends MonitorEvent { /** * The funding outpoint of the [`ChannelMonitor`] that was updated @@ -77,6 +90,12 @@ public class MonitorEvent extends CommonBase { this.monitor_update_id = obj.monitor_update_id; } } + /** + * Indicates a [`ChannelMonitor`] update has failed. See + * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used. + * + * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure + */ public final static class UpdateFailed extends MonitorEvent { public final OutPoint update_failed; private UpdateFailed(long ptr, bindings.LDKMonitorEvent.UpdateFailed obj) { @@ -87,11 +106,18 @@ public class MonitorEvent extends CommonBase { this.update_failed = update_failed_hu_conv; } } + long clone_ptr() { + long ret = bindings.MonitorEvent_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Creates a copy of the MonitorEvent */ public MonitorEvent clone() { long ret = bindings.MonitorEvent_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -103,6 +129,7 @@ public class MonitorEvent extends CommonBase { */ public static MonitorEvent htlcevent(HTLCUpdate a) { long ret = bindings.MonitorEvent_htlcevent(a == null ? 0 : a.ptr & ~1); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -114,6 +141,7 @@ public class MonitorEvent extends CommonBase { */ public static MonitorEvent commitment_tx_confirmed(OutPoint a) { long ret = bindings.MonitorEvent_commitment_tx_confirmed(a == null ? 0 : a.ptr & ~1); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -125,6 +153,8 @@ public class MonitorEvent extends CommonBase { */ public static MonitorEvent update_completed(OutPoint funding_txo, long monitor_update_id) { long ret = bindings.MonitorEvent_update_completed(funding_txo == null ? 0 : funding_txo.ptr & ~1, monitor_update_id); + Reference.reachabilityFence(funding_txo); + Reference.reachabilityFence(monitor_update_id); if (ret >= 0 && ret <= 4096) { return null; } MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -136,6 +166,7 @@ public class MonitorEvent extends CommonBase { */ public static MonitorEvent update_failed(OutPoint a) { long ret = bindings.MonitorEvent_update_failed(a == null ? 0 : a.ptr & ~1); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -147,6 +178,7 @@ public class MonitorEvent extends CommonBase { */ public byte[] write() { byte[] ret = bindings.MonitorEvent_write(this.ptr); + Reference.reachabilityFence(this); return ret; }