Skip to content

Commit 24065c8

Browse files
authored
Merge pull request lightningdevkit#1074 from p2pderivatives/add-node-id-to-custom-msg-cb
Add node id to custom message callback
2 parents 35573bb + 2c6a078 commit 24065c8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lightning/src/ln/peer_handler.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use bitcoin::hashes::{HashEngine, Hash};
4747
pub trait CustomMessageHandler: wire::CustomMessageReader {
4848
/// Called with the message type that was received and the buffer to be read.
4949
/// Can return a `MessageHandlingError` if the message could not be handled.
50-
fn handle_custom_message(&self, msg: Self::CustomMessage) -> Result<(), LightningError>;
50+
fn handle_custom_message(&self, msg: Self::CustomMessage, sender_node_id: &PublicKey) -> Result<(), LightningError>;
5151

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

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

0 commit comments

Comments
 (0)