multi: use relaxed feature bit Set method for peer features

The spec says: `The origin node MUST NOT set both the optional and
mandatory bits`. and so this is why we have the SafeSet method which
prevents us from accidentally setting both optional and required bits
for any of our own feature bits. But the spec then also says `if both
the optional and the mandatory feature bits in a pair are set, the
feature should be treated as mandatory.` which means that when we read
the feature vectors of our peers or from a payment request, we should be
a bit less strict and not error out. We should just set both bits which
will result in "IsRequired" returning true.

Update the `TestExtractIntentFromSendRequest` test to show the new
behaviour.
This commit is contained in:
Elle Mouton committed 2025-06-25 13:14:31 +02:00
1 parent 9ee3bebc6a
commit b41a079901
4 files changed
+18 -32

No files matched your search

+1 -1
View File
@@ -446,7 +446,7 @@ func (fv RawFeatureVector) Equals(other *RawFeatureVector) bool {
return true
}
// Merges sets all feature bits in other on the receiver's feature vector.
// Merge sets all feature bits in other on the receiver's feature vector.
func (fv *RawFeatureVector) Merge(other *RawFeatureVector) error {
for bit := range other.features {
err := fv.SafeSet(bit)