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, 19 Apr 2023 02:57:19 +0000 (02:57 +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 47e1cbcc4cba67295e5c2e2d954629a9695d399c..cf375603b37b5290aaf10250218f4b66cce0678a 100644 (file)
@@ -275,6 +275,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.