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;
}
message NodeUpdate {
repeated string addresses = 1;
/*
Deprecated, use node_addresses.
*/
repeated string addresses = 1 [deprecated = true];
string identity_key = 2;
/*
Deprecated, use features.
*/
bytes global_features = 3 [deprecated = true];
string alias = 4;
string color = 5;
repeated NodeAddress node_addresses = 7;
/*
Features that the node has advertised in the init message, node

View File

@ -4675,14 +4675,16 @@
"type": "array",
"items": {
"type": "string"
}
},
"description": "Deprecated, use node_addresses."
},
"identity_key": {
"type": "string"
},
"global_features": {
"type": "string",
"format": "byte"
"format": "byte",
"description": "Deprecated, use features."
},
"alias": {
"type": "string"
@ -4690,6 +4692,12 @@
"color": {
"type": "string"
},
"node_addresses": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcNodeAddress"
}
},
"features": {
"type": "object",
"additionalProperties": {

View File

@ -5546,16 +5546,26 @@ func marshallTopologyChange(topChange *routing.TopologyChange) *lnrpc.GraphTopol
nodeUpdates := make([]*lnrpc.NodeUpdate, len(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))
for i, addr := range nodeUpdate.Addresses {
addrs[i] = addr.String()
}
nodeUpdates[i] = &lnrpc.NodeUpdate{
Addresses: addrs,
IdentityKey: encodeKey(nodeUpdate.IdentityKey),
Alias: nodeUpdate.Alias,
Color: nodeUpdate.Color,
Addresses: addrs,
NodeAddresses: nodeAddrs,
IdentityKey: encodeKey(nodeUpdate.IdentityKey),
Alias: nodeUpdate.Alias,
Color: nodeUpdate.Color,
Features: invoicesrpc.CreateRPCFeatures(
nodeUpdate.Features,
),