@@ -307,87 +307,74 @@ impl std::fmt::Display for Network {
307
307
}
308
308
}
309
309
310
+ use Network :: * ;
310
311
impl Parameters for Network {
311
312
fn activation_height (
312
313
& self ,
313
314
nu : NetworkUpgrade ,
314
315
) -> Option < zcash_primitives:: consensus:: BlockHeight > {
315
- use Network :: * ;
316
316
match self {
317
317
Mainnet => MAIN_NETWORK . activation_height ( nu) ,
318
318
Testnet => TEST_NETWORK . activation_height ( nu) ,
319
- FakeMainnet => Some ( BlockHeight :: from_u32 ( 1 ) ) ,
320
- Regtest => Some ( BlockHeight :: from_u32 ( 1 ) ) ,
319
+ FakeMainnet | Regtest => Some ( BlockHeight :: from_u32 ( 1 ) ) ,
321
320
}
322
321
}
323
322
324
323
fn coin_type ( & self ) -> u32 {
325
- use Network :: * ;
326
324
match self {
325
+ Mainnet | FakeMainnet => constants:: mainnet:: COIN_TYPE ,
327
326
Testnet => constants:: testnet:: COIN_TYPE ,
328
327
Regtest => constants:: regtest:: COIN_TYPE ,
329
- Mainnet => constants:: mainnet:: COIN_TYPE ,
330
- FakeMainnet => constants:: mainnet:: COIN_TYPE ,
331
328
}
332
329
}
333
330
331
+ fn address_network ( & self ) -> Option < zcash_address:: Network > {
332
+ Some ( match self {
333
+ Mainnet | FakeMainnet => zcash_address:: Network :: Main ,
334
+ Testnet => zcash_address:: Network :: Test ,
335
+ Regtest => zcash_address:: Network :: Regtest ,
336
+ } )
337
+ }
338
+
334
339
fn hrp_sapling_extended_spending_key ( & self ) -> & str {
335
- use Network :: * ;
336
340
match self {
341
+ Mainnet | FakeMainnet => constants:: mainnet:: HRP_SAPLING_EXTENDED_SPENDING_KEY ,
337
342
Testnet => constants:: testnet:: HRP_SAPLING_EXTENDED_SPENDING_KEY ,
338
343
Regtest => constants:: regtest:: HRP_SAPLING_EXTENDED_SPENDING_KEY ,
339
- Mainnet => constants:: mainnet:: HRP_SAPLING_EXTENDED_SPENDING_KEY ,
340
- FakeMainnet => constants:: mainnet:: HRP_SAPLING_EXTENDED_SPENDING_KEY ,
341
344
}
342
345
}
343
346
344
347
fn hrp_sapling_extended_full_viewing_key ( & self ) -> & str {
345
- use Network :: * ;
346
348
match self {
349
+ Mainnet | FakeMainnet => constants:: mainnet:: HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY ,
347
350
Testnet => constants:: testnet:: HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY ,
348
351
Regtest => constants:: regtest:: HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY ,
349
- Mainnet => constants:: mainnet:: HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY ,
350
- FakeMainnet => constants:: mainnet:: HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY ,
351
352
}
352
353
}
353
354
354
355
fn hrp_sapling_payment_address ( & self ) -> & str {
355
- use Network :: * ;
356
356
match self {
357
+ Mainnet | FakeMainnet => constants:: mainnet:: HRP_SAPLING_PAYMENT_ADDRESS ,
357
358
Testnet => constants:: testnet:: HRP_SAPLING_PAYMENT_ADDRESS ,
358
359
Regtest => constants:: regtest:: HRP_SAPLING_PAYMENT_ADDRESS ,
359
- Mainnet => constants:: mainnet:: HRP_SAPLING_PAYMENT_ADDRESS ,
360
- FakeMainnet => constants:: mainnet:: HRP_SAPLING_PAYMENT_ADDRESS ,
361
360
}
362
361
}
363
362
364
363
fn b58_pubkey_address_prefix ( & self ) -> [ u8 ; 2 ] {
365
- use Network :: * ;
366
364
match self {
365
+ Mainnet | FakeMainnet => constants:: mainnet:: B58_PUBKEY_ADDRESS_PREFIX ,
367
366
Testnet => constants:: testnet:: B58_PUBKEY_ADDRESS_PREFIX ,
368
367
Regtest => constants:: regtest:: B58_PUBKEY_ADDRESS_PREFIX ,
369
- Mainnet => constants:: mainnet:: B58_PUBKEY_ADDRESS_PREFIX ,
370
- FakeMainnet => constants:: mainnet:: B58_PUBKEY_ADDRESS_PREFIX ,
371
368
}
372
369
}
373
370
374
371
fn b58_script_address_prefix ( & self ) -> [ u8 ; 2 ] {
375
- use Network :: * ;
376
372
match self {
373
+ Mainnet | FakeMainnet => constants:: mainnet:: B58_SCRIPT_ADDRESS_PREFIX ,
377
374
Testnet => constants:: testnet:: B58_SCRIPT_ADDRESS_PREFIX ,
378
375
Regtest => constants:: regtest:: B58_SCRIPT_ADDRESS_PREFIX ,
379
- Mainnet => constants:: mainnet:: B58_SCRIPT_ADDRESS_PREFIX ,
380
- FakeMainnet => constants:: mainnet:: B58_SCRIPT_ADDRESS_PREFIX ,
381
376
}
382
377
}
383
-
384
- fn address_network ( & self ) -> Option < zcash_address:: Network > {
385
- Some ( match self {
386
- Network :: Testnet => zcash_address:: Network :: Test ,
387
- Network :: Regtest => zcash_address:: Network :: Regtest ,
388
- _ => zcash_address:: Network :: Main ,
389
- } )
390
- }
391
378
}
392
379
393
380
#[ cfg( test) ]
0 commit comments