Deserialize Bitcoin-encoded strings.
This commit is contained in:
parent
715ed52617
commit
78b1aabed0
|
|
@ -221,10 +221,13 @@ impl ZcashSerialization for String {
|
||||||
|
|
||||||
/// Try to read `self` from the given `reader`.
|
/// Try to read `self` from the given `reader`.
|
||||||
fn try_read<R: io::Read>(
|
fn try_read<R: io::Read>(
|
||||||
_reader: R,
|
mut reader: R,
|
||||||
_magic: Magic,
|
_magic: Magic,
|
||||||
_version: Version,
|
_version: Version,
|
||||||
) -> Result<Self, SerializationError> {
|
) -> Result<Self, SerializationError> {
|
||||||
unimplemented!()
|
let len = reader.read_compactsize()?;
|
||||||
|
let mut buf = vec![0; len as usize];
|
||||||
|
reader.read_exact(&mut buf)?;
|
||||||
|
String::from_utf8(buf).map_err(|e| SerializationError::ParseError("invalid utf-8"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue