@@ -147,15 +147,15 @@ impl<C: Deref + Sync + Send, L: Deref + Sync + Send> RoutingMessageHandler for N
147
147
if let Some ( ( _, ref chan) ) = iter. next ( ) {
148
148
if chan. announcement_message . is_some ( ) {
149
149
let chan_announcement = chan. announcement_message . clone ( ) . unwrap ( ) ;
150
- let mut one_to_two_announcement : Option < msgs:: ChannelUpdate > = None ;
151
- let mut two_to_one_announcement : Option < msgs:: ChannelUpdate > = None ;
152
- if let Some ( one_to_two ) = chan. one_to_two . as_ref ( ) {
153
- one_to_two_announcement = one_to_two . last_update_message . clone ( ) ;
150
+ let mut alice_to_bob_announcement : Option < msgs:: ChannelUpdate > = None ;
151
+ let mut bob_to_alice_announcement : Option < msgs:: ChannelUpdate > = None ;
152
+ if let Some ( alice_to_bob ) = chan. alice_to_bob . as_ref ( ) {
153
+ alice_to_bob_announcement = alice_to_bob . last_update_message . clone ( ) ;
154
154
}
155
- if let Some ( two_to_one ) = chan. two_to_one . as_ref ( ) {
156
- two_to_one_announcement = two_to_one . last_update_message . clone ( ) ;
155
+ if let Some ( bob_to_alice ) = chan. bob_to_alice . as_ref ( ) {
156
+ bob_to_alice_announcement = bob_to_alice . last_update_message . clone ( ) ;
157
157
}
158
- result. push ( ( chan_announcement, one_to_two_announcement , two_to_one_announcement ) ) ;
158
+ result. push ( ( chan_announcement, alice_to_bob_announcement , bob_to_alice_announcement ) ) ;
159
159
} else {
160
160
// TODO: We may end up sending un-announced channel_updates if we are sending
161
161
// initial sync data while receiving announce/updates for this channel.
@@ -283,11 +283,11 @@ pub struct ChannelInfo {
283
283
/// Source node of the first direction of a channel
284
284
pub node_one : PublicKey ,
285
285
/// Details about the first direction of a channel
286
- pub one_to_two : Option < DirectionalChannelInfo > ,
286
+ pub alice_to_bob : Option < DirectionalChannelInfo > ,
287
287
/// Source node of the second direction of a channel
288
288
pub node_two : PublicKey ,
289
289
/// Details about the second direction of a channel
290
- pub two_to_one : Option < DirectionalChannelInfo > ,
290
+ pub bob_to_alice : Option < DirectionalChannelInfo > ,
291
291
/// An initial announcement of the channel
292
292
/// Mostly redundant with the data we store in fields explicitly.
293
293
/// Everything else is useful only for sending out for initial routing sync.
@@ -297,18 +297,18 @@ pub struct ChannelInfo {
297
297
298
298
impl std:: fmt:: Display for ChannelInfo {
299
299
fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> Result < ( ) , std:: fmt:: Error > {
300
- write ! ( f, "features: {}, node_one: {}, one_to_two : {:?}, node_two: {}, two_to_one : {:?}" ,
301
- log_bytes!( self . features. encode( ) ) , log_pubkey!( self . node_one) , self . one_to_two , log_pubkey!( self . node_two) , self . two_to_one ) ?;
300
+ write ! ( f, "features: {}, node_one: {}, alice_to_bob : {:?}, node_two: {}, bob_to_alice : {:?}" ,
301
+ log_bytes!( self . features. encode( ) ) , log_pubkey!( self . node_one) , self . alice_to_bob , log_pubkey!( self . node_two) , self . bob_to_alice ) ?;
302
302
Ok ( ( ) )
303
303
}
304
304
}
305
305
306
306
impl_writeable ! ( ChannelInfo , 0 , {
307
307
features,
308
308
node_one,
309
- one_to_two ,
309
+ alice_to_bob ,
310
310
node_two,
311
- two_to_one ,
311
+ bob_to_alice ,
312
312
announcement_message
313
313
} ) ;
314
314
@@ -550,8 +550,8 @@ impl NetworkGraph {
550
550
for route_hop in path {
551
551
let short_channel_id = route_hop. short_channel_id ;
552
552
if let Some ( channel) = self . channels . get_mut ( & short_channel_id) {
553
- channel. one_to_two . as_mut ( ) . unwrap ( ) . channel_score . payment_sent_score += 1 ;
554
- channel. two_to_one . as_mut ( ) . unwrap ( ) . channel_score . payment_sent_score += 1 ;
553
+ channel. alice_to_bob . as_mut ( ) . unwrap ( ) . channel_score . payment_sent_score += 1 ;
554
+ channel. bob_to_alice . as_mut ( ) . unwrap ( ) . channel_score . payment_sent_score += 1 ;
555
555
} else {
556
556
channel_down = true ;
557
557
continue ;
@@ -578,9 +578,9 @@ impl NetworkGraph {
578
578
let short_channel_id = route_hop. short_channel_id ;
579
579
let channel = self . channels . get_mut ( & short_channel_id) . unwrap ( ) ;
580
580
let directional_channel_info = if route_hop. pubkey == channel. node_one {
581
- channel. one_to_two . as_mut ( ) . unwrap ( )
581
+ channel. alice_to_bob . as_mut ( ) . unwrap ( )
582
582
} else {
583
- channel. two_to_one . as_mut ( ) . unwrap ( )
583
+ channel. bob_to_alice . as_mut ( ) . unwrap ( )
584
584
} ;
585
585
let channel_score = & mut directional_channel_info. channel_score ;
586
586
if faultive_nodes. contains ( & ( route_hop. pubkey ) ) {
@@ -645,9 +645,9 @@ impl NetworkGraph {
645
645
let chan_info = ChannelInfo {
646
646
features : msg. contents . features . clone ( ) ,
647
647
node_one : msg. contents . node_id_1 . clone ( ) ,
648
- one_to_two : None ,
648
+ alice_to_bob : None ,
649
649
node_two : msg. contents . node_id_2 . clone ( ) ,
650
- two_to_one : None ,
650
+ bob_to_alice : None ,
651
651
announcement_message : if should_relay { Some ( msg. clone ( ) ) } else { None } ,
652
652
} ;
653
653
@@ -710,11 +710,11 @@ impl NetworkGraph {
710
710
}
711
711
} else {
712
712
if let Some ( chan) = self . channels . get_mut ( & short_channel_id) {
713
- if let Some ( one_to_two ) = chan. one_to_two . as_mut ( ) {
714
- one_to_two . enabled = false ;
713
+ if let Some ( alice_to_bob ) = chan. alice_to_bob . as_mut ( ) {
714
+ alice_to_bob . enabled = false ;
715
715
}
716
- if let Some ( two_to_one ) = chan. two_to_one . as_mut ( ) {
717
- two_to_one . enabled = false ;
716
+ if let Some ( bob_to_alice ) = chan. bob_to_alice . as_mut ( ) {
717
+ bob_to_alice . enabled = false ;
718
718
}
719
719
}
720
720
}
@@ -780,13 +780,13 @@ impl NetworkGraph {
780
780
if let Some ( sig_verifier) = secp_ctx {
781
781
secp_verify_sig ! ( sig_verifier, & msg_hash, & msg. signature, & channel. node_two) ;
782
782
}
783
- maybe_update_channel_info ! ( channel. two_to_one , channel. node_two) ;
783
+ maybe_update_channel_info ! ( channel. bob_to_alice , channel. node_two) ;
784
784
} else {
785
785
dest_node_id = channel. node_two . clone ( ) ;
786
786
if let Some ( sig_verifier) = secp_ctx {
787
787
secp_verify_sig ! ( sig_verifier, & msg_hash, & msg. signature, & channel. node_one) ;
788
788
}
789
- maybe_update_channel_info ! ( channel. one_to_two , channel. node_one) ;
789
+ maybe_update_channel_info ! ( channel. alice_to_bob , channel. node_one) ;
790
790
}
791
791
}
792
792
}
@@ -811,9 +811,9 @@ impl NetworkGraph {
811
811
let chan = self . channels . get ( chan_id) . unwrap ( ) ;
812
812
let chan_info_opt;
813
813
if chan. node_one == dest_node_id {
814
- chan_info_opt = chan. two_to_one . as_ref ( ) ;
814
+ chan_info_opt = chan. bob_to_alice . as_ref ( ) ;
815
815
} else {
816
- chan_info_opt = chan. one_to_two . as_ref ( ) ;
816
+ chan_info_opt = chan. alice_to_bob . as_ref ( ) ;
817
817
}
818
818
if let Some ( chan_info) = chan_info_opt {
819
819
if chan_info. enabled {
@@ -1260,8 +1260,8 @@ mod tests {
1260
1260
match network. get_channels ( ) . get ( & short_channel_id) {
1261
1261
None => panic ! ( ) ,
1262
1262
Some ( channel_info) => {
1263
- assert_eq ! ( channel_info. one_to_two . as_ref( ) . unwrap( ) . cltv_expiry_delta, 144 ) ;
1264
- assert ! ( channel_info. two_to_one . is_none( ) ) ;
1263
+ assert_eq ! ( channel_info. alice_to_bob . as_ref( ) . unwrap( ) . cltv_expiry_delta, 144 ) ;
1264
+ assert ! ( channel_info. bob_to_alice . is_none( ) ) ;
1265
1265
}
1266
1266
}
1267
1267
}
@@ -1395,7 +1395,7 @@ mod tests {
1395
1395
match network. get_channels ( ) . get ( & short_channel_id) {
1396
1396
None => panic ! ( ) ,
1397
1397
Some ( channel_info) => {
1398
- assert ! ( channel_info. one_to_two . is_some( ) ) ;
1398
+ assert ! ( channel_info. alice_to_bob . is_some( ) ) ;
1399
1399
}
1400
1400
}
1401
1401
}
@@ -1413,7 +1413,7 @@ mod tests {
1413
1413
match network. get_channels ( ) . get ( & short_channel_id) {
1414
1414
None => panic ! ( ) ,
1415
1415
Some ( channel_info) => {
1416
- assert ! ( !channel_info. one_to_two . as_ref( ) . unwrap( ) . enabled) ;
1416
+ assert ! ( !channel_info. alice_to_bob . as_ref( ) . unwrap( ) . enabled) ;
1417
1417
}
1418
1418
}
1419
1419
}
@@ -1803,7 +1803,7 @@ mod tests {
1803
1803
let mut network = net_graph_msg_handler. network_graph . write ( ) . unwrap ( ) ;
1804
1804
let chan_id = network. get_nodes ( ) . get ( & node_id_1) . unwrap ( ) . channels [ 0 ] ;
1805
1805
let channel_info = network. channels . get_mut ( & chan_id) . unwrap ( ) ;
1806
- // Assign a DirectionalChannelInfo and ChannelScore object to one_to_two of
1806
+ // Assign a DirectionalChannelInfo and ChannelScore object to alice_to_bob of
1807
1807
// channel_info
1808
1808
let chan_score_1 = ChannelScore {
1809
1809
payment_sent_score : 0 ,
@@ -1838,11 +1838,11 @@ mod tests {
1838
1838
channel_score : chan_score_2,
1839
1839
} ;
1840
1840
1841
- channel_info. one_to_two = Some ( dir_chan_info_1) ;
1842
- channel_info. two_to_one = Some ( dir_chan_info_2) ;
1843
- let dir_one_to_two = channel_info. one_to_two . as_mut ( ) . unwrap ( ) ;
1844
- assert_eq ! ( dir_one_to_two . channel_score. payment_sent_score, 0 ) ;
1845
- assert_eq ! ( dir_one_to_two . channel_score. payment_failed_score, 0 ) ;
1841
+ channel_info. alice_to_bob = Some ( dir_chan_info_1) ;
1842
+ channel_info. bob_to_alice = Some ( dir_chan_info_2) ;
1843
+ let dir_alice_to_bob = channel_info. alice_to_bob . as_mut ( ) . unwrap ( ) ;
1844
+ assert_eq ! ( dir_alice_to_bob . channel_score. payment_sent_score, 0 ) ;
1845
+ assert_eq ! ( dir_alice_to_bob . channel_score. payment_failed_score, 0 ) ;
1846
1846
}
1847
1847
1848
1848
{
@@ -1864,9 +1864,9 @@ mod tests {
1864
1864
// Check that score_payment_sent_for_route incremented the appropriate ChannelScore
1865
1865
let chan_id = network. get_nodes ( ) . get ( & node_id_1) . unwrap ( ) . channels [ 0 ] ;
1866
1866
let channel_info = network. channels . get_mut ( & chan_id) . unwrap ( ) ;
1867
- let dir_one_to_two = & channel_info. one_to_two . as_ref ( ) ;
1868
- assert_eq ! ( dir_one_to_two . unwrap( ) . channel_score. payment_sent_score, 1 ) ;
1869
- assert_eq ! ( dir_one_to_two . unwrap( ) . channel_score. payment_failed_score, 0 ) ;
1867
+ let dir_alice_to_bob = & channel_info. alice_to_bob . as_ref ( ) ;
1868
+ assert_eq ! ( dir_alice_to_bob . unwrap( ) . channel_score. payment_sent_score, 1 ) ;
1869
+ assert_eq ! ( dir_alice_to_bob . unwrap( ) . channel_score. payment_failed_score, 0 ) ;
1870
1870
}
1871
1871
1872
1872
{
@@ -1890,9 +1890,9 @@ mod tests {
1890
1890
let chan_id = network. get_nodes ( ) . get ( & node_id_1) . unwrap ( ) . channels [ 0 ] ;
1891
1891
let channel_info = network. channels . get_mut ( & chan_id) . unwrap ( ) ;
1892
1892
assert ! ( channel_info. node_two == node_id_2) ;
1893
- let dir_one_to_two = & channel_info. one_to_two . as_ref ( ) ;
1894
- assert_eq ! ( dir_one_to_two . unwrap( ) . channel_score. payment_sent_score, 1 ) ;
1895
- assert_eq ! ( dir_one_to_two . unwrap( ) . channel_score. payment_failed_score, 1 ) ;
1893
+ let dir_alice_to_bob = & channel_info. alice_to_bob . as_ref ( ) ;
1894
+ assert_eq ! ( dir_alice_to_bob . unwrap( ) . channel_score. payment_sent_score, 1 ) ;
1895
+ assert_eq ! ( dir_alice_to_bob . unwrap( ) . channel_score. payment_failed_score, 1 ) ;
1896
1896
}
1897
1897
}
1898
1898
}
0 commit comments