@@ -467,7 +467,6 @@ impl SimulatedChannel {
467
467
468
468
/// SimNetwork represents a high level network coordinator that is responsible for the task of actually propagating
469
469
/// payments through the simulated network.
470
- #[ async_trait]
471
470
trait SimNetwork : Send + Sync {
472
471
/// Sends payments over the route provided through the network, reporting the final payment outcome to the sender
473
472
/// channel provided.
@@ -480,9 +479,9 @@ trait SimNetwork: Send + Sync {
480
479
) ;
481
480
482
481
/// Looks up a node in the simulated network and a list of its channel capacities.
483
- async fn lookup_node ( & self , node : & PublicKey ) -> Result < ( NodeInfo , Vec < u64 > ) , LightningError > ;
482
+ fn lookup_node ( & self , node : & PublicKey ) -> Result < ( NodeInfo , Vec < u64 > ) , LightningError > ;
484
483
/// Lists all nodes in the simulated network.
485
- async fn list_nodes ( & self ) -> Result < Vec < NodeInfo > , LightningError > ;
484
+ fn list_nodes ( & self ) -> Result < Vec < NodeInfo > , LightningError > ;
486
485
}
487
486
488
487
/// A wrapper struct used to implement the LightningNode trait (can be thought of as "the" lightning node). Passes
@@ -671,21 +670,15 @@ impl<T: SimNetwork> LightningNode for SimNode<'_, T> {
671
670
}
672
671
673
672
async fn get_node_info ( & mut self , node_id : & PublicKey ) -> Result < NodeInfo , LightningError > {
674
- Ok ( self . network . lock ( ) . await . lookup_node ( node_id) . await ?. 0 )
673
+ Ok ( self . network . lock ( ) . await . lookup_node ( node_id) ?. 0 )
675
674
}
676
675
677
676
async fn list_channels ( & mut self ) -> Result < Vec < u64 > , LightningError > {
678
- Ok ( self
679
- . network
680
- . lock ( )
681
- . await
682
- . lookup_node ( & self . info . pubkey )
683
- . await ?
684
- . 1 )
677
+ Ok ( self . network . lock ( ) . await . lookup_node ( & self . info . pubkey ) ?. 1 )
685
678
}
686
679
687
680
async fn get_graph ( & mut self ) -> Result < Graph , LightningError > {
688
- let nodes = self . network . lock ( ) . await . list_nodes ( ) . await ?;
681
+ let nodes = self . network . lock ( ) . await . list_nodes ( ) ?;
689
682
690
683
let mut nodes_by_pk = HashMap :: new ( ) ;
691
684
@@ -1066,7 +1059,6 @@ pub fn populate_network_graph<'a, C: Clock>(
1066
1059
Ok ( graph)
1067
1060
}
1068
1061
1069
- #[ async_trait]
1070
1062
impl SimNetwork for SimGraph {
1071
1063
/// dispatch_payment asynchronously propagates a payment through the simulated network, returning a tracking
1072
1064
/// channel that can be used to obtain the result of the payment. At present, MPP payments are not supported.
@@ -1109,7 +1101,7 @@ impl SimNetwork for SimGraph {
1109
1101
}
1110
1102
1111
1103
/// lookup_node fetches a node's information and channel capacities.
1112
- async fn lookup_node ( & self , node : & PublicKey ) -> Result < ( NodeInfo , Vec < u64 > ) , LightningError > {
1104
+ fn lookup_node ( & self , node : & PublicKey ) -> Result < ( NodeInfo , Vec < u64 > ) , LightningError > {
1113
1105
self . nodes
1114
1106
. get ( node)
1115
1107
. map ( |channels| ( node_info ( * node) , channels. clone ( ) ) )
@@ -1118,7 +1110,7 @@ impl SimNetwork for SimGraph {
1118
1110
) )
1119
1111
}
1120
1112
1121
- async fn list_nodes ( & self ) -> Result < Vec < NodeInfo > , LightningError > {
1113
+ fn list_nodes ( & self ) -> Result < Vec < NodeInfo > , LightningError > {
1122
1114
let mut nodes = vec ! [ ] ;
1123
1115
1124
1116
for node in & self . nodes {
@@ -1846,7 +1838,6 @@ mod tests {
1846
1838
mock ! {
1847
1839
Network { }
1848
1840
1849
- #[ async_trait]
1850
1841
impl SimNetwork for Network {
1851
1842
fn dispatch_payment(
1852
1843
& mut self ,
@@ -1856,8 +1847,8 @@ mod tests {
1856
1847
sender: Sender <Result <PaymentResult , LightningError >>,
1857
1848
) ;
1858
1849
1859
- async fn lookup_node( & self , node: & PublicKey ) -> Result <( NodeInfo , Vec <u64 >) , LightningError >;
1860
- async fn list_nodes( & self ) -> Result <Vec <NodeInfo >, LightningError >;
1850
+ fn lookup_node( & self , node: & PublicKey ) -> Result <( NodeInfo , Vec <u64 >) , LightningError >;
1851
+ fn list_nodes( & self ) -> Result <Vec <NodeInfo >, LightningError >;
1861
1852
}
1862
1853
}
1863
1854
0 commit comments