Fail payment retry if Invoice is expired
[rust-lightning] / lightning / src / routing / router.rs
index ec49b21058b3e89999586771f65c72256d1a94c8..545ff9f24ce386520ec630dab31f13b75b9c08ae 100644 (file)
@@ -180,12 +180,16 @@ pub struct Payee {
 
        /// Hints for routing to the payee, containing channels connecting the payee to public nodes.
        pub route_hints: Vec<RouteHint>,
+
+       /// Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
+       pub expiry_time: Option<u64>,
 }
 
 impl_writeable_tlv_based!(Payee, {
        (0, pubkey, required),
        (2, features, option),
        (4, route_hints, vec_type),
+       (6, expiry_time, option),
 });
 
 impl Payee {
@@ -195,6 +199,7 @@ impl Payee {
                        pubkey,
                        features: None,
                        route_hints: vec![],
+                       expiry_time: None,
                }
        }
 
@@ -216,6 +221,11 @@ impl Payee {
        pub fn with_route_hints(self, route_hints: Vec<RouteHint>) -> Self {
                Self { route_hints, ..self }
        }
+
+       /// Includes a payment expiration in seconds relative to the UNIX epoch.
+       pub fn with_expiry_time(self, expiry_time: u64) -> Self {
+               Self { expiry_time: Some(expiry_time), ..self }
+       }
 }
 
 /// A list of hops along a payment path terminating with a channel to the recipient.