File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,7 @@ pub enum NetworkKind {
29
29
/// A test network.
30
30
Testnet ,
31
31
32
- /// Regtest mode, not yet implemented
33
- // TODO: Add `new_regtest()` and `is_regtest` methods on `Network`.
32
+ /// Regtest mode
34
33
Regtest ,
35
34
}
36
35
@@ -186,6 +185,16 @@ impl Network {
186
185
}
187
186
}
188
187
188
+ /// Returns [`NetworkKind::Testnet`] on Testnet and Regtest, or [`NetworkKind::Mainnet`] on Mainnet.
189
+ ///
190
+ /// This is used for transparent addresses, as the address prefix is the same on Regtest as it is on Testnet.
191
+ pub fn t_addr_kind ( & self ) -> NetworkKind {
192
+ match self {
193
+ Network :: Mainnet => NetworkKind :: Mainnet ,
194
+ Network :: Testnet ( _) => NetworkKind :: Testnet ,
195
+ }
196
+ }
197
+
189
198
/// Returns an iterator over [`Network`] variants.
190
199
pub fn iter ( ) -> impl Iterator < Item = Self > {
191
200
[ Self :: Mainnet , Self :: new_default_testnet ( ) ] . into_iter ( )
Original file line number Diff line number Diff line change @@ -351,10 +351,10 @@ pub(crate) fn transparent_output_address(
351
351
352
352
match alt_addr {
353
353
Some ( zcash_primitives:: legacy:: TransparentAddress :: PublicKeyHash ( pub_key_hash) ) => Some (
354
- transparent:: Address :: from_pub_key_hash ( network. kind ( ) , pub_key_hash) ,
354
+ transparent:: Address :: from_pub_key_hash ( network. t_addr_kind ( ) , pub_key_hash) ,
355
355
) ,
356
356
Some ( zcash_primitives:: legacy:: TransparentAddress :: ScriptHash ( script_hash) ) => Some (
357
- transparent:: Address :: from_script_hash ( network. kind ( ) , script_hash) ,
357
+ transparent:: Address :: from_script_hash ( network. t_addr_kind ( ) , script_hash) ,
358
358
) ,
359
359
None => None ,
360
360
}
Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ pub enum TransactionError {
204
204
#[ error( "could not find a mempool transaction input UTXO in the best chain" ) ]
205
205
TransparentInputNotFound ,
206
206
207
- #[ error( "could not validate nullifiers and anchors on best chain: {0}" ) ]
207
+ #[ error( "could not contextually validate transaction on best chain: {0}" ) ]
208
208
#[ cfg_attr( any( test, feature = "proptest-impl" ) , proptest( skip) ) ]
209
209
// This error variant is at least 128 bytes
210
210
ValidateContextError ( Box < ValidateContextError > ) ,
You can’t perform that action at this time.
0 commit comments