Skip to content

Commit

Permalink
Merge pull request #3311 from TheBlueMatt/2024-09-3010-followups
Browse files Browse the repository at this point in the history
Quick #3010 followups
  • Loading branch information
TheBlueMatt authored Sep 30, 2024
2 parents a661c92 + d156b2e commit c7627df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions lightning/src/ln/offers_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,7 @@ fn creates_and_pays_for_offer_with_retry() {
expect_recent_payment!(bob, RecentPaymentDetails::AwaitingInvoice, payment_id);

let _lost_onion_message = bob.onion_messenger.next_onion_message_for_peer(alice_id).unwrap();
assert!(bob.onion_messenger.next_onion_message_for_peer(alice_id).is_none());

// Simulate a scenario where the original onion_message is lost before reaching Alice.
// Use handle_message_received to regenerate the message.
Expand Down
13 changes: 7 additions & 6 deletions lightning/src/ln/peer_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1618,14 +1618,15 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
let their_node_id = peer_lock.their_node_id.expect("We know the peer's public key by the time we receive messages").0;
let logger = WithContext::from(&self.logger, Some(their_node_id), None, None);

let unprocessed_message = self.do_handle_message_holding_peer_lock(peer_lock, message, their_node_id, &logger)?;

self.message_handler.chan_handler.message_received();

let message = match self.do_handle_message_holding_peer_lock(peer_lock, message, their_node_id, &logger)? {
Some(processed_message) => processed_message,
None => return Ok(None),
};

self.do_handle_message_without_peer_lock(peer_mutex, message, their_node_id, &logger)
if let Some(message) = unprocessed_message {
self.do_handle_message_without_peer_lock(peer_mutex, message, their_node_id, &logger)
} else {
Ok(None)
}
}

// Conducts all message processing that requires us to hold the `peer_lock`.
Expand Down

0 comments on commit c7627df

Please sign in to comment.