Unset upfront_shutdown_script using bit clearing
authorJeffrey Czyz <jkczyz@gmail.com>
Fri, 10 Apr 2020 18:36:47 +0000 (11:36 -0700)
committerJeffrey Czyz <jkczyz@gmail.com>
Tue, 28 Apr 2020 06:29:23 +0000 (23:29 -0700)
The test_upfront_shutdown_script functional test clears this feature
flag. However, the method used to clear the flag is implemented by bit
toggling. Thus, if the flag is not set the method would actually set it.
Implement the method using bit clearing instead.

lightning/src/ln/features.rs

index 5eb1bd909e80585408f6ce24853502e696cbc25f..1e52268ac351dffb67290ff073ef97d7c3953980 100644 (file)
@@ -272,7 +272,7 @@ impl<T: sealed::UpfrontShutdownScript> Features<T> {
        }
        #[cfg(test)]
        pub(crate) fn unset_upfront_shutdown_script(&mut self) {
-               self.flags[0] ^= 1 << 5;
+               self.flags[0] &= !(1 << 5);
        }
 }