Skip to content

Commit e8d0711

Browse files
Tweak pending_htlc_intercepts ser on manager read
Makes an upcoming commit cleaner
1 parent ed3af07 commit e8d0711

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17302,7 +17302,7 @@ where
1730217302
// forwards from the `Channel{Monitor}`s instead, as a step towards getting rid of
1730317303
// `ChannelManager` persistence.
1730417304
let mut pending_intercepted_htlcs_legacy: Option<HashMap<InterceptId, PendingAddHTLCInfo>> =
17305-
Some(new_hash_map());
17305+
None;
1730617306
let mut decode_update_add_htlcs_legacy: Option<HashMap<u64, Vec<msgs::UpdateAddHTLC>>> =
1730717307
None;
1730817308

@@ -17351,6 +17351,8 @@ where
1735117351
});
1735217352
let mut decode_update_add_htlcs_legacy =
1735317353
decode_update_add_htlcs_legacy.unwrap_or_else(|| new_hash_map());
17354+
let mut pending_intercepted_htlcs_legacy =
17355+
pending_intercepted_htlcs_legacy.unwrap_or_else(|| new_hash_map());
1735417356
let peer_storage_dir: Vec<(PublicKey, Vec<u8>)> = peer_storage_dir.unwrap_or_else(Vec::new);
1735517357
if fake_scid_rand_bytes.is_none() {
1735617358
fake_scid_rand_bytes = Some(args.entropy_source.get_secure_random_bytes());
@@ -17741,7 +17743,7 @@ where
1774117743
});
1774217744
!forwards.is_empty()
1774317745
});
17744-
pending_intercepted_htlcs_legacy.as_mut().unwrap().retain(|intercepted_id, htlc_info| {
17746+
pending_intercepted_htlcs_legacy.retain(|intercepted_id, htlc_info| {
1774517747
if pending_forward_matches_htlc(&htlc_info) {
1774617748
log_info!(logger, "Removing pending intercepted HTLC with hash {} as it was forwarded to the closed channel {}",
1774717749
&htlc.payment_hash, &monitor.channel_id());
@@ -18239,7 +18241,7 @@ where
1823918241

1824018242
inbound_payment_key: expanded_inbound_key,
1824118243
pending_outbound_payments: pending_outbounds,
18242-
pending_intercepted_htlcs: Mutex::new(pending_intercepted_htlcs_legacy.unwrap()),
18244+
pending_intercepted_htlcs: Mutex::new(pending_intercepted_htlcs_legacy),
1824318245

1824418246
forward_htlcs: Mutex::new(forward_htlcs_legacy),
1824518247
decode_update_add_htlcs: Mutex::new(decode_update_add_htlcs_legacy),

0 commit comments

Comments
 (0)