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

rpc: add node color to NodeUpdate and GetInfo #2312

Merged
merged 4 commits into from May 23, 2019

Conversation

4 participants
@xsb
Copy link
Contributor

commented Dec 10, 2018

This adds the node color to both NodeUpdate (as part of aGraphTopologyUpdate) and to GetInfo response. Tested with a Go gRPC client.

Fixes #2255 and #2268

Show resolved Hide resolved channeldb/graph.go Outdated

@xsb xsb force-pushed the xsb:color-node-update branch 3 times, most recently from aa1072a to df07b77 Dec 12, 2018

@@ -312,6 +316,7 @@ func addToTopologyChange(graph *channeldb.ChannelGraph, update *TopologyChange,
Addresses: m.Addresses,
IdentityKey: pubKey,
Alias: m.Alias,
Color: encodeHexColor(m.Color),

This comment has been minimized.

Copy link
@halseth

halseth Dec 13, 2018

Collaborator

Not sure if this is needed here, really. If you want to inspect the color you can use the GetNodeInfo RPC.

This comment has been minimized.

Copy link
@xsb

xsb Dec 14, 2018

Author Contributor

This is needed to implement #2255

This comment has been minimized.

Copy link
@halseth

halseth Dec 18, 2018

Collaborator

Good point! Ideally, the encode method would be shared, and not duplicated across the two packages though...

@halseth
Copy link
Collaborator

left a comment

Ideally, independent changes for different packages should be in separate commits. In this case I would suggest lnrpc, server+server_test, rpcserver and finally lncli commits, in that order.

server.go Outdated
@@ -2842,6 +2841,11 @@ func parseHexColor(colorStr string) (color.RGBA, error) {
return color.RGBA{R: colorBytes[0], G: colorBytes[1], B: colorBytes[2]}, nil
}

// encodeHexColor takes a color and returns it in hex code format.
func encodeHexColor(color color.RGBA) string {

This comment has been minimized.

Copy link
@halseth

halseth Dec 13, 2018

Collaborator

with this addition, the server_test.go should be expended to test this!

@Roasbeef Roasbeef added this to In progress in High Priority via automation Dec 18, 2018

@Roasbeef Roasbeef moved this from In progress to Needs review in High Priority Dec 18, 2018

@xsb xsb force-pushed the xsb:color-node-update branch from df07b77 to c9f076c Dec 21, 2018

@xsb

This comment has been minimized.

Copy link
Contributor Author

commented Dec 21, 2018

@halseth I made it with a separate commit per package as you suggested and also added a test. Something I am not convinced though is exposing the utility method EncodeHexColor from the routing package but I wasn't sure where to put it. Seems weird to me, I am open to changes.

@halseth

halseth approved these changes Jan 2, 2019

Copy link
Collaborator

left a comment

Yeah, not obvious where to put it, but I think routing is alright for now. LGTM 👍

@xsb xsb force-pushed the xsb:color-node-update branch from c9f076c to 711618a Mar 15, 2019

@xsb

This comment has been minimized.

Copy link
Contributor Author

commented Mar 15, 2019

Rebased

@halseth halseth added the P3 label Mar 19, 2019

@cfromknecht cfromknecht added this to the 0.7 milestone Apr 11, 2019

@halseth
Copy link
Collaborator

left a comment

Needs a rebase and proto regen

@xsb xsb force-pushed the xsb:color-node-update branch from 711618a to 0f3e24e May 10, 2019

@xsb

This comment has been minimized.

Copy link
Contributor Author

commented May 10, 2019

@halseth rebased with latest master + proto files regenerated

@cfromknecht

This comment has been minimized.

Copy link
Collaborator

commented May 14, 2019

@xsb looks like we have another conflict 😶

@xsb xsb force-pushed the xsb:color-node-update branch from 0f3e24e to 710bcba May 16, 2019

@xsb

This comment has been minimized.

Copy link
Contributor Author

commented May 16, 2019

@halseth @cfromknecht Rebased again.

Note: While regenerating the proto files I got a different result for lnrpc/invoicesrpc/invoices.pb.go that I ignored it for the sake of cleanliness. It seems to come from the recently merged #3019. Either the author of that PR or myself are not running the correct protoc, etc. Probably not super important but better to clarify before merging this.

@cfromknecht
Copy link
Collaborator

left a comment

@xsb LGTM! 🎉 Thank you for pointing out the versioning mismatch in the protos, I've created an issue to avoid this in the future, see #3094

@cfromknecht cfromknecht requested a review from halseth May 22, 2019

@halseth

This comment has been minimized.

Copy link
Collaborator

commented May 22, 2019

Yet another proto conflict 🤕

Note: While regenerating the proto files I got a different result for lnrpc/invoicesrpc/invoices.pb.go that I ignored it for the sake of cleanliness.

If you still see this after rebasing on master, check your proto+tools version. I just tried rebasing this on master, and regenerating the protos doesn't create any changes to that file for me.

@xsb xsb force-pushed the xsb:color-node-update branch from 710bcba to 4968731 May 22, 2019

@xsb

This comment has been minimized.

Copy link
Contributor Author

commented May 22, 2019

@halseth rebased again. No issue regenerating protos this time (tried on master and on my branch).

@cfromknecht

This comment has been minimized.

Copy link
Collaborator

commented May 23, 2019

sorry @xsb, there was a conflict w/ #3082 :/ you'll need to rebase on master and ensure that your protogen version is on 0.1.3 (step 2 of https://github.com/lightningnetwork/lnd/tree/master/lnrpc#generate-protobuf-definitions)

Feel free to ping me when you're ready, hoping to minimize the number of rebases on your end 😬

xsb added some commits Dec 21, 2018

@xsb xsb force-pushed the xsb:color-node-update branch from 4968731 to 0e38c72 May 23, 2019

@xsb

This comment has been minimized.

Copy link
Contributor Author

commented May 23, 2019

@cfromknecht rebased again after upgrading to new protobuf version

High Priority automation moved this from Needs review to Final Testing -- Ready For Merge May 23, 2019

@halseth halseth merged commit 6cd71b7 into lightningnetwork:master May 23, 2019

1 of 2 checks passed

coverage/coveralls Coverage decreased (-0.0006%) to 60.299%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

High Priority automation moved this from Final Testing -- Ready For Merge to Done May 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.