@@ -1234,6 +1234,49 @@ impl PaymentStatus {
12341234 }
12351235 }
12361236}
1237+ /// The Bitcoin network the node is running on.
1238+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize ) ) ]
1239+ #[ cfg_attr( feature = "serde" , serde( rename_all = "snake_case" ) ) ]
1240+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash , PartialOrd , Ord , :: prost:: Enumeration ) ]
1241+ #[ repr( i32 ) ]
1242+ pub enum Network {
1243+ /// Mainnet Bitcoin.
1244+ Bitcoin = 0 ,
1245+ /// Bitcoin's testnet (testnet3) network.
1246+ Testnet = 1 ,
1247+ /// Bitcoin's testnet4 network.
1248+ Testnet4 = 2 ,
1249+ /// Bitcoin's signet network.
1250+ Signet = 3 ,
1251+ /// Bitcoin's regtest network.
1252+ Regtest = 4 ,
1253+ }
1254+ impl Network {
1255+ /// String value of the enum field names used in the ProtoBuf definition.
1256+ ///
1257+ /// The values are not transformed in any way and thus are considered stable
1258+ /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1259+ pub fn as_str_name ( & self ) -> & ' static str {
1260+ match self {
1261+ Network :: Bitcoin => "BITCOIN" ,
1262+ Network :: Testnet => "TESTNET" ,
1263+ Network :: Testnet4 => "TESTNET4" ,
1264+ Network :: Signet => "SIGNET" ,
1265+ Network :: Regtest => "REGTEST" ,
1266+ }
1267+ }
1268+ /// Creates an enum from field names used in the ProtoBuf definition.
1269+ pub fn from_str_name ( value : & str ) -> :: core:: option:: Option < Self > {
1270+ match value {
1271+ "BITCOIN" => Some ( Self :: Bitcoin ) ,
1272+ "TESTNET" => Some ( Self :: Testnet ) ,
1273+ "TESTNET4" => Some ( Self :: Testnet4 ) ,
1274+ "SIGNET" => Some ( Self :: Signet ) ,
1275+ "REGTEST" => Some ( Self :: Regtest ) ,
1276+ _ => None ,
1277+ }
1278+ }
1279+ }
12371280/// Indicates whether the balance is derived from a cooperative close, a force-close (for holder or counterparty),
12381281/// or whether it is for an HTLC.
12391282#[ cfg_attr( feature = "serde" , derive( serde:: Serialize ) ) ]
0 commit comments