projects
/
ldk-java
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[Java] Handle nullable arrays
[ldk-java]
/
src
/
main
/
java
/
org
/
ldk
/
structs
/
MonitorEvent.java
diff --git
a/src/main/java/org/ldk/structs/MonitorEvent.java
b/src/main/java/org/ldk/structs/MonitorEvent.java
index 38a63b38a112bf8a488127346129cd09bdd5976b..87da2ac80df1d522787f8f27b801295d944771c9 100644
(file)
--- 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 org.ldk.enums.*;
import org.ldk.util.*;
import java.util.Arrays;
+import java.lang.ref.Reference;
import javax.annotation.Nullable;
import javax.annotation.Nullable;
@@
-39,12
+40,12
@@
public class MonitorEvent extends CommonBase {
* A monitor event containing an HTLCUpdate.
*/
public final static class HTLCEvent extends MonitorEvent {
* A monitor event containing an HTLCUpdate.
*/
public final static class HTLCEvent extends MonitorEvent {
- public final HTLCUpdate htlc_event;
+ public final
org.ldk.structs.
HTLCUpdate htlc_event;
private HTLCEvent(long ptr, bindings.LDKMonitorEvent.HTLCEvent obj) {
super(null, ptr);
long htlc_event = obj.htlc_event;
private HTLCEvent(long ptr, bindings.LDKMonitorEvent.HTLCEvent obj) {
super(null, ptr);
long htlc_event = obj.htlc_event;
-
HTLCUpdate htlc_event_hu_conv = null; if (htlc_event < 0 || htlc_event > 4096) { htlc_event_hu_conv = new
HTLCUpdate(null, htlc_event); }
-
htlc_event_hu_conv.ptrs_to.add(this)
;
+
org.ldk.structs.HTLCUpdate htlc_event_hu_conv = null; if (htlc_event < 0 || htlc_event > 4096) { htlc_event_hu_conv = new org.ldk.structs.
HTLCUpdate(null, htlc_event); }
+
if (htlc_event_hu_conv != null) { htlc_event_hu_conv.ptrs_to.add(this); }
;
this.htlc_event = htlc_event_hu_conv;
}
}
this.htlc_event = htlc_event_hu_conv;
}
}
@@
-52,12
+53,12
@@
public class MonitorEvent extends CommonBase {
* A monitor event that the Channel's commitment transaction was confirmed.
*/
public final static class CommitmentTxConfirmed extends MonitorEvent {
* A monitor event that the Channel's commitment transaction was confirmed.
*/
public final static class CommitmentTxConfirmed extends MonitorEvent {
- public final OutPoint commitment_tx_confirmed;
+ public final
org.ldk.structs.
OutPoint commitment_tx_confirmed;
private CommitmentTxConfirmed(long ptr, bindings.LDKMonitorEvent.CommitmentTxConfirmed obj) {
super(null, ptr);
long commitment_tx_confirmed = obj.commitment_tx_confirmed;
private CommitmentTxConfirmed(long ptr, bindings.LDKMonitorEvent.CommitmentTxConfirmed obj) {
super(null, ptr);
long commitment_tx_confirmed = obj.commitment_tx_confirmed;
-
OutPoint commitment_tx_confirmed_hu_conv = null; if (commitment_tx_confirmed < 0 || commitment_tx_confirmed > 4096) { commitment_tx_confirmed_hu_conv = new
OutPoint(null, commitment_tx_confirmed); }
-
commitment_tx_confirmed_hu_conv.ptrs_to.add(this)
;
+
org.ldk.structs.OutPoint commitment_tx_confirmed_hu_conv = null; if (commitment_tx_confirmed < 0 || commitment_tx_confirmed > 4096) { commitment_tx_confirmed_hu_conv = new org.ldk.structs.
OutPoint(null, commitment_tx_confirmed); }
+
if (commitment_tx_confirmed_hu_conv != null) { commitment_tx_confirmed_hu_conv.ptrs_to.add(this); }
;
this.commitment_tx_confirmed = commitment_tx_confirmed_hu_conv;
}
}
this.commitment_tx_confirmed = commitment_tx_confirmed_hu_conv;
}
}
@@
-71,7
+72,7
@@
public class MonitorEvent extends CommonBase {
/**
* The funding outpoint of the [`ChannelMonitor`] that was updated
*/
/**
* The funding outpoint of the [`ChannelMonitor`] that was updated
*/
- public final OutPoint funding_txo;
+ public final
org.ldk.structs.
OutPoint funding_txo;
/**
* The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
* [`ChannelMonitor::get_latest_update_id`].
/**
* The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
* [`ChannelMonitor::get_latest_update_id`].
@@
-83,8
+84,8
@@
public class MonitorEvent extends CommonBase {
private UpdateCompleted(long ptr, bindings.LDKMonitorEvent.UpdateCompleted obj) {
super(null, ptr);
long funding_txo = obj.funding_txo;
private UpdateCompleted(long ptr, bindings.LDKMonitorEvent.UpdateCompleted obj) {
super(null, ptr);
long funding_txo = obj.funding_txo;
-
OutPoint funding_txo_hu_conv = null; if (funding_txo < 0 || funding_txo > 4096) { funding_txo_hu_conv = new
OutPoint(null, funding_txo); }
-
funding_txo_hu_conv.ptrs_to.add(this)
;
+
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); }
+
if (funding_txo_hu_conv != null) { funding_txo_hu_conv.ptrs_to.add(this); }
;
this.funding_txo = funding_txo_hu_conv;
this.monitor_update_id = obj.monitor_update_id;
}
this.funding_txo = funding_txo_hu_conv;
this.monitor_update_id = obj.monitor_update_id;
}
@@
-96,17
+97,18
@@
public class MonitorEvent extends CommonBase {
* [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
*/
public final static class UpdateFailed extends MonitorEvent {
* [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
*/
public final static class UpdateFailed extends MonitorEvent {
- public final OutPoint update_failed;
+ public final
org.ldk.structs.
OutPoint update_failed;
private UpdateFailed(long ptr, bindings.LDKMonitorEvent.UpdateFailed obj) {
super(null, ptr);
long update_failed = obj.update_failed;
private UpdateFailed(long ptr, bindings.LDKMonitorEvent.UpdateFailed obj) {
super(null, ptr);
long update_failed = obj.update_failed;
-
OutPoint update_failed_hu_conv = null; if (update_failed < 0 || update_failed > 4096) { update_failed_hu_conv = new
OutPoint(null, update_failed); }
-
update_failed_hu_conv.ptrs_to.add(this)
;
+
org.ldk.structs.OutPoint update_failed_hu_conv = null; if (update_failed < 0 || update_failed > 4096) { update_failed_hu_conv = new org.ldk.structs.
OutPoint(null, update_failed); }
+
if (update_failed_hu_conv != null) { update_failed_hu_conv.ptrs_to.add(this); }
;
this.update_failed = update_failed_hu_conv;
}
}
long clone_ptr() {
long ret = bindings.MonitorEvent_clone_ptr(this.ptr);
this.update_failed = update_failed_hu_conv;
}
}
long clone_ptr() {
long ret = bindings.MonitorEvent_clone_ptr(this.ptr);
+ Reference.reachabilityFence(this);
return ret;
}
return ret;
}
@@
-115,9
+117,10
@@
public class MonitorEvent extends CommonBase {
*/
public MonitorEvent clone() {
long ret = bindings.MonitorEvent_clone(this.ptr);
*/
public MonitorEvent clone() {
long ret = bindings.MonitorEvent_clone(this.ptr);
+ Reference.reachabilityFence(this);
if (ret >= 0 && ret <= 4096) { return null; }
if (ret >= 0 && ret <= 4096) { return null; }
-
MonitorEvent ret_hu_conv =
MonitorEvent.constr_from_ptr(ret);
-
ret_hu_conv.ptrs_to.add(this)
;
+
org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.
MonitorEvent.constr_from_ptr(ret);
+
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }
;
return ret_hu_conv;
}
return ret_hu_conv;
}
@@
-125,10
+128,12
@@
public class MonitorEvent extends CommonBase {
* Utility method to constructs a new HTLCEvent-variant MonitorEvent
*/
public static MonitorEvent htlcevent(HTLCUpdate a) {
* Utility method to constructs a new HTLCEvent-variant MonitorEvent
*/
public static MonitorEvent htlcevent(HTLCUpdate a) {
- long ret = bindings.MonitorEvent_htlcevent(a == null ? 0 : a.ptr & ~1);
+ long ret = bindings.MonitorEvent_htlcevent(a == null ? 0 : a.ptr);
+ Reference.reachabilityFence(a);
if (ret >= 0 && ret <= 4096) { return null; }
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);
+ org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); };
return ret_hu_conv;
}
return ret_hu_conv;
}
@@
-136,10
+141,12
@@
public class MonitorEvent extends CommonBase {
* Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
*/
public static MonitorEvent commitment_tx_confirmed(OutPoint a) {
* Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
*/
public static MonitorEvent commitment_tx_confirmed(OutPoint a) {
- long ret = bindings.MonitorEvent_commitment_tx_confirmed(a == null ? 0 : a.ptr & ~1);
+ long ret = bindings.MonitorEvent_commitment_tx_confirmed(a == null ? 0 : a.ptr);
+ Reference.reachabilityFence(a);
if (ret >= 0 && ret <= 4096) { return null; }
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);
+ org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); };
return ret_hu_conv;
}
return ret_hu_conv;
}
@@
-147,10
+154,13
@@
public class MonitorEvent extends CommonBase {
* Utility method to constructs a new UpdateCompleted-variant MonitorEvent
*/
public static MonitorEvent update_completed(OutPoint funding_txo, long monitor_update_id) {
* Utility method to constructs a new UpdateCompleted-variant MonitorEvent
*/
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);
+ long ret = bindings.MonitorEvent_update_completed(funding_txo == null ? 0 : funding_txo.ptr, monitor_update_id);
+ Reference.reachabilityFence(funding_txo);
+ Reference.reachabilityFence(monitor_update_id);
if (ret >= 0 && ret <= 4096) { return null; }
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);
+ org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_txo); };
return ret_hu_conv;
}
return ret_hu_conv;
}
@@
-158,10
+168,12
@@
public class MonitorEvent extends CommonBase {
* Utility method to constructs a new UpdateFailed-variant MonitorEvent
*/
public static MonitorEvent update_failed(OutPoint a) {
* Utility method to constructs a new UpdateFailed-variant MonitorEvent
*/
public static MonitorEvent update_failed(OutPoint a) {
- long ret = bindings.MonitorEvent_update_failed(a == null ? 0 : a.ptr & ~1);
+ long ret = bindings.MonitorEvent_update_failed(a == null ? 0 : a.ptr);
+ Reference.reachabilityFence(a);
if (ret >= 0 && ret <= 4096) { return null; }
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);
+ org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); };
return ret_hu_conv;
}
return ret_hu_conv;
}
@@
-170,6
+182,7
@@
public class MonitorEvent extends CommonBase {
*/
public byte[] write() {
byte[] ret = bindings.MonitorEvent_write(this.ptr);
*/
public byte[] write() {
byte[] ret = bindings.MonitorEvent_write(this.ptr);
+ Reference.reachabilityFence(this);
return ret;
}
return ret;
}