Skip to content
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

Add fee and initiator to Pending Channels RPC #4111

Merged

Conversation

carlaKC
Copy link
Collaborator

@carlaKC carlaKC commented Mar 24, 2020

This PR adds channel initiator and fee fields the the pending channels messages where they are missing. It also deprecates the pending_close_channels field, which was kept around to cover the case where somebody upgraded their node after cooperatively closing their channel, but before the close tx confirmed. The change was made in 2018, and pending close is only a temporary state, so it is acceptable to deprecate it. Adding channels to the deprecated field is replaced with a warning log, in case somebody with an old node upgrades and hits this edge case.

Fixes: #4067

Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

LGTM, another set of useful fields added 🎉

lnrpc/rpc.proto Outdated Show resolved Hide resolved
lnrpc/rpc.proto Outdated
@@ -2096,8 +2096,7 @@ message PendingChannelsResponse {
/// Channels pending opening
repeated PendingOpenChannel pending_open_channels = 2;

/// Channels pending closing
repeated ClosedChannel pending_closing_channels = 3;
reserved 3;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if we should first set it to pending_closing_channels = 3 [deprecated = true]; first and just not fill it any more? Then remove it in the next version? Not sure what the reserved does for clients that use a previous RPC client?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree, I too think deprecating first is the better way to do this. (Can even leave it deprecated).

Copy link
Collaborator

@bhandras bhandras left a comment

Choose a reason for hiding this comment

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

LGTM 🌮

rpcserver.go Outdated Show resolved Hide resolved
lnrpc/rpc.proto Outdated Show resolved Hide resolved
lnrpc/rpc.proto Outdated
@@ -2096,8 +2096,7 @@ message PendingChannelsResponse {
/// Channels pending opening
repeated PendingOpenChannel pending_open_channels = 2;

/// Channels pending closing
repeated ClosedChannel pending_closing_channels = 3;
reserved 3;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree, I too think deprecating first is the better way to do this. (Can even leave it deprecated).

The pending closing channels field was present to cover an edge case
where coperatively closed channels were closed before upgrade and
confirmed after the upgrade. This commit deprecates the field and adds
a warning log to cover these edge cases.
@carlaKC carlaKC force-pushed the 4067-pendingchannelsrpcadditions branch from 1e875fa to 9e1cdb7 Compare March 25, 2020 06:48
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

LGTM 💯

case channeldb.ErrChannelNotFound:

case nil:
channel.Initiator = historical.IsInitiator
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the field distinguish between non-initiator and a legacy channel for which no history is present?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hm yes it should, at the time I thought we wouldn't have legacy channels in pending, but there is of course the old upgrade path option of a channel closing before upgrade, and list pending after. This should use the Initiator enum.

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.

local/remote balances and channel phases clarification
5 participants