mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 01:36:24 +01:00
lnrpc: update all feature vectors to maps
This commit is contained in:
parent
990bdd6b64
commit
b2d276feb8
4 changed files with 629 additions and 636 deletions
|
@ -128,20 +128,19 @@ func CreateRPCInvoice(invoice *channeldb.Invoice,
|
|||
}
|
||||
|
||||
// CreateRPCFeatures maps a feature vector into a list of lnrpc.Features.
|
||||
func CreateRPCFeatures(fv *lnwire.FeatureVector) []*lnrpc.Feature {
|
||||
func CreateRPCFeatures(fv *lnwire.FeatureVector) map[uint32]*lnrpc.Feature {
|
||||
if fv == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
features := fv.Features()
|
||||
rpcFeatures := make([]*lnrpc.Feature, 0, len(features))
|
||||
rpcFeatures := make(map[uint32]*lnrpc.Feature, len(features))
|
||||
for bit := range features {
|
||||
rpcFeatures = append(rpcFeatures, &lnrpc.Feature{
|
||||
Bit: uint32(bit),
|
||||
rpcFeatures[uint32(bit)] = &lnrpc.Feature{
|
||||
Name: fv.Name(bit),
|
||||
IsRequired: bit.IsRequired(),
|
||||
IsKnown: fv.IsKnown(bit),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return rpcFeatures
|
||||
|
|
1227
lnrpc/rpc.pb.go
1227
lnrpc/rpc.pb.go
File diff suppressed because it is too large
Load diff
|
@ -1451,7 +1451,7 @@ message Peer {
|
|||
SyncType sync_type = 10 [json_name = "sync_type"];
|
||||
|
||||
/// Features advertised by the remote peer in their init message.
|
||||
repeated Feature features = 11 [json_name = "features"];
|
||||
map<uint32, Feature> features = 11 [json_name = "features"];
|
||||
}
|
||||
|
||||
message ListPeersRequest {
|
||||
|
@ -2072,7 +2072,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" ];
|
||||
map<uint32, Feature> features = 6 [ json_name = "features" ];
|
||||
}
|
||||
|
||||
message NodeAddress {
|
||||
|
@ -2377,7 +2377,7 @@ message Invoice {
|
|||
repeated InvoiceHTLC htlcs = 22 [json_name = "htlcs"];
|
||||
|
||||
/// List of features advertised on the invoice.
|
||||
repeated Feature features = 24 [json_name = "features"];
|
||||
map<uint32, Feature> features = 24 [json_name = "features"];
|
||||
}
|
||||
|
||||
enum InvoiceHTLCState {
|
||||
|
@ -2638,11 +2638,10 @@ message PayReq {
|
|||
repeated RouteHint route_hints = 10 [json_name = "route_hints"];
|
||||
bytes payment_addr = 11 [json_name = "payment_addr"];
|
||||
int64 num_msat = 12 [json_name = "num_msat"];
|
||||
repeated Feature features = 13 [json_name = "features"];
|
||||
map<uint32, Feature> features = 13 [json_name = "features"];
|
||||
}
|
||||
|
||||
message Feature {
|
||||
uint32 bit = 1 [json_name = "bit"];
|
||||
string name = 2 [json_name = "name"];
|
||||
bool is_required = 3 [json_name = "is_required"];
|
||||
bool is_known = 4 [json_name = "is_known"];
|
||||
|
|
|
@ -2246,10 +2246,6 @@
|
|||
"lnrpcFeature": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"bit": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
|
@ -2804,8 +2800,8 @@
|
|||
"description": "/ List of HTLCs paying to this invoice [EXPERIMENTAL]."
|
||||
},
|
||||
"features": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/lnrpcFeature"
|
||||
},
|
||||
"description": "/ List of features advertised on the invoice."
|
||||
|
@ -2915,8 +2911,8 @@
|
|||
"type": "string"
|
||||
},
|
||||
"features": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/lnrpcFeature"
|
||||
}
|
||||
}
|
||||
|
@ -3311,8 +3307,8 @@
|
|||
"format": "int64"
|
||||
},
|
||||
"features": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/lnrpcFeature"
|
||||
}
|
||||
}
|
||||
|
@ -3439,8 +3435,8 @@
|
|||
"description": "The type of sync we are currently performing with this peer."
|
||||
},
|
||||
"features": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/lnrpcFeature"
|
||||
},
|
||||
"description": "/ Features advertised by the remote peer in their init message."
|
||||
|
|
Loading…
Add table
Reference in a new issue