Add ServiceFlags::P2P_V2

This commit is contained in:
Ava Chow 2024-03-08 15:07:34 -05:00
parent 9641e2d731
commit 5818e04328
2 changed files with 6 additions and 0 deletions

View File

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

View File

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