Tidy *serialize for TransparentAddress with match on network

This commit is contained in:
Deirdre Connolly 2020-03-28 02:00:43 -04:00 committed by Deirdre Connolly
parent a6d511eb71
commit 760edf9271
1 changed files with 6 additions and 8 deletions

View File

@ -159,10 +159,9 @@ impl ZcashSerialize for TransparentAddress {
} => { } => {
// Dev network doesn't have a recommendation so we // Dev network doesn't have a recommendation so we
// default to testnet bytes if it's not mainnet. // default to testnet bytes if it's not mainnet.
if *network == Network::Mainnet { match *network {
writer.write_all(&magics::p2sh::MAINNET[..])? Network::Mainnet => writer.write_all(&magics::p2sh::MAINNET[..])?,
} else { _ => writer.write_all(&magics::p2sh::TESTNET[..])?,
writer.write_all(&magics::p2sh::TESTNET[..])?
} }
writer.write_all(script_hash)? writer.write_all(script_hash)?
} }
@ -172,10 +171,9 @@ impl ZcashSerialize for TransparentAddress {
} => { } => {
// Dev network doesn't have a recommendation so we // Dev network doesn't have a recommendation so we
// default to testnet bytes if it's not mainnet. // default to testnet bytes if it's not mainnet.
if *network == Network::Mainnet { match *network {
writer.write_all(&magics::p2pkh::MAINNET[..])? Network::Mainnet => writer.write_all(&magics::p2pkh::MAINNET[..])?,
} else { _ => writer.write_all(&magics::p2pkh::TESTNET[..])?,
writer.write_all(&magics::p2pkh::TESTNET[..])?
} }
writer.write_all(pub_key_hash)? writer.write_all(pub_key_hash)?
} }