Skip to content

Commit b9f5fd6

Browse files
Actually remove forward<>intercepted htlcs lock dep
8513341 purported to remove a lock dependency between ChannelManager::pending_intercepted_htlcs and ::forward_htlcs. However, in practice the dependency remained because the locks of the two maps were still held at the same time in some cases. Here we fix this.
1 parent cd85a80 commit b9f5fd6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10776,7 +10776,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1077610776
// Pull this now to avoid introducing a lock order with `forward_htlcs`.
1077710777
let is_our_scid = self.short_to_chan_info.read().unwrap().contains_key(&scid);
1077810778

10779-
let mut forward_htlcs = self.forward_htlcs.lock().unwrap();
1078010779
let payment_hash = forward_info.payment_hash;
1078110780
let logger = WithContext::from(
1078210781
&self.logger,
@@ -10878,7 +10877,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1087810877
},
1087910878
}
1088010879
} else {
10881-
match forward_htlcs.entry(scid) {
10880+
match self.forward_htlcs.lock().unwrap().entry(scid) {
1088210881
hash_map::Entry::Occupied(mut entry) => {
1088310882
entry.get_mut().push(HTLCForwardInfo::AddHTLC(pending_add));
1088410883
},

0 commit comments

Comments
 (0)