projects
/
rust-lightning
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
de9fba8
)
Add node id to custom message callback
author
Tibo-lg
<thibaut@cryptogarage.co.jp>
Tue, 14 Sep 2021 06:40:10 +0000
(15:40 +0900)
committer
Tibo-lg
<thibaut@cryptogarage.co.jp>
Wed, 15 Sep 2021 00:29:29 +0000
(09:29 +0900)
lightning/src/ln/peer_handler.rs
patch
|
blob
|
history
diff --git
a/lightning/src/ln/peer_handler.rs
b/lightning/src/ln/peer_handler.rs
index 34bcda3a009a850b780bfffd6d4c087eb0256b28..3c6e6b191aae71b095c53f0b843858b6d90122db 100644
(file)
--- a/
lightning/src/ln/peer_handler.rs
+++ b/
lightning/src/ln/peer_handler.rs
@@
-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.
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
/// 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
@@
-102,7
+102,7
@@
impl wire::CustomMessageReader for IgnoringMessageHandler {
}
impl CustomMessageHandler 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!();
}
// Since we always return `None` in the read the handle method should never be called.
unreachable!();
}
@@
-1087,7
+1087,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) => {
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)
},
};
Ok(should_forward)