multi: add restriction on maximum feature bit in invoices

Base 32 encoded bolt 11 invoices only allow 10 bits to express the
length of the feature vector in a tagged field, so there is a much
lower limit on the values invoice custom features can hold.

Other places in the protocol are theoretically limited by the maximum
message size, but since we express a feature bit as u16 we don't need
to be concerned about this.

The decision is made to track maximum per-set in the feature manager,
which is conceptually aware of sets and then validate in lnwire/features
against some arbitrary maximum value provided to the caller to keep
the base features package unaware of sets.
This commit is contained in:
Carla Kirk-Cohen committed 2023-05-04 10:35:45 -04:00
1 parent 5a139fd297
commit 019127c4f4
4 files changed
+88 -14

No files matched your search

+3 -1
View File
@@ -221,7 +221,9 @@ func (m *Manager) UpdateFeatureSets(
return err
}
if err := m.Get(set).ValidateUpdate(newFeatures); err != nil {
if err := m.Get(set).ValidateUpdate(
newFeatures, set.Maximum(),
); err != nil {
return err
}