fix: allow extra bytes when decoding base address (#420)
This commit is contained in:
parent
ce8eac735b
commit
b640ce4097
1 changed files with 7 additions and 1 deletions
|
|
@ -337,7 +337,7 @@ macro_rules! parse_shelley_fn {
|
||||||
};
|
};
|
||||||
($name:tt, $payment:tt, $delegation:tt) => {
|
($name:tt, $payment:tt, $delegation:tt) => {
|
||||||
fn $name(header: u8, payload: &[u8]) -> Result<Address, Error> {
|
fn $name(header: u8, payload: &[u8]) -> Result<Address, Error> {
|
||||||
if payload.len() != 56 {
|
if payload.len() < 56 {
|
||||||
return Err(Error::InvalidAddressLength(payload.len()));
|
return Err(Error::InvalidAddressLength(payload.len()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -917,4 +917,10 @@ mod tests {
|
||||||
_ => panic!(),
|
_ => panic!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_minted_extra_bytes_base_address() {
|
||||||
|
let addr = Address::from_hex("015bad085057ac10ecc7060f7ac41edd6f63068d8963ef7d86ca58669e5ecf2d283418a60be5a848a2380eb721000da1e0bbf39733134beca4cb57afb0b35fc89c63061c9914e055001a518c7516");
|
||||||
|
assert!(matches!(addr, Ok(Address::Shelley(_))));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue