Skip to content

Commit

Permalink
Merge pull request #1074 from p2pderivatives/add-node-id-to-custom-ms…
Browse files Browse the repository at this point in the history
…g-cb

Add node id to custom message callback
  • Loading branch information
TheBlueMatt committed Sep 15, 2021
2 parents 35573bb + 2c6a078 commit 24065c8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lightning/src/ln/peer_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use bitcoin::hashes::{HashEngine, Hash};
pub trait CustomMessageHandler: wire::CustomMessageReader {
/// Called with the message type that was received and the buffer to be read.
/// Can return a `MessageHandlingError` if the message could not be handled.
fn handle_custom_message(&self, msg: Self::CustomMessage) -> Result<(), LightningError>;
fn handle_custom_message(&self, msg: Self::CustomMessage, sender_node_id: &PublicKey) -> Result<(), LightningError>;

/// Gets the list of pending messages which were generated by the custom message
/// handler, clearing the list in the process. The first tuple element must
Expand Down Expand Up @@ -101,7 +101,7 @@ impl wire::CustomMessageReader for IgnoringMessageHandler {
}

impl CustomMessageHandler for IgnoringMessageHandler {
fn handle_custom_message(&self, _msg: Self::CustomMessage) -> Result<(), LightningError> {
fn handle_custom_message(&self, _msg: Self::CustomMessage, _sender_node_id: &PublicKey) -> Result<(), LightningError> {
// Since we always return `None` in the read the handle method should never be called.
unreachable!();
}
Expand Down Expand Up @@ -1086,7 +1086,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
log_trace!(self.logger, "Received unknown odd message of type {}, ignoring", type_id);
},
wire::Message::Custom(custom) => {
self.custom_message_handler.handle_custom_message(custom)?;
self.custom_message_handler.handle_custom_message(custom, &peer.their_node_id.unwrap())?;
},
};
Ok(should_forward)
Expand Down

0 comments on commit 24065c8

Please sign in to comment.