X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FSendError.java;h=295b29cb49409a6cab7e5f4430d1ab7ee6ba99b4;hb=ffdd56c967087cba7548599934585b8a9a3102e2;hp=543ba0dc767ae3de816c1de8268bd0c1faa03497;hpb=eab9331afd014558a982441138e222999a9955d1;p=ldk-java diff --git a/src/main/java/org/ldk/structs/SendError.java b/src/main/java/org/ldk/structs/SendError.java index 543ba0dc..295b29cb 100644 --- a/src/main/java/org/ldk/structs/SendError.java +++ b/src/main/java/org/ldk/structs/SendError.java @@ -35,6 +35,9 @@ public class SendError extends CommonBase { if (raw_val.getClass() == bindings.LDKSendError.InvalidFirstHop.class) { return new InvalidFirstHop(ptr, (bindings.LDKSendError.InvalidFirstHop)raw_val); } + if (raw_val.getClass() == bindings.LDKSendError.PathNotFound.class) { + return new PathNotFound(ptr, (bindings.LDKSendError.PathNotFound)raw_val); + } if (raw_val.getClass() == bindings.LDKSendError.InvalidMessage.class) { return new InvalidMessage(ptr, (bindings.LDKSendError.InvalidMessage)raw_val); } @@ -44,6 +47,9 @@ public class SendError extends CommonBase { if (raw_val.getClass() == bindings.LDKSendError.GetNodeIdFailed.class) { return new GetNodeIdFailed(ptr, (bindings.LDKSendError.GetNodeIdFailed)raw_val); } + if (raw_val.getClass() == bindings.LDKSendError.UnresolvedIntroductionNode.class) { + return new UnresolvedIntroductionNode(ptr, (bindings.LDKSendError.UnresolvedIntroductionNode)raw_val); + } if (raw_val.getClass() == bindings.LDKSendError.BlindedPathAdvanceFailed.class) { return new BlindedPathAdvanceFailed(ptr, (bindings.LDKSendError.BlindedPathAdvanceFailed)raw_val); } @@ -70,8 +76,8 @@ public class SendError extends CommonBase { } } /** - * The provided [`Destination`] was an invalid [`BlindedPath`], due to having fewer than two - * blinded hops. + * The provided [`Destination`] was an invalid [`BlindedPath`] due to not having any blinded + * hops. */ public final static class TooFewBlindedHops extends SendError { private TooFewBlindedHops(long ptr, bindings.LDKSendError.TooFewBlindedHops obj) { @@ -79,11 +85,21 @@ public class SendError extends CommonBase { } } /** - * Our next-hop peer was offline or does not support onion message forwarding. + * The first hop is not a peer and doesn't have a known [`SocketAddress`]. */ public final static class InvalidFirstHop extends SendError { + public final byte[] invalid_first_hop; private InvalidFirstHop(long ptr, bindings.LDKSendError.InvalidFirstHop obj) { super(null, ptr); + this.invalid_first_hop = obj.invalid_first_hop; + } + } + /** + * A path from the sender to the destination could not be found by the [`MessageRouter`]. + */ + public final static class PathNotFound extends SendError { + private PathNotFound(long ptr, bindings.LDKSendError.PathNotFound obj) { + super(null, ptr); } } /** @@ -105,13 +121,23 @@ public class SendError extends CommonBase { /** * Failed to retrieve our node id from the provided [`NodeSigner`]. * - * [`NodeSigner`]: crate::chain::keysinterface::NodeSigner + * [`NodeSigner`]: crate::sign::NodeSigner */ public final static class GetNodeIdFailed extends SendError { private GetNodeIdFailed(long ptr, bindings.LDKSendError.GetNodeIdFailed obj) { super(null, ptr); } } + /** + * The provided [`Destination`] has a blinded path with an unresolved introduction node. An + * attempt to resolve it in the [`MessageRouter`] when finding an [`OnionMessagePath`] likely + * failed. + */ + public final static class UnresolvedIntroductionNode extends SendError { + private UnresolvedIntroductionNode(long ptr, bindings.LDKSendError.UnresolvedIntroductionNode obj) { + super(null, ptr); + } + } /** * We attempted to send to a blinded path where we are the introduction node, and failed to * advance the blinded path to make the second hop the new introduction node. Either @@ -178,8 +204,20 @@ public class SendError extends CommonBase { /** * Utility method to constructs a new InvalidFirstHop-variant SendError */ - public static SendError invalid_first_hop() { - long ret = bindings.SendError_invalid_first_hop(); + public static SendError invalid_first_hop(byte[] a) { + long ret = bindings.SendError_invalid_first_hop(InternalUtils.check_arr_len(a, 33)); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.SendError ret_hu_conv = org.ldk.structs.SendError.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new PathNotFound-variant SendError + */ + public static SendError path_not_found() { + long ret = bindings.SendError_path_not_found(); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.SendError ret_hu_conv = org.ldk.structs.SendError.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; @@ -219,6 +257,17 @@ public class SendError extends CommonBase { return ret_hu_conv; } + /** + * Utility method to constructs a new UnresolvedIntroductionNode-variant SendError + */ + public static SendError unresolved_introduction_node() { + long ret = bindings.SendError_unresolved_introduction_node(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.SendError ret_hu_conv = org.ldk.structs.SendError.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + /** * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError */ @@ -230,12 +279,24 @@ public class SendError extends CommonBase { return ret_hu_conv; } + /** + * Generates a non-cryptographic 64-bit hash of the SendError. + */ + public long hash() { + long ret = bindings.SendError_hash(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two SendErrors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. */ public boolean eq(org.ldk.structs.SendError b) { - boolean ret = bindings.SendError_eq(this.ptr, b == null ? 0 : b.ptr); + boolean ret = bindings.SendError_eq(this.ptr, b.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(b); return ret;