Merge pull request #3862 from cfromknecht/allow-graph-feature-fallback

routerrpc: allow dest_features graph fallback
This commit is contained in:
Conner Fromknecht 2019-12-20 00:39:26 -08:00 committed by GitHub
commit fb6cf21948
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 6 deletions

@ -258,7 +258,9 @@ type SendPaymentRequest struct {
//*
//Features assumed to be supported by the final node. All transitive feature
//depdencies must also be set properly. For a given feature bit pair, either
//optional or remote may be set, but not both.
//optional or remote may be set, but not both. If this field is nil or empty,
//the router will try to load destination features from the graph as a
//fallback.
DestFeatures []lnrpc.FeatureBit `protobuf:"varint,16,rep,packed,name=dest_features,json=destFeatures,proto3,enum=lnrpc.FeatureBit" json:"dest_features,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`

@ -109,7 +109,9 @@ message SendPaymentRequest {
/**
Features assumed to be supported by the final node. All transitive feature
depdencies must also be set properly. For a given feature bit pair, either
optional or remote may be set, but not both.
optional or remote may be set, but not both. If this field is nil or empty,
the router will try to load destination features from the graph as a
fallback.
*/
repeated lnrpc.FeatureBit dest_features = 16;
}

@ -710,7 +710,15 @@ func unmarshallHopHint(rpcHint *lnrpc.HopHint) (zpay32.HopHint, error) {
// UnmarshalFeatures converts a list of uint32's into a valid feature vector.
// This method checks that feature bit pairs aren't assigned toegether, and
// validates transitive depdencies.
func UnmarshalFeatures(rpcFeatures []lnrpc.FeatureBit) (*lnwire.FeatureVector, error) {
func UnmarshalFeatures(
rpcFeatures []lnrpc.FeatureBit) (*lnwire.FeatureVector, error) {
// If no destination features are specified we'll return nil to signal
// that the router should try to use the graph as a fallback.
if rpcFeatures == nil {
return nil, nil
}
raw := lnwire.NewRawFeatureVector()
for _, bit := range rpcFeatures {
err := raw.SafeSet(lnwire.FeatureBit(bit))

@ -1229,7 +1229,9 @@ type SendRequest struct {
//*
//Features assumed to be supported by the final node. All transitive feature
//depdencies must also be set properly. For a given feature bit pair, either
//optional or remote may be set, but not both.
//optional or remote may be set, but not both. If this field is nil or empty,
//the router will try to load destination features from the graph as a
//fallback.
DestFeatures []FeatureBit `protobuf:"varint,15,rep,packed,name=dest_features,json=destFeatures,proto3,enum=lnrpc.FeatureBit" json:"dest_features,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`

@ -971,7 +971,9 @@ message SendRequest {
/**
Features assumed to be supported by the final node. All transitive feature
depdencies must also be set properly. For a given feature bit pair, either
optional or remote may be set, but not both.
optional or remote may be set, but not both. If this field is nil or empty,
the router will try to load destination features from the graph as a
fallback.
*/
repeated FeatureBit dest_features = 15;
}

@ -3874,7 +3874,7 @@
"items": {
"$ref": "#/definitions/lnrpcFeatureBit"
},
"description": "*\nFeatures assumed to be supported by the final node. All transitive feature\ndepdencies must also be set properly. For a given feature bit pair, either\noptional or remote may be set, but not both."
"description": "*\nFeatures assumed to be supported by the final node. All transitive feature\ndepdencies must also be set properly. For a given feature bit pair, either\noptional or remote may be set, but not both. If this field is nil or empty,\nthe router will try to load destination features from the graph as a\nfallback."
}
}
},