pub fn get_network_for_address(address: &Address<NetworkUnchecked>) -> Network
Expand description
Gets the (approximate) network from a bitcoin address.
This function mimics how Address.network
is calculated in bitcoin v0.30.
However, that field was removed in more recent versions in part because it
can only distinguish between Bitcoin
, Testnet
and Regtest
.
As of bitcoin v0.32.4, Address::is_valid_for_network()
performs equality
checks using NetworkKind
and KnownHrp
, which only distinguish between
Bitcoin
, Testnet
and Regtest
.
https://docs.rs/bitcoin/0.32.4/src/bitcoin/address/mod.rs.html#709-716
https://docs.rs/bitcoin/0.32.4/src/bitcoin/network.rs.html#51-58
https://docs.rs/bitcoin/0.32.4/src/bitcoin/address/mod.rs.html#200-209