chore(core): support more Bitcoin test networks
What changed, and why it matters
This commit expands the Trezor client library's list of recognized Bitcoin-like networks. Previously, only main Bitcoin and the old Testnet were explicitly supported; any other network triggered an 'unsupported network' error. The change adds Regtest, Signet, and Testnet4 as valid options, mapping them to Trezor's existing coin names. It is a routine feature/enabling change with no obvious security bug.
No security action required. Review as normal feature code; ensure Testnet4 aliasing to 'Testnet' is intentional and consistent with device firmware behavior.
Security signals we found
No memory-unsafe changes
No cryptographic changes
No privilege or authorization changes
No input parsing of untrusted data beyond existing enum matching
No changelog entry (chore commit)
Evidence from the diff
In rust/trezor-client/src/utils.rs, the coin_name() function is refactored from a two-arm match (Bitcoin, Testnet) to a four-arm match that also accepts Network::Regtest, Network::Signet, and Network::Testnet4 (with Testnet4 aliased to the existing ‘Testnet’ coin name). The function still returns Error::UnsupportedNetwork for any other network. The diff is purely additive support for additional test networks.
Changed components
rust/trezor-client/src/utils.rscoin_name() helperInspect captured patch +7 / −4
diff --git a/rust/trezor-client/src/utils.rs b/rust/trezor-client/src/utils.rs
index b74a9343..9957ef1e 100644
--- a/rust/trezor-client/src/utils.rs
+++ b/rust/trezor-client/src/utils.rs
@@ -58,11 +58,14 @@ pub fn parse_recoverable_signature(
/// Convert a bitcoin network constant to the Trezor-compatible coin_name string.
pub fn coin_name(network: Network) -> Result<String> {
- match network {
- Network::Bitcoin => Ok("Bitcoin".to_owned()),
- Network::Testnet => Ok("Testnet".to_owned()),
- _ => Err(Error::UnsupportedNetwork),
+ Ok(match network {
+ Network::Bitcoin => "Bitcoin",
+ Network::Regtest => "Regtest",
+ Network::Signet => "Signet",
+ Network::Testnet | Network::Testnet4 => "Testnet",
+ _ => return Err(Error::UnsupportedNetwork),
}
+ .to_owned())
}
/// Convert a BIP-32 derivation path into a `Vec<u32>`.
Why this scored 21/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.