Merge rust-bitcoin/rust-bitcoin#2845: fix ServiceFlags::remove

0949be931a fix ServiceFlags::remove (Antoni Spaanderman)

Pull request description:

  Contrary to the documentation and the method name, this function does an XOR operation, if there are no flags in `self`, flags from `other` are added.

  What should happen to the core::ops::BitXor{,Assign} implementations? I did not touch them because it would break current API usage and would require a minor version bump (on 0.x.y versions).

ACKs for top commit:
  Kixunil:
    ACK 0949be931a
  apoelstra:
    ACK 0949be931a looks good. I think it is fine to retain a BitXor impl on a flag type, even if it is questionably useful

Tree-SHA512: d73853e5fe5e3776ef5cfb54c1ae2f9151c17c51861759b096eae339d4c9a544a9a32f5cc23e76f79827a40425a8a0823e2b989ed9ab98b8373d2b8d94418e8e
This commit is contained in:
Andrew Poelstra 2024-06-10 01:16:42 +00:00
commit 4543309518
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 1 additions and 1 deletions

View File

@ -110,7 +110,7 @@ impl ServiceFlags {
///
/// Returns itself.
pub fn remove(&mut self, other: ServiceFlags) -> ServiceFlags {
self.0 ^= other.0;
self.0 &= !other.0;
*self
}