if (raw_val.getClass() == bindings.LDKSendError.InvalidFirstHop.class) {
return new InvalidFirstHop(ptr, (bindings.LDKSendError.InvalidFirstHop)raw_val);
}
+ if (raw_val.getClass() == bindings.LDKSendError.InvalidMessage.class) {
+ return new InvalidMessage(ptr, (bindings.LDKSendError.InvalidMessage)raw_val);
+ }
if (raw_val.getClass() == bindings.LDKSendError.BufferFull.class) {
return new BufferFull(ptr, (bindings.LDKSendError.BufferFull)raw_val);
}
+ if (raw_val.getClass() == bindings.LDKSendError.GetNodeIdFailed.class) {
+ return new GetNodeIdFailed(ptr, (bindings.LDKSendError.GetNodeIdFailed)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKSendError.BlindedPathAdvanceFailed.class) {
+ return new BlindedPathAdvanceFailed(ptr, (bindings.LDKSendError.BlindedPathAdvanceFailed)raw_val);
+ }
assert false; return null; // Unreachable without extending the (internal) bindings interface
}
}
}
/**
- * The provided [`Destination`] was an invalid [`BlindedRoute`], 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) {
super(null, ptr);
}
}
+ /**
+ * Onion message contents must have a TLV type >= 64.
+ */
+ public final static class InvalidMessage extends SendError {
+ private InvalidMessage(long ptr, bindings.LDKSendError.InvalidMessage obj) {
+ super(null, ptr);
+ }
+ }
/**
* Our next-hop peer's buffer was full or our total outbound buffer was full.
*/
super(null, ptr);
}
}
+ /**
+ * Failed to retrieve our node id from the provided [`NodeSigner`].
+ *
+ * [`NodeSigner`]: crate::sign::NodeSigner
+ */
+ public final static class GetNodeIdFailed extends SendError {
+ private GetNodeIdFailed(long ptr, bindings.LDKSendError.GetNodeIdFailed 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
+ * [`NodeSigner::ecdh`] failed, we failed to tweak the current blinding point to get the
+ * new blinding point, or we were attempting to send to ourselves.
+ */
+ public final static class BlindedPathAdvanceFailed extends SendError {
+ private BlindedPathAdvanceFailed(long ptr, bindings.LDKSendError.BlindedPathAdvanceFailed obj) {
+ super(null, ptr);
+ }
+ }
long clone_ptr() {
long ret = bindings.SendError_clone_ptr(this.ptr);
Reference.reachabilityFence(this);
return ret_hu_conv;
}
+ /**
+ * Utility method to constructs a new InvalidMessage-variant SendError
+ */
+ public static SendError invalid_message() {
+ long ret = bindings.SendError_invalid_message();
+ 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 BufferFull-variant SendError
*/
return ret_hu_conv;
}
+ /**
+ * Utility method to constructs a new GetNodeIdFailed-variant SendError
+ */
+ public static SendError get_node_id_failed() {
+ long ret = bindings.SendError_get_node_id_failed();
+ 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
+ */
+ public static SendError blinded_path_advance_failed() {
+ long ret = bindings.SendError_blinded_path_advance_failed();
+ 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;
+ }
+
+ /**
+ * 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);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(b);
+ return ret;
+ }
+
+ @Override public boolean equals(Object o) {
+ if (!(o instanceof SendError)) return false;
+ return this.eq((SendError)o);
+ }
}