@@ -362,7 +362,7 @@ pub enum TaggedField {
362
362
ExpiryTime ( ExpiryTime ) ,
363
363
MinFinalCltvExpiry ( MinFinalCltvExpiry ) ,
364
364
Fallback ( Fallback ) ,
365
- Route ( Route ) ,
365
+ PrivateRoute ( PrivateRoute ) ,
366
366
PaymentSecret ( PaymentSecret ) ,
367
367
Features ( InvoiceFeatures ) ,
368
368
}
@@ -419,7 +419,7 @@ pub struct InvoiceSignature(pub RecoverableSignature);
419
419
/// The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
420
420
///
421
421
#[ derive( Eq , PartialEq , Debug , Clone ) ]
422
- pub struct Route ( RouteHint ) ;
422
+ pub struct PrivateRoute ( RouteHint ) ;
423
423
424
424
/// Tag constants as specified in BOLT11
425
425
#[ allow( missing_docs) ]
@@ -431,7 +431,7 @@ pub mod constants {
431
431
pub const TAG_EXPIRY_TIME : u8 = 6 ;
432
432
pub const TAG_MIN_FINAL_CLTV_EXPIRY : u8 = 24 ;
433
433
pub const TAG_FALLBACK : u8 = 9 ;
434
- pub const TAG_ROUTE : u8 = 3 ;
434
+ pub const TAG_PRIVATE_ROUTE : u8 = 3 ;
435
435
pub const TAG_PAYMENT_SECRET : u8 = 16 ;
436
436
pub const TAG_FEATURES : u8 = 5 ;
437
437
}
@@ -509,9 +509,9 @@ impl<D: tb::Bool, H: tb::Bool, T: tb::Bool, C: tb::Bool, S: tb::Bool> InvoiceBui
509
509
}
510
510
511
511
/// Adds a private route.
512
- pub fn route ( mut self , route : RouteHint ) -> Self {
513
- match Route :: new ( route ) {
514
- Ok ( r) => self . tagged_fields . push ( TaggedField :: Route ( r) ) ,
512
+ pub fn private_route ( mut self , hint : RouteHint ) -> Self {
513
+ match PrivateRoute :: new ( hint ) {
514
+ Ok ( r) => self . tagged_fields . push ( TaggedField :: PrivateRoute ( r) ) ,
515
515
Err ( e) => self . error = Some ( e) ,
516
516
}
517
517
self
@@ -892,11 +892,11 @@ impl RawInvoice {
892
892
} ) . collect :: < Vec < & Fallback > > ( )
893
893
}
894
894
895
- pub fn routes ( & self ) -> Vec < & Route > {
895
+ pub fn private_routes ( & self ) -> Vec < & PrivateRoute > {
896
896
self . known_tagged_fields ( ) . filter_map ( |tf| match tf {
897
- & TaggedField :: Route ( ref r) => Some ( r) ,
897
+ & TaggedField :: PrivateRoute ( ref r) => Some ( r) ,
898
898
_ => None ,
899
- } ) . collect :: < Vec < & Route > > ( )
899
+ } ) . collect :: < Vec < & PrivateRoute > > ( )
900
900
}
901
901
902
902
pub fn amount_pico_btc ( & self ) -> Option < u64 > {
@@ -1145,13 +1145,13 @@ impl Invoice {
1145
1145
}
1146
1146
1147
1147
/// Returns a list of all routes included in the invoice
1148
- pub fn routes ( & self ) -> Vec < & Route > {
1149
- self . signed_invoice . routes ( )
1148
+ pub fn private_routes ( & self ) -> Vec < & PrivateRoute > {
1149
+ self . signed_invoice . private_routes ( )
1150
1150
}
1151
1151
1152
- /// Returns a list of all routes included in the invoice as the underlying type
1152
+ /// Returns a list of all routes included in the invoice as the underlying hints
1153
1153
pub fn route_hints ( & self ) -> Vec < & RouteHint > {
1154
- self . routes ( ) . into_iter ( ) . map ( |route| & * * route) . collect ( )
1154
+ self . private_routes ( ) . into_iter ( ) . map ( |route| & * * route) . collect ( )
1155
1155
}
1156
1156
1157
1157
/// Returns the currency for which the invoice was issued
@@ -1182,7 +1182,7 @@ impl TaggedField {
1182
1182
TaggedField :: ExpiryTime ( _) => constants:: TAG_EXPIRY_TIME ,
1183
1183
TaggedField :: MinFinalCltvExpiry ( _) => constants:: TAG_MIN_FINAL_CLTV_EXPIRY ,
1184
1184
TaggedField :: Fallback ( _) => constants:: TAG_FALLBACK ,
1185
- TaggedField :: Route ( _) => constants:: TAG_ROUTE ,
1185
+ TaggedField :: PrivateRoute ( _) => constants:: TAG_PRIVATE_ROUTE ,
1186
1186
TaggedField :: PaymentSecret ( _) => constants:: TAG_PAYMENT_SECRET ,
1187
1187
TaggedField :: Features ( _) => constants:: TAG_FEATURES ,
1188
1188
} ;
@@ -1273,11 +1273,11 @@ impl ExpiryTime {
1273
1273
}
1274
1274
}
1275
1275
1276
- impl Route {
1276
+ impl PrivateRoute {
1277
1277
/// Creates a new (partial) route from a list of hops
1278
- pub fn new ( hops : RouteHint ) -> Result < Route , CreationError > {
1278
+ pub fn new ( hops : RouteHint ) -> Result < PrivateRoute , CreationError > {
1279
1279
if hops. 0 . len ( ) <= 12 {
1280
- Ok ( Route ( hops) )
1280
+ Ok ( PrivateRoute ( hops) )
1281
1281
} else {
1282
1282
Err ( CreationError :: RouteTooLong )
1283
1283
}
@@ -1289,13 +1289,13 @@ impl Route {
1289
1289
}
1290
1290
}
1291
1291
1292
- impl Into < RouteHint > for Route {
1292
+ impl Into < RouteHint > for PrivateRoute {
1293
1293
fn into ( self ) -> RouteHint {
1294
1294
self . into_inner ( )
1295
1295
}
1296
1296
}
1297
1297
1298
- impl Deref for Route {
1298
+ impl Deref for PrivateRoute {
1299
1299
type Target = RouteHint ;
1300
1300
1301
1301
fn deref ( & self ) -> & RouteHint {
@@ -1695,7 +1695,7 @@ mod test {
1695
1695
let too_long_route = RouteHint ( vec ! [ route_hop; 13 ] ) ;
1696
1696
let long_route_res = builder. clone ( )
1697
1697
. description ( "Test" . into ( ) )
1698
- . route ( too_long_route)
1698
+ . private_route ( too_long_route)
1699
1699
. build_raw ( ) ;
1700
1700
assert_eq ! ( long_route_res, Err ( CreationError :: RouteTooLong ) ) ;
1701
1701
@@ -1783,8 +1783,8 @@ mod test {
1783
1783
. expiry_time ( Duration :: from_secs ( 54321 ) )
1784
1784
. min_final_cltv_expiry ( 144 )
1785
1785
. fallback ( Fallback :: PubKeyHash ( [ 0 ; 20 ] ) )
1786
- . route ( route_1. clone ( ) )
1787
- . route ( route_2. clone ( ) )
1786
+ . private_route ( route_1. clone ( ) )
1787
+ . private_route ( route_2. clone ( ) )
1788
1788
. description_hash ( sha256:: Hash :: from_slice ( & [ 3 ; 32 ] [ ..] ) . unwrap ( ) )
1789
1789
. payment_hash ( sha256:: Hash :: from_slice ( & [ 21 ; 32 ] [ ..] ) . unwrap ( ) )
1790
1790
. payment_secret ( PaymentSecret ( [ 42 ; 32 ] ) )
@@ -1807,7 +1807,7 @@ mod test {
1807
1807
assert_eq ! ( invoice. expiry_time( ) , Duration :: from_secs( 54321 ) ) ;
1808
1808
assert_eq ! ( invoice. min_final_cltv_expiry( ) , 144 ) ;
1809
1809
assert_eq ! ( invoice. fallbacks( ) , vec![ & Fallback :: PubKeyHash ( [ 0 ; 20 ] ) ] ) ;
1810
- assert_eq ! ( invoice. routes ( ) , vec![ & Route ( route_1) , & Route ( route_2) ] ) ;
1810
+ assert_eq ! ( invoice. private_routes ( ) , vec![ & PrivateRoute ( route_1) , & PrivateRoute ( route_2) ] ) ;
1811
1811
assert_eq ! (
1812
1812
invoice. description( ) ,
1813
1813
InvoiceDescription :: Hash ( & Sha256 ( sha256:: Hash :: from_slice( & [ 3 ; 32 ] [ ..] ) . unwrap( ) ) )
0 commit comments