lnrpc: add node features to LightningNode and NodeInfo
This commit is contained in:
5 files changed
+586
-563
No files matched your search
@@ -129,6 +129,10 @@ func CreateRPCInvoice(invoice *channeldb.Invoice,
|
|||||||
|
|
||||||
// CreateRPCFeatures maps a feature vector into a list of lnrpc.Features.
|
// CreateRPCFeatures maps a feature vector into a list of lnrpc.Features.
|
||||||
func CreateRPCFeatures(fv *lnwire.FeatureVector) []*lnrpc.Feature {
|
func CreateRPCFeatures(fv *lnwire.FeatureVector) []*lnrpc.Feature {
|
||||||
|
if fv == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
features := fv.Features()
|
features := fv.Features()
|
||||||
rpcFeatures := make([]*lnrpc.Feature, 0, len(features))
|
rpcFeatures := make([]*lnrpc.Feature, 0, len(features))
|
||||||
for bit := range features {
|
for bit := range features {
|
||||||
|
|||||||
+571
-563
File diff suppressed because it is too large.
Load diff
@@ -2069,6 +2069,7 @@ message LightningNode {
|
|||||||
string alias = 3 [ json_name = "alias" ];
|
string alias = 3 [ json_name = "alias" ];
|
||||||
repeated NodeAddress addresses = 4 [ json_name = "addresses" ];
|
repeated NodeAddress addresses = 4 [ json_name = "addresses" ];
|
||||||
string color = 5 [ json_name = "color" ];
|
string color = 5 [ json_name = "color" ];
|
||||||
|
repeated Feature features = 6 [ json_name = "features" ];
|
||||||
}
|
}
|
||||||
|
|
||||||
message NodeAddress {
|
message NodeAddress {
|
||||||
|
|||||||
@@ -2913,6 +2913,12 @@
|
|||||||
},
|
},
|
||||||
"color": {
|
"color": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"features": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/lnrpcFeature"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": "*\nAn individual vertex/node within the channel graph. A node is\nconnected to other nodes by one or more channel edges emanating from it. As the\ngraph is directed, a node will also have an incoming edge attached to it for\neach outgoing edge."
|
"description": "*\nAn individual vertex/node within the channel graph. A node is\nconnected to other nodes by one or more channel edges emanating from it. As the\ngraph is directed, a node will also have an incoming edge attached to it for\neach outgoing edge."
|
||||||
|
|||||||
@@ -3956,6 +3956,7 @@ func (r *rpcServer) DescribeGraph(ctx context.Context,
|
|||||||
Addresses: nodeAddrs,
|
Addresses: nodeAddrs,
|
||||||
Alias: node.Alias,
|
Alias: node.Alias,
|
||||||
Color: routing.EncodeHexColor(node.Color),
|
Color: routing.EncodeHexColor(node.Color),
|
||||||
|
Features: invoicesrpc.CreateRPCFeatures(node.Features),
|
||||||
})
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -4137,6 +4138,8 @@ func (r *rpcServer) GetNodeInfo(ctx context.Context,
|
|||||||
nodeAddrs = append(nodeAddrs, nodeAddr)
|
nodeAddrs = append(nodeAddrs, nodeAddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
features := invoicesrpc.CreateRPCFeatures(node.Features)
|
||||||
|
|
||||||
return &lnrpc.NodeInfo{
|
return &lnrpc.NodeInfo{
|
||||||
Node: &lnrpc.LightningNode{
|
Node: &lnrpc.LightningNode{
|
||||||
LastUpdate: uint32(node.LastUpdate.Unix()),
|
LastUpdate: uint32(node.LastUpdate.Unix()),
|
||||||
@@ -4144,6 +4147,7 @@ func (r *rpcServer) GetNodeInfo(ctx context.Context,
|
|||||||
Addresses: nodeAddrs,
|
Addresses: nodeAddrs,
|
||||||
Alias: node.Alias,
|
Alias: node.Alias,
|
||||||
Color: routing.EncodeHexColor(node.Color),
|
Color: routing.EncodeHexColor(node.Color),
|
||||||
|
Features: features,
|
||||||
},
|
},
|
||||||
NumChannels: numChannels,
|
NumChannels: numChannels,
|
||||||
TotalCapacity: int64(totalCapacity),
|
TotalCapacity: int64(totalCapacity),
|
||||||
|
|||||||
Reference in new issue
Block a user