-
Notifications
You must be signed in to change notification settings - Fork 385
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
Rename network-related types #1159
Rename network-related types #1159
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1159 +/- ##
==========================================
+ Coverage 90.14% 90.17% +0.02%
==========================================
Files 70 70
Lines 36448 36448
==========================================
+ Hits 32856 32866 +10
+ Misses 3592 3582 -10
Continue to review full report at Codecov.
|
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.
Only one I'm eh on is ChannelFailure
because I like the symmetry with Event::ChannelClosed
and we already kinda tend to deviate from the spec on word choice (which I think is good)
I guess it wouldn't be crazy if NetworkGossip
were just changed to Gossip
?
Looks good as is though, nice improvement!
/// If permanent, removes a channel from the local storage. | ||
/// May cause the removal of nodes too, if this was their last channel. | ||
/// If not permanent, makes channels unavailable for routing. | ||
pub fn close_channel_from_update(&self, short_channel_id: u64, is_permanent: bool) { | ||
pub fn fail_channel(&self, short_channel_id: u64, is_permanent: bool) { |
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.
suggestion: prefer channel_failed
because imo the gossip
isn't the one failing the channel
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.
Also renamed fail_node
.
lol it was your idea to rename it... 😛 Note that this is describing why a payment failed (BOLT 4). The channel itself might not be closed, which should be determined by monitoring the blockchain according to BOLT 7. Although only tangentially related, looking through BOLT 4, I think the intention is that a channel failure either has a pub struct RoutingFailure {
cause: RoutingFailureCause,
is_permanent: bool,
}
pub enum RoutingFailureCause {
Channel {
short_channel_id: u64,
update: Option<ChannelUpdate>,
},
Node {
node_id: PublicKey,
}
} (Though it's kinda strange that anything with Then
Hmm... I sorta like the symmetry with the other types in |
f506f4d
to
44f31d6
Compare
I don't really understand the reason behind renaming |
Lol!! Oh right... Disregard that 😛 |
IMHO,
I was thinking about this name in the context of it being a submodule of |
44f31d6
to
1a9ff7e
Compare
Fair.
I dunno if I buy the "it implements a specific trait as its main raison d'être, so the name shouldn't reference that" argument - it exists to handle the messages, trait implementation is somewhat hidden in both rustdoc and other languages, so I feel like its good to communicate that in the object naming? I don't think I have a specific alternative to propose, but maybe GraphGossipMessageHandler or GraphGossiper? |
Needs rebase. |
really needs rebase lol |
How about I don't feel very strongly about renaming the module, so fully expressed it wold be either |
I'm not sure that it does?
I don't feel super strongly about it either, but I like your above suggestion of |
Discussed offline. Will name it
SGTM, let's go with |
1a9ff7e
to
c2ed78a
Compare
Codecov Report
@@ Coverage Diff @@
## main #1159 +/- ##
==========================================
+ Coverage 90.94% 91.32% +0.37%
==========================================
Files 80 80
Lines 43250 45740 +2490
Branches 43250 45740 +2490
==========================================
+ Hits 39335 41772 +2437
- Misses 3915 3968 +53
Continue to review full report at Codecov.
|
Oops, looks like Edit: Never mind, it did |
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. Feel free to squash IMO.
/// An error indicating only that a channel has been closed, which should be applied via | ||
/// [`NetworkGraph::close_channel_from_update`]. | ||
ChannelClosed { | ||
/// An error indicating only that a channel has failed, which should be applied via |
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 think it'd be nice to elaborate on what "failed" means here
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.
Done. Let me know if you'd prefer a different elaboration.
c2ed78a
to
7976512
Compare
7976512
to
d7a1b2f
Compare
LGTM (still) feel free to squash. |
A NetworkUpdate indicating ChannelClosed actually corresponds to a channel failure as described in BOLT 4: 0x2000 (NODE): node failure (otherwise channel) Rename the enum variant to ChannelFailure and rename NetworkGraph methods close_channel_from_update and fail_node to channel_failed and node_failed, respectively.
NetGraphMsgHandler implements RoutingMessageHandler to handle gossip messages defined in BOLT 7 and maintains a view of the network by updating NetworkGraph. Rename it to P2PGossipSync, which better describes its purpose, and to contrast with RapidGossipSync.
The routing::network_graph module contains a few structs related to p2p gossip. So renaming the module to 'gossip' seems more appropriate.
d7a1b2f
to
574870e
Compare
Rename some network-related types to be a bit more intuitive:
NetworkUpdate::ChannelClosed
enum variant toNetworkUpdate::ChannelFailure
NetGraphMsgHandler
struct toNetworkGossip
P2PGossipSync
network_graph
module tonetwork
gossip