-
Notifications
You must be signed in to change notification settings - Fork 412
Misc peer_handler.rs
cleanups and fixes
#3865
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
Misc peer_handler.rs
cleanups and fixes
#3865
Conversation
👋 I see @jkczyz was un-assigned. |
@@ -2186,8 +2186,7 @@ where | |||
if peer_lock.message_batch.is_some() { | |||
let error = format!( | |||
"Peer {} sent start_batch for channel {} before previous batch completed", | |||
their_node_id, | |||
&msg.channel_id | |||
their_node_id, &msg.channel_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised rustfmt
does this. Is this a new format!
-specific thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As was I! This is the MSRV rustfmt
version, so its not new, and it has done it in other place in our code.
8123ac6
to
fe634cf
Compare
Addressed feedback. |
fe634cf
to
4c1e8cf
Compare
4c1e8cf
to
81642f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically looks good, one question. Feel free to squash fixups, IMO.
81642f3
to
955d18e
Compare
Squashed and rebased without further changes. |
In e620310 we prep'd `peer_handler.rs` for `rustfmt`, but left a few misc things kinda ugly, which we clean up here.
In 9db37f2 we introduced a `send_only_message_handler` which was intended to be used to send messages to peers. However, when we did so we forgot to add calls to its `peer_connected`, `peer_disconnected`, `provided_node_features`, and `provided_init_features` methods. Here we add those methods, updating the comment somewhat to avoid implying that they won't be called.
Our `peer_connected` methods can return `Err(())` to cause the peer to be immediately disconnected. The documentation for them, however, only described the specific case of using this to enforce minimal set of per feature bits. Instead, here, we tweak the documentation to describe the high-level utility, and only mention enforcing peer feature bits as an example use-case.
In 81e89d8 we added handling for sending peer storage messages, however forgot to include the peer's node_id in the log metadata when sending such messages.
`log_pubkey` is an old macro we used to format `PublicKey`s before they supported native `Display` upstream. They do, however, implement `Dispaly` now by logging the compressed public key in hex, so there's no need for `log_pubkey!()`
In c0fbe42 we ran `rustfmt` on some code in `channel.rs`, which broke some comments which referred to code on a specific line. Here we fix those comments.
955d18e
to
90d3961
Compare
Rebased to remove the addition of some new |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3865 +/- ##
==========================================
- Coverage 89.72% 89.69% -0.03%
==========================================
Files 164 164
Lines 133333 133349 +16
Branches 133333 133349 +16
==========================================
- Hits 119627 119614 -13
- Misses 11031 11053 +22
- Partials 2675 2682 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.