Skip to content

Commit 1a75d90

Browse files
Tweak pending_htlc_intercepts ser on manager read
Makes an upcoming commit cleaner
1 parent e16be9f commit 1a75d90

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
@@ -17307,7 +17307,7 @@ where
1730717307
// set from the `Channel{Monitor}`s instead, as a step towards removing the requirement of
1730817308
// regularly persisting the `ChannelManager`.
1730917309
let mut pending_intercepted_htlcs_legacy: Option<HashMap<InterceptId, PendingAddHTLCInfo>> =
17310-
Some(new_hash_map());
17310+
None;
1731117311
let mut decode_update_add_htlcs_legacy: Option<HashMap<u64, Vec<msgs::UpdateAddHTLC>>> =
1731217312
None;
1731317313

@@ -17356,6 +17356,8 @@ where
1735617356
});
1735717357
let mut decode_update_add_htlcs_legacy =
1735817358
decode_update_add_htlcs_legacy.unwrap_or_else(|| new_hash_map());
17359+
let mut pending_intercepted_htlcs_legacy =
17360+
pending_intercepted_htlcs_legacy.unwrap_or_else(|| new_hash_map());
1735917361
let peer_storage_dir: Vec<(PublicKey, Vec<u8>)> = peer_storage_dir.unwrap_or_else(Vec::new);
1736017362
if fake_scid_rand_bytes.is_none() {
1736117363
fake_scid_rand_bytes = Some(args.entropy_source.get_secure_random_bytes());
@@ -17746,7 +17748,7 @@ where
1774617748
});
1774717749
!forwards.is_empty()
1774817750
});
17749-
pending_intercepted_htlcs_legacy.as_mut().unwrap().retain(|intercepted_id, htlc_info| {
17751+
pending_intercepted_htlcs_legacy.retain(|intercepted_id, htlc_info| {
1775017752
if pending_forward_matches_htlc(&htlc_info) {
1775117753
log_info!(logger, "Removing pending intercepted HTLC with hash {} as it was forwarded to the closed channel {}",
1775217754
&htlc.payment_hash, &monitor.channel_id());
@@ -18244,7 +18246,7 @@ where
1824418246

1824518247
inbound_payment_key: expanded_inbound_key,
1824618248
pending_outbound_payments: pending_outbounds,
18247-
pending_intercepted_htlcs: Mutex::new(pending_intercepted_htlcs_legacy.unwrap()),
18249+
pending_intercepted_htlcs: Mutex::new(pending_intercepted_htlcs_legacy),
1824818250

1824918251
forward_htlcs: Mutex::new(forward_htlcs_legacy),
1825018252
decode_update_add_htlcs: Mutex::new(decode_update_add_htlcs_legacy),

0 commit comments

Comments
 (0)