X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FSignedRawInvoice.java;h=b8e833004de65dce5f5afaf4de114b871b5050dc;hb=5e9de82b3a7712a41189756d9d16d946142b2ac5;hp=5325d42fe65fc80de3d3d748dd345dc1aacee5d1;hpb=9aa1eebc40df06586c7ab12f7c8eb22ebcb8b365;p=ldk-java diff --git a/src/main/java/org/ldk/structs/SignedRawInvoice.java b/src/main/java/org/ldk/structs/SignedRawInvoice.java index 5325d42f..b8e83300 100644 --- a/src/main/java/org/ldk/structs/SignedRawInvoice.java +++ b/src/main/java/org/ldk/structs/SignedRawInvoice.java @@ -30,10 +30,10 @@ public class SignedRawInvoice extends CommonBase { * Two objects with NULL inner values will be considered "equal" here. */ public boolean eq(SignedRawInvoice b) { - boolean ret = bindings.SignedRawInvoice_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + boolean ret = bindings.SignedRawInvoice_eq(this.ptr, b == null ? 0 : b.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(b); - this.ptrs_to.add(b); + if (this != null) { this.ptrs_to.add(b); }; return ret; } @@ -54,11 +54,23 @@ public class SignedRawInvoice extends CommonBase { long ret = bindings.SignedRawInvoice_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - SignedRawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new SignedRawInvoice(null, ret); } - ret_hu_conv.ptrs_to.add(this); + org.ldk.structs.SignedRawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SignedRawInvoice(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } + /** + * Checks if two SignedRawInvoices contain equal inner contents. + */ + public long hash() { + long ret = bindings.SignedRawInvoice_hash(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + @Override public int hashCode() { + return (int)this.hash(); + } /** * Disassembles the `SignedRawInvoice` into its three parts: * 1. raw invoice @@ -70,8 +82,8 @@ public class SignedRawInvoice extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ThreeTuple_RawInvoice_u832InvoiceSignatureZ ret_hu_conv = new ThreeTuple_RawInvoice_u832InvoiceSignatureZ(null, ret); - ret_hu_conv.ptrs_to.add(this); - ; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + if (this != null) { this.ptrs_to.add(this); }; return ret_hu_conv; } @@ -82,16 +94,16 @@ public class SignedRawInvoice extends CommonBase { long ret = bindings.SignedRawInvoice_raw_invoice(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - RawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RawInvoice(null, ret); } - ret_hu_conv.ptrs_to.add(this); + org.ldk.structs.RawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RawInvoice(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } /** * The hash of the `RawInvoice` that was signed. */ - public byte[] hash() { - byte[] ret = bindings.SignedRawInvoice_hash(this.ptr); + public byte[] signable_hash() { + byte[] ret = bindings.SignedRawInvoice_signable_hash(this.ptr); Reference.reachabilityFence(this); return ret; } @@ -103,8 +115,8 @@ public class SignedRawInvoice extends CommonBase { long ret = bindings.SignedRawInvoice_signature(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - InvoiceSignature ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceSignature(null, ret); } - ret_hu_conv.ptrs_to.add(this); + org.ldk.structs.InvoiceSignature ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceSignature(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; }