diff --git a/components/zcash_address/src/kind/unified.rs b/components/zcash_address/src/kind/unified.rs index ef350d60d4..403d133a42 100644 --- a/components/zcash_address/src/kind/unified.rs +++ b/components/zcash_address/src/kind/unified.rs @@ -241,12 +241,15 @@ impl MetadataItem { "Expiry time must be a 64-bit little-endian value.".to_string(), ) }), + (R0, ExpiryHeight | ExpiryTime) => Err(ParseError::NotUnderstood(typecode.into())), (R0 | R1, MustUnderstand(tc)) => Err(ParseError::NotUnderstood(tc)), + // This implementation treats the 0xC0..OxFD range as unknown metadata for both R0 and + // R1, as no typecodes were specified in this range for R0 and were "reclaimed" as + // metadata codes by ZIP 316 at the time R1 was introduced. (R0 | R1, Unknown(typecode)) => Ok(MetadataItem::Unknown { typecode, data: data.to_vec(), }), - (R0, ExpiryHeight | ExpiryTime) => Err(ParseError::NotUnderstood(typecode.into())), } } @@ -564,9 +567,7 @@ pub(crate) mod private { return Err(ParseError::InvalidTypecodeOrder); } else if t_code == prev_code { return Err(ParseError::DuplicateTypecode(t)); - } else if t == Typecode::Data(DataTypecode::P2sh) - && prev_code == Some(u32::from(DataTypecode::P2pkh)) - { + } else if t == Typecode::P2SH && prev_code == Some(u32::from(DataTypecode::P2pkh)) { // P2pkh and P2sh can only be in that order and next to each other, // otherwise we would detect an out-of-order or duplicate typecode. return Err(ParseError::BothP2phkAndP2sh);