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

lnrpc+itest: return channel Memo for Pending channels #7728

Merged
merged 1 commit into from
Jun 16, 2023

Conversation

shaurya947
Copy link
Contributor

Change Description

In a previous PR #7668 we added a Memo field for channels that could be specified when opening a channel. This was a reference note-to-self with no bearing on the functioning of the channel. In that PR, the memo value was returned only through ListChannels. This PR builds upon that PR by also returning the Memo field for pending open and waiting close channels.

Steps to Test

An itest has been updated to verify that the Memo is returned but to manually test, one can verify the Memo field on a pending-open or waiting-close channel

Pull Request Checklist

Testing

  • Your PR passes all CI checks.
  • Tests covering the positive and negative (error paths) are included.
  • Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

📝 Please see our Contribution Guidelines for further guidance.

@shaurya947
Copy link
Contributor Author

shaurya947 commented May 25, 2023

Hey @guggero and @positiveblue I created this follow-up PR to add the Memo field to the PendingChannels response. To avoid bloating the itest suite (as was recommended in the last PR), I've added small bit of extra logic to an existing itest. I also haven't edited release notes—I read over the note from the last PR and I think it sufficiently covers this change as well. Let me know if all that is ok or if I should do something differently.

One thing to note is that PendingChannels returns three types of channels:

  1. pending open
  2. pending force close
  3. waiting close

(1) and (3) fetch from the openChannelBucket and populate using channeldb.OpenChannel instance so the Memo field is present and all we do is pass it along in the protobuf message. That is this PR currently.

(2) on the other hand fetches from the closedChannelBucket and populates using channeldb.ChannelCloseSummary so the Memo field is not available (neither in the bucket nor in the deserialized struct).

Should we update the code that marks a channel as closed (thereby moving it from the open -> closed bucket) to also serialize the Memo in closedChannelBucket? And should we update the ChannelCloseSummary when deserializing for (2)? I guess the underlying question is at what point does the Memo stop being useful? If the answer is "never" then we should probably also return it in ClosedChannels?

@guggero
Copy link
Collaborator

guggero commented May 25, 2023

Let me know if all that is ok or if I should do something differently.

No entry in the release notes is fine, I added the no-changelog label that makes the CI ignore that step (will work for the next push).

If the answer is "never" then we should probably also return it in ClosedChannels?

I think the memo is definitely helpful for pending force closed or fully closed channels. So adding it to the ChannelCloseSummary is a good idea. I don't know if we already have TLV values there, so it might be a bit more involved.

Copy link
Collaborator

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

I think the skip ci in the commit message needs to be removed to let the build run.

@shaurya947
Copy link
Contributor Author

I think the skip ci in the commit message needs to be removed to let the build run.

Aah my bad I thought the flag was necessary if I didn't update release notes. Will remove it.

@guggero I realized that the full state of the channel does get written to the historicalChannelBucket which is actually available when querying the pending force closing channel.

lnd/rpcserver.go

Line 3499 in bbbf7d3

historical, err := r.server.chanStateDB.FetchHistoricalChannel(

This allows me to populate the Memo in all kinds of channels returned by PendingChannels. I also verified in the same itest that the Memo is indeed returned even when the channel transitions to the pending force closing state 🙂

@lightninglabs-deploy
Copy link

@guggero: review reminder
@yyforyongyu: review reminder

Copy link
Collaborator

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

itest/lnd_onchain_test.go Outdated Show resolved Hide resolved
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, thanks a lot!

cc @saubyk

itest/lnd_onchain_test.go Outdated Show resolved Hide resolved
@saubyk
Copy link
Collaborator

saubyk commented Jun 9, 2023

LGTM, thanks a lot!

cc @saubyk

Concept Ack

In a previous PR we added a Memo field for channels that could be
specified when opening a channel. This was a reference note-to-self
with no bearing on the functioning of the channel. In that PR, the
memo value was returned only through ListChannels. This commit builds
upon that PR by also returning the Memo field for channels returned by
PendingChannels RPC.
@shaurya947
Copy link
Contributor Author

Apologies for the late turnaround here, I didn't realize a merge conflict had appeared. Just fixed, should be all good now 🤞

Copy link
Collaborator

@positiveblue positiveblue left a comment

Choose a reason for hiding this comment

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

Thank you for this @shaurya947 I think we are good to go 🚀

@guggero guggero merged commit 02c1261 into lightningnetwork:master Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants