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

lncli: remote peer alias in listchannels #7322

Merged
merged 5 commits into from
Feb 24, 2023

Conversation

hieblmi
Copy link
Collaborator

@hieblmi hieblmi commented Jan 15, 2023

Implements feature #6994, continuation of PR #7006

This PR introduces a peer_alias field for channels that are retrieved by the ListChannels RPC. By default the peer alias lookup is disabled to avoid degradation of the performance of existing clients. However it can be enabled by passing a new flag peerAliasLookup to ListChannels. For convenience lncli listchannels enables the lookup by default but it can be disabled by a new flag skip_peer_alias_lookup.

rpcserver.go Outdated Show resolved Hide resolved
@hieblmi hieblmi force-pushed the cmd-listchannels-peer-alias branch 3 times, most recently from ac91882 to a675f76 Compare January 16, 2023 12:07
@hieblmi hieblmi requested a review from guggero January 29, 2023 13:50
rpcserver.go Show resolved Hide resolved
@hieblmi hieblmi force-pushed the cmd-listchannels-peer-alias branch from a675f76 to 321177a Compare January 29, 2023 14:03
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.

Nice feature, thanks a lot!
Looks like there are a couple of failures in the linter and unit tests. But other than that, looks pretty good to me.

lnrpc/lightning.proto Outdated Show resolved Hide resolved
lnrpc/lightning.proto Outdated Show resolved Hide resolved
rpcserver.go Outdated Show resolved Hide resolved
lntest/itest/lnd_misc_test.go Outdated Show resolved Hide resolved
@hieblmi hieblmi force-pushed the cmd-listchannels-peer-alias branch from 321177a to 228a617 Compare February 2, 2023 10:42
@lightninglabs-deploy
Copy link

@hieblmi, remember to re-request review from reviewers when ready

@hieblmi hieblmi force-pushed the cmd-listchannels-peer-alias branch from 228a617 to a65abe0 Compare February 6, 2023 21:54
@hieblmi
Copy link
Collaborator Author

hieblmi commented Feb 6, 2023

Thanks for the review @guggero, I missed the test case errors but fixed them now and also addressed your nits.

@hieblmi hieblmi requested a review from guggero February 6, 2023 22:51
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.

Very nice, LGTM 🎉

