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

rpcserver+lnrpc: make graph node addresses consistent
This commit is contained in:
Conner Fromknecht 2021-04-13 14:30:07 -07:00 committed by GitHub
commit de7da3d223
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 850 additions and 808 deletions

File diff suppressed because it is too large Load Diff

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

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": {

View File

@ -5546,6 +5546,15 @@ 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()
@ -5553,6 +5562,7 @@ func marshallTopologyChange(topChange *routing.TopologyChange) *lnrpc.GraphTopol
nodeUpdates[i] = &lnrpc.NodeUpdate{ nodeUpdates[i] = &lnrpc.NodeUpdate{
Addresses: addrs, Addresses: addrs,
NodeAddresses: nodeAddrs,
IdentityKey: encodeKey(nodeUpdate.IdentityKey), IdentityKey: encodeKey(nodeUpdate.IdentityKey),
Alias: nodeUpdate.Alias, Alias: nodeUpdate.Alias,
Color: nodeUpdate.Color, Color: nodeUpdate.Color,