typedef struct nativeRouteHopOpaque LDKnativeRouteHop;
struct nativeRouteOpaque;
typedef struct nativeRouteOpaque LDKnativeRoute;
+struct nativeRouteHintOpaque;
+typedef struct nativeRouteHintOpaque LDKnativeRouteHint;
struct nativeRouteHintHopOpaque;
typedef struct nativeRouteHintHopOpaque LDKnativeRouteHintHop;
struct nativeWatchedOutputOpaque;
typedef struct nativeMinFinalCltvExpiryOpaque LDKnativeMinFinalCltvExpiry;
struct nativeInvoiceSignatureOpaque;
typedef struct nativeInvoiceSignatureOpaque LDKnativeInvoiceSignature;
-struct nativeRouteHintOpaque;
-typedef struct nativeRouteHintOpaque LDKnativeRouteHint;
+struct nativePrivateRouteOpaque;
+typedef struct nativePrivateRouteOpaque LDKnativePrivateRoute;
struct nativeChannelMonitorUpdateOpaque;
typedef struct nativeChannelMonitorUpdateOpaque LDKnativeChannelMonitorUpdate;
struct nativeMonitorUpdateErrorOpaque;
/**
- * A channel descriptor which provides a last-hop route to get_route
+ * A list of hops along a payment path terminating with a channel to the recipient.
*/
-typedef struct MUST_USE_STRUCT LDKRouteHintHop {
+typedef struct MUST_USE_STRUCT LDKRouteHint {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeRouteHintHop *inner;
+ LDKnativeRouteHint *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKRouteHintHop;
+} LDKRouteHint;
/**
- * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
+ * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
* This corresponds to std::vector in C++
*/
-typedef struct LDKCVec_RouteHintHopZ {
+typedef struct LDKCVec_RouteHintZ {
/**
* The elements in the array.
* If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKRouteHintHop *data;
+ struct LDKRouteHint *data;
/**
* The number of elements pointed to by `data`.
*/
uintptr_t datalen;
-} LDKCVec_RouteHintHopZ;
+} LDKCVec_RouteHintZ;
* The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
*
*/
-typedef struct MUST_USE_STRUCT LDKRouteHint {
+typedef struct MUST_USE_STRUCT LDKPrivateRoute {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeRouteHint *inner;
+ LDKnativePrivateRoute *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKRouteHint;
+} LDKPrivateRoute;
/**
- * A dynamically-allocated array of crate::lightning_invoice::RouteHints of arbitrary size.
+ * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
* This corresponds to std::vector in C++
*/
-typedef struct LDKCVec_RouteHintZ {
+typedef struct LDKCVec_PrivateRouteZ {
/**
* The elements in the array.
* If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKRouteHint *data;
+ struct LDKPrivateRoute *data;
/**
* The number of elements pointed to by `data`.
*/
uintptr_t datalen;
-} LDKCVec_RouteHintZ;
+} LDKCVec_PrivateRouteZ;
} LDKCResult_ExpiryTimeCreationErrorZ;
/**
- * The contents of CResult_RouteHintCreationErrorZ
+ * The contents of CResult_PrivateRouteCreationErrorZ
*/
-typedef union LDKCResult_RouteHintCreationErrorZPtr {
+typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKRouteHint *result;
+ struct LDKPrivateRoute *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
enum LDKCreationError *err;
-} LDKCResult_RouteHintCreationErrorZPtr;
+} LDKCResult_PrivateRouteCreationErrorZPtr;
/**
- * A CResult_RouteHintCreationErrorZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::RouteHint on success and a crate::lightning_invoice::CreationError on failure.
+ * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_RouteHintCreationErrorZ {
+typedef struct LDKCResult_PrivateRouteCreationErrorZ {
/**
- * The contents of this CResult_RouteHintCreationErrorZ, accessible via either
+ * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_RouteHintCreationErrorZPtr contents;
+ union LDKCResult_PrivateRouteCreationErrorZPtr contents;
/**
- * Whether this CResult_RouteHintCreationErrorZ represents a success state.
+ * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_RouteHintCreationErrorZ;
+} LDKCResult_PrivateRouteCreationErrorZ;
/**
* The contents of CResult_StringErrorZ
+/**
+ * A channel descriptor for a hop along a payment path.
+ */
+typedef struct MUST_USE_STRUCT LDKRouteHintHop {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeRouteHintHop *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKRouteHintHop;
+
+
+
/**
* A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
* This exists only to make accessing a RwLock<NetworkGraph> possible from
extern const uint8_t TAG_FALLBACK;
-extern const uint8_t TAG_ROUTE;
+extern const uint8_t TAG_PRIVATE_ROUTE;
extern const uint8_t TAG_PAYMENT_SECRET;
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
+void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
/**
* Creates a new CResult_RouteLightningErrorZ in the success state.
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
+void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
/**
* Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_RouteHintCreationErrorZ in the success state.
+ * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
*/
-struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_ok(struct LDKRouteHint o);
+struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
/**
- * Creates a new CResult_RouteHintCreationErrorZ in the error state.
+ * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
*/
-struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_err(enum LDKCreationError e);
+struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
/**
- * Frees any resources used by the CResult_RouteHintCreationErrorZ.
+ * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
*/
-void CResult_RouteHintCreationErrorZ_free(struct LDKCResult_RouteHintCreationErrorZ _res);
+void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
/**
- * Creates a new CResult_RouteHintCreationErrorZ which has the same data as `orig`
+ * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_clone(const struct LDKCResult_RouteHintCreationErrorZ *NONNULL_PTR orig);
+struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
/**
* Creates a new CResult_StringErrorZ in the success state.
*/
struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
+/**
+ * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
+ */
+void RouteHint_free(struct LDKRouteHint this_obj);
+
+/**
+ * Checks if two RouteHints 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.
+ */
+bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
+
+/**
+ * Creates a copy of the RouteHint
+ */
+struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
+
/**
* Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
*/
* If the payee provided features in their invoice, they should be provided via payee_features.
* Without this, MPP will only be used if the payee's features are available in the network graph.
*
- * Extra routing hops between known nodes and the target will be used if they are included in
- * last_hops.
+ * Private routing paths between a public node and the target may be included in `last_hops`.
+ * Currently, only the last hop in each path is considered.
*
* If some channels aren't announced, it may be useful to fill in a first_hops with the
* results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
* equal), however the enabled/disabled bit on such channels as well as the
* htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
*/
-struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintHopZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
+struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
/**
* Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
/**
- * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
+ * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
*/
-void RouteHint_free(struct LDKRouteHint this_obj);
+void PrivateRoute_free(struct LDKPrivateRoute this_obj);
/**
- * Checks if two RouteHints contain equal inner contents.
+ * Checks if two PrivateRoutes 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.
*/
-bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
+bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
/**
- * Creates a copy of the RouteHint
+ * Creates a copy of the PrivateRoute
*/
-struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
+struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
/**
* Disassembles the `SignedRawInvoice` into its three parts:
MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
-MUST_USE_RES struct LDKCVec_RouteHintZ RawInvoice_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
/**
- * Constructs an `Invoice` from a `SignedInvoice` by checking all its invariants.
+ * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
* ```
* use lightning_invoice::*;
*
/**
* Returns a list of all routes included in the invoice
*/
-MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
+
+/**
+ * Returns a list of all routes included in the invoice as the underlying hints
+ */
+MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
/**
* Returns the currency for which the invoice was issued
MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
/**
- * Create a new (partial) route from a list of hops
+ * Creates a new (partial) route from a list of hops
*/
-MUST_USE_RES struct LDKCResult_RouteHintCreationErrorZ RouteHint_new(struct LDKCVec_RouteHintHopZ hops);
+MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
/**
- * Returrn the underlying vector of hops
+ * Returns the underlying list of hops
*/
-MUST_USE_RES struct LDKCVec_RouteHintHopZ RouteHint_into_inner(struct LDKRouteHint this_arg);
+MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
/**
* Creates a copy of the CreationError
const LDKRoute* operator &() const { return &self; }
const LDKRoute* operator ->() const { return &self; }
};
+class RouteHint {
+private:
+ LDKRouteHint self;
+public:
+ RouteHint(const RouteHint&) = delete;
+ RouteHint(RouteHint&& o) : self(o.self) { memset(&o, 0, sizeof(RouteHint)); }
+ RouteHint(LDKRouteHint&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRouteHint)); }
+ operator LDKRouteHint() && { LDKRouteHint res = self; memset(&self, 0, sizeof(LDKRouteHint)); return res; }
+ ~RouteHint() { RouteHint_free(self); }
+ RouteHint& operator=(RouteHint&& o) { RouteHint_free(self); self = o.self; memset(&o, 0, sizeof(RouteHint)); return *this; }
+ LDKRouteHint* operator &() { return &self; }
+ LDKRouteHint* operator ->() { return &self; }
+ const LDKRouteHint* operator &() const { return &self; }
+ const LDKRouteHint* operator ->() const { return &self; }
+};
class RouteHintHop {
private:
LDKRouteHintHop self;
const LDKInvoiceSignature* operator &() const { return &self; }
const LDKInvoiceSignature* operator ->() const { return &self; }
};
-class RouteHint {
+class PrivateRoute {
private:
- LDKRouteHint self;
+ LDKPrivateRoute self;
public:
- RouteHint(const RouteHint&) = delete;
- RouteHint(RouteHint&& o) : self(o.self) { memset(&o, 0, sizeof(RouteHint)); }
- RouteHint(LDKRouteHint&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRouteHint)); }
- operator LDKRouteHint() && { LDKRouteHint res = self; memset(&self, 0, sizeof(LDKRouteHint)); return res; }
- ~RouteHint() { RouteHint_free(self); }
- RouteHint& operator=(RouteHint&& o) { RouteHint_free(self); self = o.self; memset(&o, 0, sizeof(RouteHint)); return *this; }
- LDKRouteHint* operator &() { return &self; }
- LDKRouteHint* operator ->() { return &self; }
- const LDKRouteHint* operator &() const { return &self; }
- const LDKRouteHint* operator ->() const { return &self; }
+ PrivateRoute(const PrivateRoute&) = delete;
+ PrivateRoute(PrivateRoute&& o) : self(o.self) { memset(&o, 0, sizeof(PrivateRoute)); }
+ PrivateRoute(LDKPrivateRoute&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPrivateRoute)); }
+ operator LDKPrivateRoute() && { LDKPrivateRoute res = self; memset(&self, 0, sizeof(LDKPrivateRoute)); return res; }
+ ~PrivateRoute() { PrivateRoute_free(self); }
+ PrivateRoute& operator=(PrivateRoute&& o) { PrivateRoute_free(self); self = o.self; memset(&o, 0, sizeof(PrivateRoute)); return *this; }
+ LDKPrivateRoute* operator &() { return &self; }
+ LDKPrivateRoute* operator ->() { return &self; }
+ const LDKPrivateRoute* operator &() const { return &self; }
+ const LDKPrivateRoute* operator ->() const { return &self; }
};
class CreationError {
private:
const LDKCVec_RouteHopZ* operator &() const { return &self; }
const LDKCVec_RouteHopZ* operator ->() const { return &self; }
};
-class CResult_RouteHintCreationErrorZ {
-private:
- LDKCResult_RouteHintCreationErrorZ self;
-public:
- CResult_RouteHintCreationErrorZ(const CResult_RouteHintCreationErrorZ&) = delete;
- CResult_RouteHintCreationErrorZ(CResult_RouteHintCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHintCreationErrorZ)); }
- CResult_RouteHintCreationErrorZ(LDKCResult_RouteHintCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHintCreationErrorZ)); }
- operator LDKCResult_RouteHintCreationErrorZ() && { LDKCResult_RouteHintCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHintCreationErrorZ)); return res; }
- ~CResult_RouteHintCreationErrorZ() { CResult_RouteHintCreationErrorZ_free(self); }
- CResult_RouteHintCreationErrorZ& operator=(CResult_RouteHintCreationErrorZ&& o) { CResult_RouteHintCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHintCreationErrorZ)); return *this; }
- LDKCResult_RouteHintCreationErrorZ* operator &() { return &self; }
- LDKCResult_RouteHintCreationErrorZ* operator ->() { return &self; }
- const LDKCResult_RouteHintCreationErrorZ* operator &() const { return &self; }
- const LDKCResult_RouteHintCreationErrorZ* operator ->() const { return &self; }
-};
class CVec_C2Tuple_BlockHashChannelMonitorZZ {
private:
LDKCVec_C2Tuple_BlockHashChannelMonitorZZ self;
const LDKCResult_SignatureNoneZ* operator &() const { return &self; }
const LDKCResult_SignatureNoneZ* operator ->() const { return &self; }
};
-class CVec_RouteHintHopZ {
-private:
- LDKCVec_RouteHintHopZ self;
-public:
- CVec_RouteHintHopZ(const CVec_RouteHintHopZ&) = delete;
- CVec_RouteHintHopZ(CVec_RouteHintHopZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHintHopZ)); }
- CVec_RouteHintHopZ(LDKCVec_RouteHintHopZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHintHopZ)); }
- operator LDKCVec_RouteHintHopZ() && { LDKCVec_RouteHintHopZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHintHopZ)); return res; }
- ~CVec_RouteHintHopZ() { CVec_RouteHintHopZ_free(self); }
- CVec_RouteHintHopZ& operator=(CVec_RouteHintHopZ&& o) { CVec_RouteHintHopZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RouteHintHopZ)); return *this; }
- LDKCVec_RouteHintHopZ* operator &() { return &self; }
- LDKCVec_RouteHintHopZ* operator ->() { return &self; }
- const LDKCVec_RouteHintHopZ* operator &() const { return &self; }
- const LDKCVec_RouteHintHopZ* operator ->() const { return &self; }
-};
class C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
private:
LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ self;
const LDKCResult_ChannelConfigDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_ChannelConfigDecodeErrorZ* operator ->() const { return &self; }
};
-class CResult_RevokeAndACKDecodeErrorZ {
+class CVec_PrivateRouteZ {
private:
- LDKCResult_RevokeAndACKDecodeErrorZ self;
+ LDKCVec_PrivateRouteZ self;
public:
- CResult_RevokeAndACKDecodeErrorZ(const CResult_RevokeAndACKDecodeErrorZ&) = delete;
- CResult_RevokeAndACKDecodeErrorZ(CResult_RevokeAndACKDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RevokeAndACKDecodeErrorZ)); }
- CResult_RevokeAndACKDecodeErrorZ(LDKCResult_RevokeAndACKDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RevokeAndACKDecodeErrorZ)); }
- operator LDKCResult_RevokeAndACKDecodeErrorZ() && { LDKCResult_RevokeAndACKDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RevokeAndACKDecodeErrorZ)); return res; }
- ~CResult_RevokeAndACKDecodeErrorZ() { CResult_RevokeAndACKDecodeErrorZ_free(self); }
- CResult_RevokeAndACKDecodeErrorZ& operator=(CResult_RevokeAndACKDecodeErrorZ&& o) { CResult_RevokeAndACKDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RevokeAndACKDecodeErrorZ)); return *this; }
- LDKCResult_RevokeAndACKDecodeErrorZ* operator &() { return &self; }
- LDKCResult_RevokeAndACKDecodeErrorZ* operator ->() { return &self; }
- const LDKCResult_RevokeAndACKDecodeErrorZ* operator &() const { return &self; }
- const LDKCResult_RevokeAndACKDecodeErrorZ* operator ->() const { return &self; }
+ CVec_PrivateRouteZ(const CVec_PrivateRouteZ&) = delete;
+ CVec_PrivateRouteZ(CVec_PrivateRouteZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PrivateRouteZ)); }
+ CVec_PrivateRouteZ(LDKCVec_PrivateRouteZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PrivateRouteZ)); }
+ operator LDKCVec_PrivateRouteZ() && { LDKCVec_PrivateRouteZ res = self; memset(&self, 0, sizeof(LDKCVec_PrivateRouteZ)); return res; }
+ ~CVec_PrivateRouteZ() { CVec_PrivateRouteZ_free(self); }
+ CVec_PrivateRouteZ& operator=(CVec_PrivateRouteZ&& o) { CVec_PrivateRouteZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PrivateRouteZ)); return *this; }
+ LDKCVec_PrivateRouteZ* operator &() { return &self; }
+ LDKCVec_PrivateRouteZ* operator ->() { return &self; }
+ const LDKCVec_PrivateRouteZ* operator &() const { return &self; }
+ const LDKCVec_PrivateRouteZ* operator ->() const { return &self; }
};
class CResult_SpendableOutputDescriptorDecodeErrorZ {
private:
const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator &() const { return &self; }
const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator ->() const { return &self; }
};
+class CResult_RevokeAndACKDecodeErrorZ {
+private:
+ LDKCResult_RevokeAndACKDecodeErrorZ self;
+public:
+ CResult_RevokeAndACKDecodeErrorZ(const CResult_RevokeAndACKDecodeErrorZ&) = delete;
+ CResult_RevokeAndACKDecodeErrorZ(CResult_RevokeAndACKDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RevokeAndACKDecodeErrorZ)); }
+ CResult_RevokeAndACKDecodeErrorZ(LDKCResult_RevokeAndACKDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RevokeAndACKDecodeErrorZ)); }
+ operator LDKCResult_RevokeAndACKDecodeErrorZ() && { LDKCResult_RevokeAndACKDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RevokeAndACKDecodeErrorZ)); return res; }
+ ~CResult_RevokeAndACKDecodeErrorZ() { CResult_RevokeAndACKDecodeErrorZ_free(self); }
+ CResult_RevokeAndACKDecodeErrorZ& operator=(CResult_RevokeAndACKDecodeErrorZ&& o) { CResult_RevokeAndACKDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RevokeAndACKDecodeErrorZ)); return *this; }
+ LDKCResult_RevokeAndACKDecodeErrorZ* operator &() { return &self; }
+ LDKCResult_RevokeAndACKDecodeErrorZ* operator ->() { return &self; }
+ const LDKCResult_RevokeAndACKDecodeErrorZ* operator &() const { return &self; }
+ const LDKCResult_RevokeAndACKDecodeErrorZ* operator ->() const { return &self; }
+};
class CResult_UnsignedChannelUpdateDecodeErrorZ {
private:
LDKCResult_UnsignedChannelUpdateDecodeErrorZ self;
const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() const { return &self; }
const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() const { return &self; }
};
+class CResult_PrivateRouteCreationErrorZ {
+private:
+ LDKCResult_PrivateRouteCreationErrorZ self;
+public:
+ CResult_PrivateRouteCreationErrorZ(const CResult_PrivateRouteCreationErrorZ&) = delete;
+ CResult_PrivateRouteCreationErrorZ(CResult_PrivateRouteCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PrivateRouteCreationErrorZ)); }
+ CResult_PrivateRouteCreationErrorZ(LDKCResult_PrivateRouteCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PrivateRouteCreationErrorZ)); }
+ operator LDKCResult_PrivateRouteCreationErrorZ() && { LDKCResult_PrivateRouteCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PrivateRouteCreationErrorZ)); return res; }
+ ~CResult_PrivateRouteCreationErrorZ() { CResult_PrivateRouteCreationErrorZ_free(self); }
+ CResult_PrivateRouteCreationErrorZ& operator=(CResult_PrivateRouteCreationErrorZ&& o) { CResult_PrivateRouteCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PrivateRouteCreationErrorZ)); return *this; }
+ LDKCResult_PrivateRouteCreationErrorZ* operator &() { return &self; }
+ LDKCResult_PrivateRouteCreationErrorZ* operator ->() { return &self; }
+ const LDKCResult_PrivateRouteCreationErrorZ* operator &() const { return &self; }
+ const LDKCResult_PrivateRouteCreationErrorZ* operator ->() const { return &self; }
+};
class CResult_boolPeerHandleErrorZ {
private:
LDKCResult_boolPeerHandleErrorZ self;
}
}
#[repr(C)]
-/// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
+/// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
/// This corresponds to std::vector in C++
-pub struct CVec_RouteHintHopZ {
+pub struct CVec_RouteHintZ {
/// The elements in the array.
/// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- pub data: *mut crate::lightning::routing::router::RouteHintHop,
+ pub data: *mut crate::lightning::routing::router::RouteHint,
/// The number of elements pointed to by `data`.
pub datalen: usize
}
-impl CVec_RouteHintHopZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
+impl CVec_RouteHintZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
if self.datalen == 0 { return Vec::new(); }
let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
self.data = std::ptr::null_mut();
self.datalen = 0;
ret
}
- #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
- fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
+impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
+ fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
let datalen = v.len();
let data = Box::into_raw(v.into_boxed_slice());
Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
}
#[no_mangle]
/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
-impl Drop for CVec_RouteHintHopZ {
+pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
+impl Drop for CVec_RouteHintZ {
fn drop(&mut self) {
if self.datalen == 0 { return; }
unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
}
}
-impl Clone for CVec_RouteHintHopZ {
+impl Clone for CVec_RouteHintZ {
fn clone(&self) -> Self {
let mut res = Vec::new();
if self.datalen == 0 { return Self::from(res); }
/// but with all dynamically-allocated buffers duplicated in new buffers.
pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { orig.clone() }
#[repr(C)]
-/// A dynamically-allocated array of crate::lightning_invoice::RouteHints of arbitrary size.
+/// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
/// This corresponds to std::vector in C++
-pub struct CVec_RouteHintZ {
+pub struct CVec_PrivateRouteZ {
/// The elements in the array.
/// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- pub data: *mut crate::lightning_invoice::RouteHint,
+ pub data: *mut crate::lightning_invoice::PrivateRoute,
/// The number of elements pointed to by `data`.
pub datalen: usize
}
-impl CVec_RouteHintZ {
- #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::RouteHint> {
+impl CVec_PrivateRouteZ {
+ #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
if self.datalen == 0 { return Vec::new(); }
let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
self.data = std::ptr::null_mut();
self.datalen = 0;
ret
}
- #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::RouteHint] {
+ #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
}
}
-impl From<Vec<crate::lightning_invoice::RouteHint>> for CVec_RouteHintZ {
- fn from(v: Vec<crate::lightning_invoice::RouteHint>) -> Self {
+impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
+ fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
let datalen = v.len();
let data = Box::into_raw(v.into_boxed_slice());
Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
}
#[no_mangle]
/// Frees the buffer pointed to by `data` if `datalen` is non-0.
-pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
-impl Drop for CVec_RouteHintZ {
+pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
+impl Drop for CVec_PrivateRouteZ {
fn drop(&mut self) {
if self.datalen == 0 { return; }
unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
}
}
-impl Clone for CVec_RouteHintZ {
+impl Clone for CVec_PrivateRouteZ {
fn clone(&self) -> Self {
let mut res = Vec::new();
if self.datalen == 0 { return Self::from(res); }
/// but with all dynamically-allocated buffers duplicated in new buffers.
pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { orig.clone() }
#[repr(C)]
-/// The contents of CResult_RouteHintCreationErrorZ
-pub union CResult_RouteHintCreationErrorZPtr {
+/// The contents of CResult_PrivateRouteCreationErrorZ
+pub union CResult_PrivateRouteCreationErrorZPtr {
/// A pointer to the contents in the success state.
/// Reading from this pointer when `result_ok` is not set is undefined.
- pub result: *mut crate::lightning_invoice::RouteHint,
+ pub result: *mut crate::lightning_invoice::PrivateRoute,
/// A pointer to the contents in the error state.
/// Reading from this pointer when `result_ok` is set is undefined.
pub err: *mut crate::lightning_invoice::CreationError,
}
#[repr(C)]
-/// A CResult_RouteHintCreationErrorZ represents the result of a fallible operation,
-/// containing a crate::lightning_invoice::RouteHint on success and a crate::lightning_invoice::CreationError on failure.
+/// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
/// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_RouteHintCreationErrorZ {
- /// The contents of this CResult_RouteHintCreationErrorZ, accessible via either
+pub struct CResult_PrivateRouteCreationErrorZ {
+ /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
/// `err` or `result` depending on the state of `result_ok`.
- pub contents: CResult_RouteHintCreationErrorZPtr,
- /// Whether this CResult_RouteHintCreationErrorZ represents a success state.
+ pub contents: CResult_PrivateRouteCreationErrorZPtr,
+ /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
pub result_ok: bool,
}
#[no_mangle]
-/// Creates a new CResult_RouteHintCreationErrorZ in the success state.
-pub extern "C" fn CResult_RouteHintCreationErrorZ_ok(o: crate::lightning_invoice::RouteHint) -> CResult_RouteHintCreationErrorZ {
- CResult_RouteHintCreationErrorZ {
- contents: CResult_RouteHintCreationErrorZPtr {
+/// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
+pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
+ CResult_PrivateRouteCreationErrorZ {
+ contents: CResult_PrivateRouteCreationErrorZPtr {
result: Box::into_raw(Box::new(o)),
},
result_ok: true,
}
}
#[no_mangle]
-/// Creates a new CResult_RouteHintCreationErrorZ in the error state.
-pub extern "C" fn CResult_RouteHintCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_RouteHintCreationErrorZ {
- CResult_RouteHintCreationErrorZ {
- contents: CResult_RouteHintCreationErrorZPtr {
+/// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
+pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
+ CResult_PrivateRouteCreationErrorZ {
+ contents: CResult_PrivateRouteCreationErrorZPtr {
err: Box::into_raw(Box::new(e)),
},
result_ok: false,
}
}
#[no_mangle]
-/// Frees any resources used by the CResult_RouteHintCreationErrorZ.
-pub extern "C" fn CResult_RouteHintCreationErrorZ_free(_res: CResult_RouteHintCreationErrorZ) { }
-impl Drop for CResult_RouteHintCreationErrorZ {
+/// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
+pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
+impl Drop for CResult_PrivateRouteCreationErrorZ {
fn drop(&mut self) {
if self.result_ok {
if unsafe { !(self.contents.result as *mut ()).is_null() } {
}
}
}
-impl From<crate::c_types::CResultTempl<crate::lightning_invoice::RouteHint, crate::lightning_invoice::CreationError>> for CResult_RouteHintCreationErrorZ {
- fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::RouteHint, crate::lightning_invoice::CreationError>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
+ fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
let contents = if o.result_ok {
let result = unsafe { o.contents.result };
unsafe { o.contents.result = std::ptr::null_mut() };
- CResult_RouteHintCreationErrorZPtr { result }
+ CResult_PrivateRouteCreationErrorZPtr { result }
} else {
let err = unsafe { o.contents.err };
unsafe { o.contents.err = std::ptr::null_mut(); }
- CResult_RouteHintCreationErrorZPtr { err }
+ CResult_PrivateRouteCreationErrorZPtr { err }
};
Self {
contents,
}
}
}
-impl Clone for CResult_RouteHintCreationErrorZ {
+impl Clone for CResult_PrivateRouteCreationErrorZ {
fn clone(&self) -> Self {
if self.result_ok {
- Self { result_ok: true, contents: CResult_RouteHintCreationErrorZPtr {
- result: Box::into_raw(Box::new(<crate::lightning_invoice::RouteHint>::clone(unsafe { &*self.contents.result })))
+ Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
+ result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
} }
} else {
- Self { result_ok: false, contents: CResult_RouteHintCreationErrorZPtr {
+ Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
} }
}
}
}
#[no_mangle]
-/// Creates a new CResult_RouteHintCreationErrorZ which has the same data as `orig`
+/// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
/// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_RouteHintCreationErrorZ_clone(orig: &CResult_RouteHintCreationErrorZ) -> CResult_RouteHintCreationErrorZ { orig.clone() }
+pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { orig.clone() }
#[repr(C)]
/// The contents of CResult_StringErrorZ
pub union CResult_StringErrorZPtr {
impl rustConfirm for Confirm {
fn transactions_confirmed(&self, mut header: &bitcoin::blockdata::block::BlockHeader, mut txdata: &lightning::chain::transaction::TransactionData, mut height: u32) {
let mut local_header = { let mut s = [0u8; 80]; s[..].copy_from_slice(&::bitcoin::consensus::encode::serialize(header)); s };
- let mut local_txdata = Vec::new(); for item in txdata.iter() { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = *item; let mut local_txdata_0 = (orig_txdata_0_0, crate::c_types::Transaction::from_bitcoin(&orig_txdata_0_1)).into(); local_txdata_0 }); };
+ let mut local_txdata = Vec::new(); for item in txdata.iter() { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item; let mut local_txdata_0 = (orig_txdata_0_0, crate::c_types::Transaction::from_bitcoin(&orig_txdata_0_1)).into(); local_txdata_0 }); };
(self.transactions_confirmed)(self.this_arg, &local_header, local_txdata.into(), height)
}
fn transaction_unconfirmed(&self, mut txid: &bitcoin::hash_types::Txid) {
local_res
}
+use lightning::routing::router::RouteHint as nativeRouteHintImport;
+type nativeRouteHint = nativeRouteHintImport;
+
+/// A list of hops along a payment path terminating with a channel to the recipient.
+#[must_use]
+#[repr(C)]
+pub struct RouteHint {
+ /// A pointer to the opaque Rust object.
+
+ /// Nearly everywhere, inner must be non-null, however in places where
+ /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+ pub inner: *mut nativeRouteHint,
+ /// Indicates that this is the only struct which contains the same pointer.
+
+ /// Rust functions which take ownership of an object provided via an argument require
+ /// this to be true and invalidate the object pointed to by inner.
+ pub is_owned: bool,
+}
+
+impl Drop for RouteHint {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeRouteHint>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(self.inner) };
+ }
+ }
+}
+/// Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn RouteHint_free(this_obj: RouteHint) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn RouteHint_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRouteHint); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl RouteHint {
+ pub(crate) fn take_inner(mut self) -> *mut nativeRouteHint {
+ assert!(self.is_owned);
+ let ret = self.inner;
+ self.inner = std::ptr::null_mut();
+ ret
+ }
+}
+/// Checks if two RouteHints 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.
+#[no_mangle]
+pub extern "C" fn RouteHint_eq(a: &RouteHint, b: &RouteHint) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if unsafe { &*a.inner } == unsafe { &*b.inner } { true } else { false }
+}
+impl Clone for RouteHint {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeRouteHint>::is_null(self.inner) { std::ptr::null_mut() } else {
+ Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn RouteHint_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRouteHint)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the RouteHint
+pub extern "C" fn RouteHint_clone(orig: &RouteHint) -> RouteHint {
+ orig.clone()
+}
+
use lightning::routing::router::RouteHintHop as nativeRouteHintHopImport;
type nativeRouteHintHop = nativeRouteHintHopImport;
-/// A channel descriptor which provides a last-hop route to get_route
+/// A channel descriptor for a hop along a payment path.
#[must_use]
#[repr(C)]
pub struct RouteHintHop {
/// If the payee provided features in their invoice, they should be provided via payee_features.
/// Without this, MPP will only be used if the payee's features are available in the network graph.
///
-/// Extra routing hops between known nodes and the target will be used if they are included in
-/// last_hops.
+/// Private routing paths between a public node and the target may be included in `last_hops`.
+/// Currently, only the last hop in each path is considered.
///
/// If some channels aren't announced, it may be useful to fill in a first_hops with the
/// results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
/// equal), however the enabled/disabled bit on such channels as well as the
/// htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
#[no_mangle]
-pub extern "C" fn get_route(mut our_node_id: crate::c_types::PublicKey, network: &crate::lightning::routing::network_graph::NetworkGraph, mut payee: crate::c_types::PublicKey, mut payee_features: crate::lightning::ln::features::InvoiceFeatures, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut last_hops: crate::c_types::derived::CVec_RouteHintHopZ, mut final_value_msat: u64, mut final_cltv: u32, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
+pub extern "C" fn get_route(mut our_node_id: crate::c_types::PublicKey, network: &crate::lightning::routing::network_graph::NetworkGraph, mut payee: crate::c_types::PublicKey, mut payee_features: crate::lightning::ln::features::InvoiceFeatures, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut last_hops: crate::c_types::derived::CVec_RouteHintZ, mut final_value_msat: u64, mut final_cltv: u32, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_RouteLightningErrorZ {
let mut local_payee_features = if payee_features.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(payee_features.take_inner()) } }) };
let mut local_first_hops_base = if first_hops == std::ptr::null_mut() { None } else { Some( { let mut local_first_hops_0 = Vec::new(); for mut item in unsafe { &mut *first_hops }.as_slice().iter() { local_first_hops_0.push( { unsafe { &*item.inner } }); }; local_first_hops_0 }) }; let mut local_first_hops = local_first_hops_base.as_ref().map(|a| &a[..]);
let mut local_last_hops = Vec::new(); for mut item in last_hops.as_slice().iter() { local_last_hops.push( { unsafe { &*item.inner } }); };
pub static TAG_FALLBACK: u8 = lightning_invoice::constants::TAG_FALLBACK;
#[no_mangle]
-pub static TAG_ROUTE: u8 = lightning_invoice::constants::TAG_ROUTE;
+pub static TAG_PRIVATE_ROUTE: u8 = lightning_invoice::constants::TAG_PRIVATE_ROUTE;
#[no_mangle]
pub static TAG_PAYMENT_SECRET: u8 = lightning_invoice::constants::TAG_PAYMENT_SECRET;
orig.clone()
}
-use lightning_invoice::RouteHint as nativeRouteHintImport;
-type nativeRouteHint = nativeRouteHintImport;
+use lightning_invoice::PrivateRoute as nativePrivateRouteImport;
+type nativePrivateRoute = nativePrivateRouteImport;
/// Private routing information
///
///
#[must_use]
#[repr(C)]
-pub struct RouteHint {
+pub struct PrivateRoute {
/// A pointer to the opaque Rust object.
/// Nearly everywhere, inner must be non-null, however in places where
/// the Rust equivalent takes an Option, it may be set to null to indicate None.
- pub inner: *mut nativeRouteHint,
+ pub inner: *mut nativePrivateRoute,
/// Indicates that this is the only struct which contains the same pointer.
/// Rust functions which take ownership of an object provided via an argument require
pub is_owned: bool,
}
-impl Drop for RouteHint {
+impl Drop for PrivateRoute {
fn drop(&mut self) {
- if self.is_owned && !<*mut nativeRouteHint>::is_null(self.inner) {
+ if self.is_owned && !<*mut nativePrivateRoute>::is_null(self.inner) {
let _ = unsafe { Box::from_raw(self.inner) };
}
}
}
-/// Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
+/// Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
#[no_mangle]
-pub extern "C" fn RouteHint_free(this_obj: RouteHint) { }
+pub extern "C" fn PrivateRoute_free(this_obj: PrivateRoute) { }
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
-extern "C" fn RouteHint_free_void(this_ptr: *mut c_void) {
- unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRouteHint); }
+extern "C" fn PrivateRoute_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativePrivateRoute); }
}
#[allow(unused)]
/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
-impl RouteHint {
- pub(crate) fn take_inner(mut self) -> *mut nativeRouteHint {
+impl PrivateRoute {
+ pub(crate) fn take_inner(mut self) -> *mut nativePrivateRoute {
assert!(self.is_owned);
let ret = self.inner;
self.inner = std::ptr::null_mut();
ret
}
}
-/// Checks if two RouteHints contain equal inner contents.
+/// Checks if two PrivateRoutes 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.
#[no_mangle]
-pub extern "C" fn RouteHint_eq(a: &RouteHint, b: &RouteHint) -> bool {
+pub extern "C" fn PrivateRoute_eq(a: &PrivateRoute, b: &PrivateRoute) -> bool {
if a.inner == b.inner { return true; }
if a.inner.is_null() || b.inner.is_null() { return false; }
if unsafe { &*a.inner } == unsafe { &*b.inner } { true } else { false }
}
-impl Clone for RouteHint {
+impl Clone for PrivateRoute {
fn clone(&self) -> Self {
Self {
- inner: if <*mut nativeRouteHint>::is_null(self.inner) { std::ptr::null_mut() } else {
+ inner: if <*mut nativePrivateRoute>::is_null(self.inner) { std::ptr::null_mut() } else {
Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
is_owned: true,
}
}
#[allow(unused)]
/// Used only if an object of this type is returned as a trait impl by a method
-pub(crate) extern "C" fn RouteHint_clone_void(this_ptr: *const c_void) -> *mut c_void {
- Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRouteHint)).clone() })) as *mut c_void
+pub(crate) extern "C" fn PrivateRoute_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePrivateRoute)).clone() })) as *mut c_void
}
#[no_mangle]
-/// Creates a copy of the RouteHint
-pub extern "C" fn RouteHint_clone(orig: &RouteHint) -> RouteHint {
+/// Creates a copy of the PrivateRoute
+pub extern "C" fn PrivateRoute_clone(orig: &PrivateRoute) -> PrivateRoute {
orig.clone()
}
/// Disassembles the `SignedRawInvoice` into its three parts:
#[must_use]
#[no_mangle]
-pub extern "C" fn RawInvoice_routes(this_arg: &RawInvoice) -> crate::c_types::derived::CVec_RouteHintZ {
- let mut ret = unsafe { &*this_arg.inner }.routes();
- let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning_invoice::RouteHint { inner: unsafe { ( (&(**item) as *const _) as *mut _) }, is_owned: false } }); };
+pub extern "C" fn RawInvoice_private_routes(this_arg: &RawInvoice) -> crate::c_types::derived::CVec_PrivateRouteZ {
+ let mut ret = unsafe { &*this_arg.inner }.private_routes();
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning_invoice::PrivateRoute { inner: unsafe { ( (&(*item) as *const _) as *mut _) }, is_owned: false } }); };
local_ret.into()
}
local_ret
}
-/// Constructs an `Invoice` from a `SignedInvoice` by checking all its invariants.
+/// Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
/// ```
/// use lightning_invoice::*;
///
/// Returns a list of all routes included in the invoice
#[must_use]
#[no_mangle]
-pub extern "C" fn Invoice_routes(this_arg: &Invoice) -> crate::c_types::derived::CVec_RouteHintZ {
- let mut ret = unsafe { &*this_arg.inner }.routes();
- let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning_invoice::RouteHint { inner: unsafe { ( (&(**item) as *const _) as *mut _) }, is_owned: false } }); };
+pub extern "C" fn Invoice_private_routes(this_arg: &Invoice) -> crate::c_types::derived::CVec_PrivateRouteZ {
+ let mut ret = unsafe { &*this_arg.inner }.private_routes();
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning_invoice::PrivateRoute { inner: unsafe { ( (&(*item) as *const _) as *mut _) }, is_owned: false } }); };
+ local_ret.into()
+}
+
+/// Returns a list of all routes included in the invoice as the underlying hints
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Invoice_route_hints(this_arg: &Invoice) -> crate::c_types::derived::CVec_RouteHintZ {
+ let mut ret = unsafe { &*this_arg.inner }.route_hints();
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::routing::router::RouteHint { inner: unsafe { ( (&(*item) as *const _) as *mut _) }, is_owned: false } }); };
local_ret.into()
}
ret.as_secs()
}
-/// Create a new (partial) route from a list of hops
+/// Creates a new (partial) route from a list of hops
#[must_use]
#[no_mangle]
-pub extern "C" fn RouteHint_new(mut hops: crate::c_types::derived::CVec_RouteHintHopZ) -> crate::c_types::derived::CResult_RouteHintCreationErrorZ {
- let mut local_hops = Vec::new(); for mut item in hops.into_rust().drain(..) { local_hops.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
- let mut ret = lightning_invoice::RouteHint::new(local_hops);
- let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::RouteHint { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::CreationError::native_into(e) }).into() };
+pub extern "C" fn PrivateRoute_new(mut hops: crate::lightning::routing::router::RouteHint) -> crate::c_types::derived::CResult_PrivateRouteCreationErrorZ {
+ let mut ret = lightning_invoice::PrivateRoute::new(*unsafe { Box::from_raw(hops.take_inner()) });
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::PrivateRoute { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::CreationError::native_into(e) }).into() };
local_ret
}
-/// Returrn the underlying vector of hops
+/// Returns the underlying list of hops
#[must_use]
#[no_mangle]
-pub extern "C" fn RouteHint_into_inner(mut this_arg: RouteHint) -> crate::c_types::derived::CVec_RouteHintHopZ {
+pub extern "C" fn PrivateRoute_into_inner(mut this_arg: PrivateRoute) -> crate::lightning::routing::router::RouteHint {
let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).into_inner();
- let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::routing::router::RouteHintHop { inner: Box::into_raw(Box::new(item)), is_owned: true } }); };
- local_ret.into()
+ crate::lightning::routing::router::RouteHint { inner: Box::into_raw(Box::new(ret)), is_owned: true }
}
/// Errors that may occur when constructing a new `RawInvoice` or `Invoice`