Un-export the `PrivateRoute` inner field as there are invariants
authorMatt Corallo <git@bluematt.me>
Thu, 14 Dec 2023 22:49:58 +0000 (22:49 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 15 Dec 2023 22:31:51 +0000 (22:31 +0000)
When we make the `PrivateRoute` inner `RouteHint` `pub`, we failed
to note that the `PrivateRoute::new` constructor actually verifies
a length invariant. Thus, we un-export the inner field and force
users to go back through the `new` fn.

lightning-invoice/src/lib.rs

index 89763aa758915dff924fd6155604f5a27f308bcf..c2e1ecf2d923c926db4385ef6ba4e75769b4ced6 100644 (file)
@@ -527,7 +527,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(pub RouteHint);
+pub struct PrivateRoute(RouteHint);
 
 /// Tag constants as specified in BOLT11
 #[allow(missing_docs)]