mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
lnrpc: add node features to LightningNode and NodeInfo
This commit is contained in:
parent
eae45f9ad9
commit
db0029d03d
@ -129,6 +129,10 @@ func CreateRPCInvoice(invoice *channeldb.Invoice,
|
||||
|
||||
// CreateRPCFeatures maps a feature vector into a list of lnrpc.Features.
|
||||
func CreateRPCFeatures(fv *lnwire.FeatureVector) []*lnrpc.Feature {
|
||||
if fv == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
features := fv.Features()
|
||||
rpcFeatures := make([]*lnrpc.Feature, 0, len(features))
|
||||
for bit := range features {
|
||||
|
1134
lnrpc/rpc.pb.go
1134
lnrpc/rpc.pb.go
File diff suppressed because it is too large
Load Diff
@ -2069,6 +2069,7 @@ message LightningNode {
|
||||
string alias = 3 [ json_name = "alias" ];
|
||||
repeated NodeAddress addresses = 4 [ json_name = "addresses" ];
|
||||
string color = 5 [ json_name = "color" ];
|
||||
repeated Feature features = 6 [ json_name = "features" ];
|
||||
}
|
||||
|
||||
message NodeAddress {
|
||||
|
@ -2913,6 +2913,12 @@
|
||||
},
|
||||
"color": {
|
||||
"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."
|
||||
|
@ -3956,6 +3956,7 @@ func (r *rpcServer) DescribeGraph(ctx context.Context,
|
||||
Addresses: nodeAddrs,
|
||||
Alias: node.Alias,
|
||||
Color: routing.EncodeHexColor(node.Color),
|
||||
Features: invoicesrpc.CreateRPCFeatures(node.Features),
|
||||
})
|
||||
|
||||
return nil
|
||||
@ -4137,6 +4138,8 @@ func (r *rpcServer) GetNodeInfo(ctx context.Context,
|
||||
nodeAddrs = append(nodeAddrs, nodeAddr)
|
||||
}
|
||||
|
||||
features := invoicesrpc.CreateRPCFeatures(node.Features)
|
||||
|
||||
return &lnrpc.NodeInfo{
|
||||
Node: &lnrpc.LightningNode{
|
||||
LastUpdate: uint32(node.LastUpdate.Unix()),
|
||||
@ -4144,6 +4147,7 @@ func (r *rpcServer) GetNodeInfo(ctx context.Context,
|
||||
Addresses: nodeAddrs,
|
||||
Alias: node.Alias,
|
||||
Color: routing.EncodeHexColor(node.Color),
|
||||
Features: features,
|
||||
},
|
||||
NumChannels: numChannels,
|
||||
TotalCapacity: int64(totalCapacity),
|
||||
|
Loading…
Reference in New Issue
Block a user