@@ -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
@@ -913,8 +913,8 @@ impl RawInvoice {
913
913
find_all_extract ! ( self . known_tagged_fields( ) , TaggedField :: Fallback ( ref x) , x) . collect ( )
914
914
}
915
915
916
- pub fn routes ( & self ) -> Vec < & Route > {
917
- find_all_extract ! ( self . known_tagged_fields( ) , TaggedField :: Route ( ref x) , x) . collect ( )
916
+ pub fn private_routes ( & self ) -> Vec < & PrivateRoute > {
917
+ find_all_extract ! ( self . known_tagged_fields( ) , TaggedField :: PrivateRoute ( ref x) , x) . collect ( )
918
918
}
919
919
920
920
pub fn amount_pico_btc ( & self ) -> Option < u64 > {
@@ -1163,13 +1163,13 @@ impl Invoice {
1163
1163
}
1164
1164
1165
1165
/// Returns a list of all routes included in the invoice
1166
- pub fn routes ( & self ) -> Vec < & Route > {
1167
- self . signed_invoice . routes ( )
1166
+ pub fn private_routes ( & self ) -> Vec < & PrivateRoute > {
1167
+ self . signed_invoice . private_routes ( )
1168
1168
}
1169
1169
1170
- /// Returns a list of all routes included in the invoice as the underlying type
1170
+ /// Returns a list of all routes included in the invoice as the underlying hints
1171
1171
pub fn route_hints ( & self ) -> Vec < & RouteHint > {
1172
- self . routes ( ) . into_iter ( ) . map ( |route| & * * route) . collect ( )
1172
+ self . private_routes ( ) . into_iter ( ) . map ( |route| & * * route) . collect ( )
1173
1173
}
1174
1174
1175
1175
/// Returns the currency for which the invoice was issued
@@ -1200,7 +1200,7 @@ impl TaggedField {
1200
1200
TaggedField :: ExpiryTime ( _) => constants:: TAG_EXPIRY_TIME ,
1201
1201
TaggedField :: MinFinalCltvExpiry ( _) => constants:: TAG_MIN_FINAL_CLTV_EXPIRY ,
1202
1202
TaggedField :: Fallback ( _) => constants:: TAG_FALLBACK ,
1203
- TaggedField :: Route ( _) => constants:: TAG_ROUTE ,
1203
+ TaggedField :: PrivateRoute ( _) => constants:: TAG_PRIVATE_ROUTE ,
1204
1204
TaggedField :: PaymentSecret ( _) => constants:: TAG_PAYMENT_SECRET ,
1205
1205
TaggedField :: Features ( _) => constants:: TAG_FEATURES ,
1206
1206
} ;
@@ -1291,11 +1291,11 @@ impl ExpiryTime {
1291
1291
}
1292
1292
}
1293
1293
1294
- impl Route {
1294
+ impl PrivateRoute {
1295
1295
/// Creates a new (partial) route from a list of hops
1296
- pub fn new ( hops : RouteHint ) -> Result < Route , CreationError > {
1296
+ pub fn new ( hops : RouteHint ) -> Result < PrivateRoute , CreationError > {
1297
1297
if hops. 0 . len ( ) <= 12 {
1298
- Ok ( Route ( hops) )
1298
+ Ok ( PrivateRoute ( hops) )
1299
1299
} else {
1300
1300
Err ( CreationError :: RouteTooLong )
1301
1301
}
@@ -1307,13 +1307,13 @@ impl Route {
1307
1307
}
1308
1308
}
1309
1309
1310
- impl Into < RouteHint > for Route {
1310
+ impl Into < RouteHint > for PrivateRoute {
1311
1311
fn into ( self ) -> RouteHint {
1312
1312
self . into_inner ( )
1313
1313
}
1314
1314
}
1315
1315
1316
- impl Deref for Route {
1316
+ impl Deref for PrivateRoute {
1317
1317
type Target = RouteHint ;
1318
1318
1319
1319
fn deref ( & self ) -> & RouteHint {
@@ -1713,7 +1713,7 @@ mod test {
1713
1713
let too_long_route = RouteHint ( vec ! [ route_hop; 13 ] ) ;
1714
1714
let long_route_res = builder. clone ( )
1715
1715
. description ( "Test" . into ( ) )
1716
- . route ( too_long_route)
1716
+ . private_route ( too_long_route)
1717
1717
. build_raw ( ) ;
1718
1718
assert_eq ! ( long_route_res, Err ( CreationError :: RouteTooLong ) ) ;
1719
1719
@@ -1801,8 +1801,8 @@ mod test {
1801
1801
. expiry_time ( Duration :: from_secs ( 54321 ) )
1802
1802
. min_final_cltv_expiry ( 144 )
1803
1803
. fallback ( Fallback :: PubKeyHash ( [ 0 ; 20 ] ) )
1804
- . route ( route_1. clone ( ) )
1805
- . route ( route_2. clone ( ) )
1804
+ . private_route ( route_1. clone ( ) )
1805
+ . private_route ( route_2. clone ( ) )
1806
1806
. description_hash ( sha256:: Hash :: from_slice ( & [ 3 ; 32 ] [ ..] ) . unwrap ( ) )
1807
1807
. payment_hash ( sha256:: Hash :: from_slice ( & [ 21 ; 32 ] [ ..] ) . unwrap ( ) )
1808
1808
. payment_secret ( PaymentSecret ( [ 42 ; 32 ] ) )
@@ -1825,7 +1825,7 @@ mod test {
1825
1825
assert_eq ! ( invoice. expiry_time( ) , Duration :: from_secs( 54321 ) ) ;
1826
1826
assert_eq ! ( invoice. min_final_cltv_expiry( ) , 144 ) ;
1827
1827
assert_eq ! ( invoice. fallbacks( ) , vec![ & Fallback :: PubKeyHash ( [ 0 ; 20 ] ) ] ) ;
1828
- assert_eq ! ( invoice. routes ( ) , vec![ & Route ( route_1) , & Route ( route_2) ] ) ;
1828
+ assert_eq ! ( invoice. private_routes ( ) , vec![ & PrivateRoute ( route_1) , & PrivateRoute ( route_2) ] ) ;
1829
1829
assert_eq ! (
1830
1830
invoice. description( ) ,
1831
1831
InvoiceDescription :: Hash ( & Sha256 ( sha256:: Hash :: from_slice( & [ 3 ; 32 ] [ ..] ) . unwrap( ) ) )
0 commit comments