Unset the optional bit for a feature when setting the required bit
authorMatt Corallo <git@bluematt.me>
Tue, 21 Dec 2021 05:23:51 +0000 (05:23 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 26 Jan 2022 19:08:58 +0000 (19:08 +0000)
There is no reason to set both, and this currently makes testing
the new BOLT invoice tests slightly harder, so we just unset it.

lightning/src/ln/features.rs

index a5440650dd4a378ba08ed0df791efe210fd83cdc..e4018ad4131ff01faef18f2e2e64fb1cf6a73622 100644 (file)
@@ -308,6 +308,7 @@ mod sealed {
                                        }
 
                                        flags[Self::BYTE_OFFSET] |= Self::REQUIRED_MASK;
+                                       flags[Self::BYTE_OFFSET] &= !Self::OPTIONAL_MASK;
                                }
 
                                /// Sets the feature's optional (odd) bit in the given flags.