fix(primitives): Add missing variant (not in CDDL) to AddrAttr enum (#69)
This commit is contained in:
parent
c24a5fb068
commit
cde0836757
2 changed files with 10 additions and 3 deletions
|
|
@ -134,6 +134,7 @@ impl minicbor::Encode for AddrType {
|
|||
pub enum AddrAttrProperty {
|
||||
AddrDistr(AddrDistr),
|
||||
Bytes(ByteVec),
|
||||
Unparsed(u8, ByteVec),
|
||||
}
|
||||
|
||||
impl<'b> minicbor::Decode<'b> for AddrAttrProperty {
|
||||
|
|
@ -143,9 +144,7 @@ impl<'b> minicbor::Decode<'b> for AddrAttrProperty {
|
|||
match key {
|
||||
0 => Ok(AddrAttrProperty::AddrDistr(d.decode()?)),
|
||||
1 => Ok(AddrAttrProperty::Bytes(d.decode()?)),
|
||||
_ => Err(minicbor::decode::Error::message(
|
||||
"unknown variant for addrattr property",
|
||||
)),
|
||||
x => Ok(AddrAttrProperty::Unparsed(x, d.decode()?)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -166,6 +165,12 @@ impl minicbor::Encode for AddrAttrProperty {
|
|||
e.u32(1)?;
|
||||
e.encode(x)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
AddrAttrProperty::Unparsed(a, b) => {
|
||||
e.encode(a)?;
|
||||
e.encode(b)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
@ -964,6 +969,7 @@ mod tests {
|
|||
include_str!("test_data/test4.block"),
|
||||
include_str!("test_data/test5.block"),
|
||||
include_str!("test_data/test6.block"),
|
||||
include_str!("test_data/test7.block"),
|
||||
];
|
||||
|
||||
for (idx, block_str) in test_blocks.iter().enumerate() {
|
||||
|
|
|
|||
1
pallas-primitives/src/byron/test_data/test7.block
Normal file
1
pallas-primitives/src/byron/test_data/test7.block
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue