Merge rust-bitcoin/rust-bitcoin#2555: Add ServiceFlags::P2P_V2

5818e04328 Add ServiceFlags::P2P_V2 (Ava Chow)

Pull request description:

ACKs for top commit:
  tcharding:
    ACK 5818e04328
  sanket1729:
    ACK 5818e04328
  Kixunil:
    ACK 5818e04328

Tree-SHA512: 077424c984a11af93e65873d57cdf03fe9fcc479ca270bcbe6383afeb5d2161882edf72b27ef3b5abd7a2b58efff8b95cf41e3f68221c91a3b3dc6a6b7ce9f60
This commit is contained in:
Andrew Poelstra 2024-03-09 12:57:56 +00:00
commit e58975adbc
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
2 changed files with 6 additions and 0 deletions

View File

@ -347,6 +347,7 @@ mod tests {
ServiceFlags::WITNESS,
ServiceFlags::COMPACT_FILTERS,
ServiceFlags::NETWORK_LIMITED,
ServiceFlags::P2P_V2,
];
let mut flags = ServiceFlags::NONE;

View File

@ -91,6 +91,10 @@ impl ServiceFlags {
/// See BIP159 for details on how this is implemented.
pub const NETWORK_LIMITED: ServiceFlags = ServiceFlags(1 << 10);
/// P2P_V2 indicates that the node supports the P2P v2 encrypted transport protocol.
/// See BIP324 for details on how this is implemented.
pub const P2P_V2: ServiceFlags = ServiceFlags(1 << 11);
// NOTE: When adding new flags, remember to update the Display impl accordingly.
/// Add [ServiceFlags] together.
@ -150,6 +154,7 @@ impl fmt::Display for ServiceFlags {
write_flag!(WITNESS);
write_flag!(COMPACT_FILTERS);
write_flag!(NETWORK_LIMITED);
write_flag!(P2P_V2);
// If there are unknown flags left, we append them in hex.
if flags != ServiceFlags::NONE {
if !first {