Merge pull request #5182 from PierreRochard/node-update-addresses

rpcserver+lnrpc: make graph node addresses consistent
This commit is contained in:
Conner Fromknecht authored and GitHub committed 2021-04-13 14:30:07 -07:00
commit de7da3d223
4 files changed
+850 -808

No files matched your search

+815 -801
View File
File diff suppressed because it is too large. Load diff
+11 -1
View File
@@ -2768,11 +2768,21 @@ message GraphTopologyUpdate {
repeated ClosedChannelUpdate closed_chans = 3; repeated ClosedChannelUpdate closed_chans = 3;
} }
message NodeUpdate { message NodeUpdate {
repeated string addresses = 1; /*
Deprecated, use node_addresses.
*/
repeated string addresses = 1 [deprecated = true];
string identity_key = 2; string identity_key = 2;
/*
Deprecated, use features.
*/
bytes global_features = 3 [deprecated = true]; bytes global_features = 3 [deprecated = true];
string alias = 4; string alias = 4;
string color = 5; string color = 5;
repeated NodeAddress node_addresses = 7;
/* /*
Features that the node has advertised in the init message, node Features that the node has advertised in the init message, node
+10 -2
View File
@@ -4675,14 +4675,16 @@
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string"
} },
"description": "Deprecated, use node_addresses."
}, },
"identity_key": { "identity_key": {
"type": "string" "type": "string"
}, },
"global_features": { "global_features": {
"type": "string", "type": "string",
"format": "byte" "format": "byte",
"description": "Deprecated, use features."
}, },
"alias": { "alias": {
"type": "string" "type": "string"
@@ -4690,6 +4692,12 @@
"color": { "color": {
"type": "string" "type": "string"
}, },
"node_addresses": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcNodeAddress"
}
},
"features": { "features": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
+14 -4
View File
@@ -5546,16 +5546,26 @@ func marshallTopologyChange(topChange *routing.TopologyChange) *lnrpc.GraphTopol
nodeUpdates := make([]*lnrpc.NodeUpdate, len(topChange.NodeUpdates)) nodeUpdates := make([]*lnrpc.NodeUpdate, len(topChange.NodeUpdates))
for i, nodeUpdate := range topChange.NodeUpdates { for i, nodeUpdate := range topChange.NodeUpdates {
nodeAddrs := make([]*lnrpc.NodeAddress, 0, len(nodeUpdate.Addresses))
for _, addr := range nodeUpdate.Addresses {
nodeAddr := &lnrpc.NodeAddress{
Network: addr.Network(),
Addr: addr.String(),
}
nodeAddrs = append(nodeAddrs, nodeAddr)
}
addrs := make([]string, len(nodeUpdate.Addresses)) addrs := make([]string, len(nodeUpdate.Addresses))
for i, addr := range nodeUpdate.Addresses { for i, addr := range nodeUpdate.Addresses {
addrs[i] = addr.String() addrs[i] = addr.String()
} }
nodeUpdates[i] = &lnrpc.NodeUpdate{ nodeUpdates[i] = &lnrpc.NodeUpdate{
Addresses: addrs, Addresses: addrs,
IdentityKey: encodeKey(nodeUpdate.IdentityKey), NodeAddresses: nodeAddrs,
Alias: nodeUpdate.Alias, IdentityKey: encodeKey(nodeUpdate.IdentityKey),
Color: nodeUpdate.Color, Alias: nodeUpdate.Alias,
Color: nodeUpdate.Color,
Features: invoicesrpc.CreateRPCFeatures( Features: invoicesrpc.CreateRPCFeatures(
nodeUpdate.Features, nodeUpdate.Features,
), ),