09+11: require transitive feature dependencies#719
Merged
cdecker merged 4 commits intolightning:masterfrom Jan 21, 2020
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an additional column to our feature table in BOLT 09, enumerating any dependencies that a feature pair has. At the moment, there are 3 such pairs that have dependencies, and more will be added in the near term. The motivation is to offer a concise way to describe these relations, and also simplify how we specify behavior gated by features with dependencies.
Consider the
basic_mppfeature, which (as of #712) depends onpayment_secretand transitively depends onvar_onion_optin. Instead of specifying (or coding)has(basic_mpp) && has(payment_secret) && has(var_onion_optin)everywhere we need to gatebasic_mpp, this allows us to isolate the gate to onlybasic_mppsince the transitive requirements are assumed to be already validated..An implementation of this validation can be found here: https://github.com/lightningnetwork/lnd/blob/master/feature/deps.go which we are currently using as we build out MPP to simplify our own logic.
The test vectors have also been updated to set the
var_onion_optinfeature when setting a payment secret, as @t-bast points out, the current ones are missing this bit to be fully aligned with the existing spec.