Impl PartialEq and Eq for SproutShieldedAddress

This commit is contained in:
Deirdre Connolly 2020-03-24 19:59:43 -04:00 committed by Deirdre Connolly
parent a7e5d37296
commit fae9da7dd9
1 changed files with 10 additions and 0 deletions

View File

@ -49,6 +49,16 @@ impl fmt::Debug for SproutShieldedAddress {
}
}
impl PartialEq for SproutShieldedAddress {
fn eq(&self, other: &Self) -> bool {
self.network == other.network
&& self.paying_key.0 == other.paying_key.0
&& self.transmission_key.as_bytes() == other.transmission_key.as_bytes()
}
}
impl Eq for SproutShieldedAddress {}
impl ZcashSerialize for SproutShieldedAddress {
fn zcash_serialize<W: io::Write>(&self, mut writer: W) -> Result<(), io::Error> {
if self.network == Network::Mainnet {