fix(primitives): Add missing variant (not in CDDL) to AddrAttr enum (#69)
This commit is contained in:
parent
d95bc1108d
commit
c770e513e5
2 changed files with 10 additions and 3 deletions
|
|
@ -134,6 +134,7 @@ impl minicbor::Encode for AddrType {
|
||||||
pub enum AddrAttrProperty {
|
pub enum AddrAttrProperty {
|
||||||
AddrDistr(AddrDistr),
|
AddrDistr(AddrDistr),
|
||||||
Bytes(ByteVec),
|
Bytes(ByteVec),
|
||||||
|
Unparsed(u8, ByteVec),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'b> minicbor::Decode<'b> for AddrAttrProperty {
|
impl<'b> minicbor::Decode<'b> for AddrAttrProperty {
|
||||||
|
|
@ -143,9 +144,7 @@ impl<'b> minicbor::Decode<'b> for AddrAttrProperty {
|
||||||
match key {
|
match key {
|
||||||
0 => Ok(AddrAttrProperty::AddrDistr(d.decode()?)),
|
0 => Ok(AddrAttrProperty::AddrDistr(d.decode()?)),
|
||||||
1 => Ok(AddrAttrProperty::Bytes(d.decode()?)),
|
1 => Ok(AddrAttrProperty::Bytes(d.decode()?)),
|
||||||
_ => Err(minicbor::decode::Error::message(
|
x => Ok(AddrAttrProperty::Unparsed(x, d.decode()?)),
|
||||||
"unknown variant for addrattr property",
|
|
||||||
)),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -166,6 +165,12 @@ impl minicbor::Encode for AddrAttrProperty {
|
||||||
e.u32(1)?;
|
e.u32(1)?;
|
||||||
e.encode(x)?;
|
e.encode(x)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
AddrAttrProperty::Unparsed(a, b) => {
|
||||||
|
e.encode(a)?;
|
||||||
|
e.encode(b)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -964,6 +969,7 @@ mod tests {
|
||||||
include_str!("test_data/test4.block"),
|
include_str!("test_data/test4.block"),
|
||||||
include_str!("test_data/test5.block"),
|
include_str!("test_data/test5.block"),
|
||||||
include_str!("test_data/test6.block"),
|
include_str!("test_data/test6.block"),
|
||||||
|
include_str!("test_data/test7.block"),
|
||||||
];
|
];
|
||||||
|
|
||||||
for (idx, block_str) in test_blocks.iter().enumerate() {
|
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