diff --git a/components/zcash_address/src/kind/unified.rs b/components/zcash_address/src/kind/unified.rs index 03d73ac14..afcea8a55 100644 --- a/components/zcash_address/src/kind/unified.rs +++ b/components/zcash_address/src/kind/unified.rs @@ -100,11 +100,13 @@ impl From for u8 { } impl Typecode { - fn is_shielded(&self) -> bool { + fn is_transparent(&self) -> bool { match self { - Typecode::P2pkh | Typecode::P2sh => false, - // Assume that unknown typecodes are shielded, because they might be. - _ => true, + Typecode::P2pkh | Typecode::P2sh => true, + // Unknown typecodes are treated as not transparent for the purpose of + // disallowing only-transparent UAs, which can be represented with existing + // address encodings. + _ => false, } } } @@ -263,7 +265,7 @@ impl TryFrom> for Address { } } - if !typecodes.iter().any(|t| t.is_shielded()) { + if typecodes.iter().all(|t| t.is_transparent()) { Err(ParseError::OnlyTransparent) } else { // All checks pass!