@@ -1271,20 +1271,22 @@ macro_rules! update_maps_on_chan_removal {
1271
1271
let mut id_to_peer = $self. id_to_peer. lock( ) . unwrap( ) ;
1272
1272
id_to_peer. remove( & $channel. channel_id( ) ) ;
1273
1273
}
1274
- let mut short_to_chan_info = $self. short_to_chan_info. write( ) . unwrap( ) ;
1275
- if let Some ( short_id) = $channel. get_short_channel_id( ) {
1276
- short_to_chan_info. remove( & short_id) ;
1277
- } else {
1278
- // If the channel was never confirmed on-chain prior to its closure, remove the
1279
- // outbound SCID alias we used for it from the collision-prevention set. While we
1280
- // generally want to avoid ever re-using an outbound SCID alias across all channels, we
1281
- // also don't want a counterparty to be able to trivially cause a memory leak by simply
1282
- // opening a million channels with us which are closed before we ever reach the funding
1283
- // stage.
1284
- let alias_removed = $self. outbound_scid_aliases. lock( ) . unwrap( ) . remove( & $channel. outbound_scid_alias( ) ) ;
1285
- debug_assert!( alias_removed) ;
1286
- }
1287
- short_to_chan_info. remove( & $channel. outbound_scid_alias( ) ) ;
1274
+ {
1275
+ let mut short_to_chan_info = $self. short_to_chan_info. write( ) . unwrap( ) ;
1276
+ if let Some ( short_id) = $channel. get_short_channel_id( ) {
1277
+ short_to_chan_info. remove( & short_id) ;
1278
+ } else {
1279
+ // If the channel was never confirmed on-chain prior to its closure, remove the
1280
+ // outbound SCID alias we used for it from the collision-prevention set. While we
1281
+ // generally want to avoid ever re-using an outbound SCID alias across all channels, we
1282
+ // also don't want a counterparty to be able to trivially cause a memory leak by simply
1283
+ // opening a million channels with us which are closed before we ever reach the funding
1284
+ // stage.
1285
+ let alias_removed = $self. outbound_scid_aliases. lock( ) . unwrap( ) . remove( & $channel. outbound_scid_alias( ) ) ;
1286
+ debug_assert!( alias_removed) ;
1287
+ }
1288
+ short_to_chan_info. remove( & $channel. outbound_scid_alias( ) ) ;
1289
+ }
1288
1290
}
1289
1291
}
1290
1292
0 commit comments