Merge rust-bitcoin/rust-bitcoin#4562: Remove redundant `ServiceFlags` test

9d956e8643 test: remove redundant `ServiceFlags` test (rustaceanrob)

Pull request description:

  The `ServiceFlags` type is already tested within p2p/mod.rs with a nearly identical test. This type also has nothing to do with `network`

  ref: https://github.com/rust-bitcoin/rust-bitcoin/blob/master/bitcoin/src/p2p/mod.rs#L400

ACKs for top commit:
  tcharding:
    ACK 9d956e8643
  apoelstra:
    ACK 9d956e8643214b3c1ad0e42cc630e2f35f7b7994; successfully ran local tests

Tree-SHA512: d113609070e3df6d44b1ed57c40c1bce251d59fa22eb1abbf6c576fd84e21464553bee7fa97eba000ad9c1b8ef98e2ba04aec7077486273de9b7e54341ba894b
This commit is contained in:
merge-script 2025-05-28 13:48:43 +00:00
commit 3c8eeeb42a
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 0 additions and 42 deletions

View File

@ -364,7 +364,6 @@ impl TryFrom<ChainHash> for Network {
mod tests { mod tests {
use super::{Network, TestnetVersion}; use super::{Network, TestnetVersion};
use crate::consensus::encode::{deserialize, serialize}; use crate::consensus::encode::{deserialize, serialize};
use crate::p2p::ServiceFlags;
#[test] #[test]
fn serialize_deserialize() { fn serialize_deserialize() {
@ -409,47 +408,6 @@ mod tests {
assert!("fakenet".parse::<Network>().is_err()); assert!("fakenet".parse::<Network>().is_err());
} }
#[test]
fn service_flags() {
let all = [
ServiceFlags::NETWORK,
ServiceFlags::GETUTXO,
ServiceFlags::BLOOM,
ServiceFlags::WITNESS,
ServiceFlags::COMPACT_FILTERS,
ServiceFlags::NETWORK_LIMITED,
ServiceFlags::P2P_V2,
];
let mut flags = ServiceFlags::NONE;
for f in all.iter() {
assert!(!flags.has(*f));
}
flags |= ServiceFlags::WITNESS;
assert_eq!(flags, ServiceFlags::WITNESS);
let mut flags2 = flags | ServiceFlags::GETUTXO;
for f in all.iter() {
assert_eq!(flags2.has(*f), *f == ServiceFlags::WITNESS || *f == ServiceFlags::GETUTXO);
}
flags2 ^= ServiceFlags::WITNESS;
assert_eq!(flags2, ServiceFlags::GETUTXO);
flags2 |= ServiceFlags::COMPACT_FILTERS;
flags2 ^= ServiceFlags::GETUTXO;
assert_eq!(flags2, ServiceFlags::COMPACT_FILTERS);
// Test formatting.
assert_eq!("ServiceFlags(NONE)", ServiceFlags::NONE.to_string());
assert_eq!("ServiceFlags(WITNESS)", ServiceFlags::WITNESS.to_string());
let flag = ServiceFlags::WITNESS | ServiceFlags::BLOOM | ServiceFlags::NETWORK;
assert_eq!("ServiceFlags(NETWORK|BLOOM|WITNESS)", flag.to_string());
let flag = ServiceFlags::WITNESS | 0xf0.into();
assert_eq!("ServiceFlags(WITNESS|COMPACT_FILTERS|0xb0)", flag.to_string());
}
#[test] #[test]
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
fn serde_roundtrip() { fn serde_roundtrip() {