Skip to content

Move a ton of Channel functions to ChannelError from HandleError #254

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
merged 3 commits into from
Nov 21, 2018

Conversation

TheBlueMatt
Copy link
Collaborator

This is a big patch, but its all very mechanical, everything here
should be pretty obvious, and it all has to happen at once due to a
few common utility functions all having the same return type.

Note that this exposes a race in channel closure where we may
access a channel via some non-peer-specific mechanism like
forwarding an HTLC or sending a payment during the time between
the channel gave us a Close error and expected us to never call it
again and the time we actually removed it from the channel_state
set outside of the internal_* handler.

Refactor of channelmanager message handlers for that incoming....

$self.force_close_channel(&msg.channel_id);
}
},
&Some(msgs::ErrorAction::DisconnectPeer { msg: None }) => {},
Copy link

Choose a reason for hiding this comment

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

Even if it's just a move and was already like that, but why we don't peer_disconnected here too ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we're just disconnecting them but not sending an error message we shouldn't be closing the channel. In the future you might imagine disconnecting a peer without closing the channels associated with that peer to try to recover from some state inconsistency.

@ariard
Copy link

ariard commented Nov 20, 2018

utACK, good luck for coming refactors.
Moving away from a big lock for channel_state is a 0.2 goal ?

@TheBlueMatt
Copy link
Collaborator Author

TheBlueMatt commented Nov 20, 2018

Rebased. Indeed, I'm in no rush for per-channel locks, if someone feels like doing it, great, but its gonna conflict a bunch so maybe let some bigger stuff land first anyway.

This is a big patch, but its all very mechanical, everything here
should be pretty obvious, and it all has to happen at once due to a
few common utility functions all having the same return type.

Note that this exposes a race in channel closure where we may
access a channel via some non-peer-specific mechanism like
forwarding an HTLC or sending a payment during the time between
the channel gave us a Close error and expected us to never call it
again and the time we actually removed it from the channel_state
set outside of the internal_* handler.
@TheBlueMatt
Copy link
Collaborator Author

Rebased after #231 with two extra tiny fixes in tests. Will merge once travis passes.

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.

2 participants