X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FPaymentError.java;h=8285238526249e3fc907af5d62d8dda44f5655d3;hb=519dc944de5b88f95975140a13fbc6d77dd15a95;hp=e4bc100abe14744f469a35eb7375fc213c289eb9;hpb=330ca992be304d0eac79bd59b411980dff294b03;p=ldk-java diff --git a/src/main/java/org/ldk/structs/PaymentError.java b/src/main/java/org/ldk/structs/PaymentError.java index e4bc100a..82852385 100644 --- a/src/main/java/org/ldk/structs/PaymentError.java +++ b/src/main/java/org/ldk/structs/PaymentError.java @@ -24,9 +24,6 @@ public class PaymentError extends CommonBase { if (raw_val.getClass() == bindings.LDKPaymentError.Invoice.class) { return new Invoice(ptr, (bindings.LDKPaymentError.Invoice)raw_val); } - if (raw_val.getClass() == bindings.LDKPaymentError.Routing.class) { - return new Routing(ptr, (bindings.LDKPaymentError.Routing)raw_val); - } if (raw_val.getClass() == bindings.LDKPaymentError.Sending.class) { return new Sending(ptr, (bindings.LDKPaymentError.Sending)raw_val); } @@ -34,7 +31,7 @@ public class PaymentError extends CommonBase { } /** - * An error resulting from the provided [`Invoice`] or payment hash. + * An error resulting from the provided [`Bolt11Invoice`] or payment hash. */ public final static class Invoice extends PaymentError { public final java.lang.String invoice; @@ -43,30 +40,14 @@ public class PaymentError extends CommonBase { this.invoice = obj.invoice; } } - /** - * An error occurring when finding a route. - */ - public final static class Routing extends PaymentError { - public final org.ldk.structs.LightningError routing; - private Routing(long ptr, bindings.LDKPaymentError.Routing obj) { - super(null, ptr); - long routing = obj.routing; - org.ldk.structs.LightningError routing_hu_conv = null; if (routing < 0 || routing > 4096) { routing_hu_conv = new org.ldk.structs.LightningError(null, routing); } - if (routing_hu_conv != null) { routing_hu_conv.ptrs_to.add(this); }; - this.routing = routing_hu_conv; - } - } /** * An error occurring when sending a payment. */ public final static class Sending extends PaymentError { - public final org.ldk.structs.PaymentSendFailure sending; + public final org.ldk.enums.RetryableSendFailure sending; private Sending(long ptr, bindings.LDKPaymentError.Sending obj) { super(null, ptr); - long sending = obj.sending; - org.ldk.structs.PaymentSendFailure sending_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(sending); - if (sending_hu_conv != null) { sending_hu_conv.ptrs_to.add(this); }; - this.sending = sending_hu_conv; + this.sending = obj.sending; } } long clone_ptr() { @@ -100,28 +81,30 @@ public class PaymentError extends CommonBase { } /** - * Utility method to constructs a new Routing-variant PaymentError + * Utility method to constructs a new Sending-variant PaymentError */ - public static PaymentError routing(org.ldk.structs.LightningError a) { - long ret = bindings.PaymentError_routing(a == null ? 0 : a.ptr); + public static PaymentError sending(org.ldk.enums.RetryableSendFailure a) { + long ret = bindings.PaymentError_sending(a); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.PaymentError ret_hu_conv = org.ldk.structs.PaymentError.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; } /** - * Utility method to constructs a new Sending-variant PaymentError + * Checks if two PaymentErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ - public static PaymentError sending(org.ldk.structs.PaymentSendFailure a) { - long ret = bindings.PaymentError_sending(a.ptr); - Reference.reachabilityFence(a); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.PaymentError ret_hu_conv = org.ldk.structs.PaymentError.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - return ret_hu_conv; + public boolean eq(org.ldk.structs.PaymentError b) { + boolean ret = bindings.PaymentError_eq(this.ptr, b == null ? 0 : b.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); + return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof PaymentError)) return false; + return this.eq((PaymentError)o); + } }