Skip to content

Add node id to custom message callback #1074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Tibo-lg
Copy link
Contributor

@Tibo-lg Tibo-lg commented Sep 14, 2021

While trying to integrate the rust-lightning custom message handler with my code I realized that I was missing the ability to access the node id of the originating node... (sorry for that but hopefully I'm probably the only one using this feature for now)

@codecov
Copy link

codecov bot commented Sep 14, 2021

Codecov Report

Merging #1074 (2c6a078) into main (de9fba8) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1074      +/-   ##
==========================================
- Coverage   90.83%   90.83%   -0.01%     
==========================================
  Files          65       65              
  Lines       33281    33281              
==========================================
- Hits        30232    30231       -1     
- Misses       3049     3050       +1     
Impacted Files Coverage Δ
lightning/src/ln/peer_handler.rs 45.78% <0.00%> (ø)
lightning/src/ln/functional_tests.rs 97.49% <0.00%> (-0.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update de9fba8...2c6a078. Read the comment docs.

@@ -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, org: &PublicKey) -> Result<(), LightningError>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename org to something more descriptive like "sender_node_id"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better indeed updated

@Tibo-lg Tibo-lg force-pushed the add-node-id-to-custom-msg-cb branch from 3c44988 to 2c6a078 Compare September 15, 2021 00:29
@TheBlueMatt TheBlueMatt added this to the 0.0.101 milestone Sep 15, 2021
@TheBlueMatt TheBlueMatt merged commit 24065c8 into lightningdevkit:main Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants