feature/manager: ensure all feature sets properly set deps
This commit is contained in:
1 file changed
+18
-5
+18
-5
@@ -63,14 +63,27 @@ func newManager(cfg Config, desc setDesc) (*Manager, error) {
|
||||
}
|
||||
|
||||
// Now, remove any features as directed by the config.
|
||||
for _, fv := range fsets {
|
||||
for set, raw := range fsets {
|
||||
if cfg.NoTLVOnion {
|
||||
fv.Unset(lnwire.TLVOnionPayloadOptional)
|
||||
fv.Unset(lnwire.TLVOnionPayloadRequired)
|
||||
raw.Unset(lnwire.TLVOnionPayloadOptional)
|
||||
raw.Unset(lnwire.TLVOnionPayloadRequired)
|
||||
raw.Unset(lnwire.PaymentAddrOptional)
|
||||
raw.Unset(lnwire.PaymentAddrRequired)
|
||||
raw.Unset(lnwire.MPPOptional)
|
||||
raw.Unset(lnwire.MPPRequired)
|
||||
}
|
||||
if cfg.NoStaticRemoteKey {
|
||||
fv.Unset(lnwire.StaticRemoteKeyOptional)
|
||||
fv.Unset(lnwire.StaticRemoteKeyRequired)
|
||||
raw.Unset(lnwire.StaticRemoteKeyOptional)
|
||||
raw.Unset(lnwire.StaticRemoteKeyRequired)
|
||||
}
|
||||
|
||||
// Ensure that all of our feature sets properly set any
|
||||
// dependent features.
|
||||
fv := lnwire.NewFeatureVector(raw, lnwire.Features)
|
||||
err := ValidateDeps(fv)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid feature set %v: %v",
|
||||
set, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user