rpcserver.go Show resolved Hide resolved
@@ -345,12 +345,15 @@ func (h *HarnessTest) AssertChannelExists(hn *node.HarnessNode,
// findChannel tries to find a target channel in the node using the given
// channel point.
func (h *HarnessTest) findChannel(hn *node.HarnessNode,
chanPoint *lnrpc.ChannelPoint) (*lnrpc.Channel, error) {
chanPoint *lnrpc.ChannelPoint, peerAliasLookup bool) (*lnrpc.Channel,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could use a variadic argument list with functional options to avoid needing to add the new parameter everywhere. And then just use withPeerLookup() if you want to enable it. Example, in case it's not clear what I mean: https://github.com/lightninglabs/lndclient/blob/master/lightning_client.go#L2786

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the hint, this looks a little cleaner now.

lntest/itest/lnd_misc_test.go Outdated Show resolved Hide resolved
lntest/itest/lnd_misc_test.go Outdated Show resolved Hide resolved
@hieblmi hieblmi force-pushed the cmd-listchannels-peer-alias branch 4 times, most recently from 1b61ae2 to f51aa75 Compare February 23, 2023 08:57
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.

Great work, thank you!
One final nit in the itest, otherwise looks good to me 🎉

lntemp/harness.go Outdated Show resolved Hide resolved
@guggero guggero requested a review from ellemouton February 23, 2023 09:09
Copy link
Collaborator

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

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

LGTM after Oli's comment about options has been addressed :)

Just need to update the release notes entry with the correct link too 🙏

docs/release-notes/release-notes-0.16.0.md Outdated Show resolved Hide resolved
@hieblmi hieblmi force-pushed the cmd-listchannels-peer-alias branch 2 times, most recently from 7d4c275 to 66cf6d8 Compare February 23, 2023 20:38
@hieblmi hieblmi requested a review from guggero February 23, 2023 21:20
@hieblmi hieblmi force-pushed the cmd-listchannels-peer-alias branch 2 times, most recently from 1e1f145 to d2c9af5 Compare February 24, 2023 06:07
@hieblmi hieblmi requested review from ellemouton and removed request for guggero February 24, 2023 06:33
@hieblmi hieblmi requested review from guggero and ellemouton and removed request for ellemouton and guggero February 24, 2023 06:33
@hieblmi
Copy link
Collaborator Author

hieblmi commented Feb 24, 2023

Seems like test framework changes have removed lntemp, have to fix before this is ready to review. @guggero Addressed nits and test framework changes.

@hieblmi hieblmi force-pushed the cmd-listchannels-peer-alias branch 2 times, most recently from d9104cc to cdd8b14 Compare February 24, 2023 07:48
@hieblmi hieblmi requested review from guggero and removed request for ellemouton February 24, 2023 08:43
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 🎉

@saubyk given RC1 was just cut, can we still get this in for 0.16?

opts := []lntest.ListChannelOption{lntest.WithPeerAliasLookup()}

aliceChannelWithAlias := ht.QueryChannelByChanPoint(
alice, chanPoint, opts...,
Copy link
Collaborator

Choose a reason for hiding this comment

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

The nice thing about these options is, you can just do alice, chanPoint, lntest.WithPeerAliasLookup() here. But non-blocking, since the diff is now much cleaner already.

Copy link
Collaborator Author

@hieblmi hieblmi Feb 24, 2023

Choose a reason for hiding this comment

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

Changed it here and below. I thought having the opts field might come in handy in the future to add options to it. But it isn't very likely that we add additional options right here.

@hieblmi hieblmi force-pushed the cmd-listchannels-peer-alias branch 3 times, most recently from 1fa7d78 to 313983f Compare February 24, 2023 09:48
@saubyk
Copy link
Collaborator

saubyk commented Feb 24, 2023

LGTM 🎉

@saubyk given RC1 was just cut, can we still get this in for 0.16?

We can, given that it's good to go.

@guggero guggero merged commit d321182 into lightningnetwork:master Feb 24, 2023
@saubyk saubyk added this to the v0.16.0 milestone Feb 24, 2023
@alexbosworth
Copy link
Contributor

If there is an alias lookup problem for a peer it will return unable to lookup peer alias: alias for node not found error

@hieblmi
Copy link
Collaborator Author

hieblmi commented Mar 1, 2023

If there is an alias lookup problem for a peer it will return unable to lookup peer alias: alias for node not found error

Are you pointing to the redundant wording of the error message? Should node be replaced with peer?

@guggero
Copy link
Collaborator

guggero commented Mar 1, 2023

No, I think it's about returning the error vs. logging the error. As was discussed in #7001 (comment)...
@alexbosworth do you know why your peer doesn't have an alias? Is that something that can happen often or maybe a problem with your node's graph view (which might be fixed with the gossip propagation fix)?
I wonder if we should fully ignore (and not even log) any errors related to fetching the alias.

@hieblmi
Copy link
Collaborator Author

hieblmi commented Mar 1, 2023

No, I think it's about returning the error vs. logging the error. As was discussed in #7001 (comment)...

Oh right, initially I thought of returning an empty alias if an error during the lookup happens so that we don't interrupt it as it is flagged now.

@alexbosworth
Copy link
Contributor

No, I think it's about returning the error vs. logging the error. As was discussed in #7001 (comment)... @alexbosworth do you know why your peer doesn't have an alias?

I tried it in a regtest scenario and didn't have no alias on purpose but it maybe can happen while the graph is still syncing?

@guggero
Copy link
Collaborator

guggero commented Mar 1, 2023

Okay, I guess we should just ignore (and not even log) the errors related to fetching the peer alias. If a user wants to know why an alias isn't showing, they can do lncli getnodeinfo where they would get the same error if something with the graph is not okay. @hieblmi can you create a PR that removes the error return in listchannels and fwdinghistory please?

@hieblmi
Copy link
Collaborator Author

hieblmi commented Mar 1, 2023

@guggero I will submit it in a bit.

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.

6 participants