X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FDataLossProtect.java;h=2b68a20a0cdc9c1a80cc3b7d969dcac97eca16d5;hb=5e9de82b3a7712a41189756d9d16d946142b2ac5;hp=28d1374160a56016977e582e22fe4e436eee44e1;hpb=2a8741cb87eb2b82381a6220a98f80f741147837;p=ldk-java diff --git a/src/main/java/org/ldk/structs/DataLossProtect.java b/src/main/java/org/ldk/structs/DataLossProtect.java index 28d13741..2b68a20a 100644 --- a/src/main/java/org/ldk/structs/DataLossProtect.java +++ b/src/main/java/org/ldk/structs/DataLossProtect.java @@ -70,7 +70,7 @@ public class DataLossProtect extends CommonBase { Reference.reachabilityFence(my_current_per_commitment_point_arg); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.DataLossProtect ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DataLossProtect(null, ret); } - ret_hu_conv.ptrs_to.add(ret_hu_conv); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; return ret_hu_conv; } @@ -88,8 +88,25 @@ public class DataLossProtect extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.DataLossProtect ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DataLossProtect(null, ret); } - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } + /** + * Checks if two DataLossProtects contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ + public boolean eq(DataLossProtect b) { + boolean ret = bindings.DataLossProtect_eq(this.ptr, b == null ? 0 : b.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); + if (this != null) { this.ptrs_to.add(b); }; + return ret; + } + + @Override public boolean equals(Object o) { + if (!(o instanceof DataLossProtect)) return false; + return this.eq((DataLossProtect)o); + } }