@@ -6,7 +6,7 @@ use rns_crypto::ed25519::Ed25519PrivateKey;
66use rns_identity:: announce:: AnnounceData ;
77use rns_link:: link:: LinkState ;
88use rns_transport:: messages:: {
9- AnnounceRpcEntry , TransportMessage , TransportQuery , TransportQueryResponse ,
9+ AnnounceRpcEntry , PathTableRpcEntry , TransportMessage , TransportQuery , TransportQueryResponse ,
1010} ;
1111
1212fn link ( byte : u8 ) -> LinkId {
@@ -52,6 +52,17 @@ fn announce_entry(
5252 }
5353}
5454
55+ fn path_entry ( destination_hash : [ u8 ; 16 ] , hops : u8 ) -> PathTableRpcEntry {
56+ PathTableRpcEntry {
57+ hash : destination_hash,
58+ timestamp : 1235.0 ,
59+ via : None ,
60+ hops,
61+ expires : 3600.0 ,
62+ interface : "test" . to_string ( ) ,
63+ }
64+ }
65+
5566fn packet ( signals : impl IntoIterator < Item = Signal > ) -> Vec < u8 > {
5667 LxstPacket :: signalling ( signals) . encode ( ) . unwrap ( )
5768}
@@ -1284,6 +1295,18 @@ async fn begin_outgoing_link_discovers_announce_and_sends_link_request() {
12841295 assert_eq ! ( dest, destination_hash) ;
12851296 reply. send ( true ) . unwrap ( ) ;
12861297
1298+ let rpc = transport_rx. recv ( ) . await . unwrap ( ) ;
1299+ let TransportMessage :: Rpc { query, response_tx } = rpc else {
1300+ panic ! ( "expected path table Rpc, got {rpc:?}" ) ;
1301+ } ;
1302+ assert ! ( matches!( query, TransportQuery :: GetPathTable ) ) ;
1303+ response_tx
1304+ . send ( TransportQueryResponse :: PathTable ( vec ! [ path_entry(
1305+ destination_hash,
1306+ 2 ,
1307+ ) ] ) )
1308+ . unwrap ( ) ;
1309+
12871310 let request_path = transport_rx. recv ( ) . await . unwrap ( ) ;
12881311 let TransportMessage :: RequestPath {
12891312 destination_hash : requested_hash,
@@ -1766,6 +1789,18 @@ async fn telephony_service_call_control_discovers_peer_and_emits_started() {
17661789 assert_eq ! ( dest, destination_hash) ;
17671790 reply. send ( true ) . unwrap ( ) ;
17681791
1792+ let rpc = transport_rx. recv ( ) . await . unwrap ( ) ;
1793+ let TransportMessage :: Rpc { query, response_tx } = rpc else {
1794+ panic ! ( "expected path table Rpc, got {rpc:?}" ) ;
1795+ } ;
1796+ assert ! ( matches!( query, TransportQuery :: GetPathTable ) ) ;
1797+ response_tx
1798+ . send ( TransportQueryResponse :: PathTable ( vec ! [ path_entry(
1799+ destination_hash,
1800+ 1 ,
1801+ ) ] ) )
1802+ . unwrap ( ) ;
1803+
17691804 let request_path = transport_rx. recv ( ) . await . unwrap ( ) ;
17701805 let TransportMessage :: RequestPath {
17711806 destination_hash : requested_hash,
0 commit comments