Skip to content

Commit

Permalink
Make RPC testnet flag forward-compatible with additional testnets
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Jun 18, 2023
1 parent 5bdcce5 commit 39b195f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion zebra-chain/src/parameters/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub enum Network {
#[default]
Mainnet,

/// The testnet.
/// The oldest public test network.
Testnet,
}

Expand Down Expand Up @@ -124,6 +124,11 @@ impl Network {
pub fn lowercase_name(&self) -> String {
self.to_string().to_ascii_lowercase()
}

/// Returns `true` if this network is a testing network.
pub fn is_a_test_network(&self) -> bool {
*self != Network::Mainnet
}
}

impl FromStr for Network {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl Response {
networksolps,
networkhashps: networksolps,
chain: network.bip70_network_name(),
testnet: network == Network::Testnet,
testnet: network.is_a_test_network(),
}
}
}

0 comments on commit 39b195f

Please sign in to comment.