Make invoice fields public
authorbenthecarman <benthecarman@live.com>
Fri, 10 Nov 2023 22:12:43 +0000 (16:12 -0600)
committerbenthecarman <benthecarman@live.com>
Wed, 15 Nov 2023 18:35:21 +0000 (12:35 -0600)
lightning-invoice/src/lib.rs

index b2fe8a1203057acec3f71000a03cb49f0fdf7397..d283cba7a8ea671492c191561330c00ad68462e0 100644 (file)
@@ -479,7 +479,7 @@ impl Sha256 {
 ///
 /// # Invariants
 /// The description can be at most 639 __bytes__ long
-#[derive(Clone, Debug, Hash, Eq, PartialEq, Ord, PartialOrd)]
+#[derive(Clone, Debug, Hash, Eq, PartialEq, Ord, PartialOrd, Default)]
 pub struct Description(String);
 
 /// Payee public key
@@ -529,7 +529,7 @@ impl Ord for Bolt11InvoiceSignature {
 /// The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
 ///
 #[derive(Clone, Debug, Hash, Eq, PartialEq, Ord, PartialOrd)]
-pub struct PrivateRoute(RouteHint);
+pub struct PrivateRoute(pub RouteHint);
 
 /// Tag constants as specified in BOLT11
 #[allow(missing_docs)]
@@ -1145,6 +1145,12 @@ impl PositiveTimestamp {
        }
 }
 
+impl From<PositiveTimestamp> for Duration {
+       fn from(val: PositiveTimestamp) -> Self {
+               val.0
+       }
+}
+
 #[cfg(feature = "std")]
 impl From<PositiveTimestamp> for SystemTime {
        fn from(val: PositiveTimestamp) -> Self {