File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -1529,19 +1529,12 @@ impl<L: Deref> NetworkGraph<L> where L::Target: Logger {
1529
1529
let mut nodes = self . nodes . write ( ) . unwrap ( ) ;
1530
1530
let mut channels = self . channels . write ( ) . unwrap ( ) ;
1531
1531
1532
- let mut scids_to_remove = Vec :: new ( ) ;
1533
- for ( scid, info) in channels. iter_mut ( ) {
1534
- if info. node_one == node_id || info. node_two == node_id {
1535
- scids_to_remove. push ( * scid) ;
1536
- }
1537
- }
1538
- nodes. remove ( & node_id) ;
1539
-
1540
- if !scids_to_remove. is_empty ( ) {
1541
- // TODO: Use BTreeMap::retain when our MSRV is >= 1.53.
1542
- for scid in scids_to_remove {
1543
- let info = channels. remove ( & scid) . expect ( "We just accessed this scid, it should be present" ) ;
1544
- Self :: remove_channel_in_nodes ( & mut nodes, & info, scid) ;
1532
+ if let Some ( node) = nodes. remove ( & node_id) {
1533
+ for scid in node. channels . iter ( ) {
1534
+ // TODO: Use BTreeMap::retain when our MSRV is >= 1.53.
1535
+ if let Some ( info) = channels. remove ( scid) {
1536
+ Self :: remove_channel_in_nodes ( & mut nodes, & info, * scid) ;
1537
+ }
1545
1538
}
1546
1539
}
1547
1540
}
You can’t perform that action at this time.
0 commit comments