From 78b1aabed0e3f2f06f9275f599877b2e9c837fc8 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Sat, 14 Sep 2019 09:32:14 -0700 Subject: [PATCH] Deserialize Bitcoin-encoded strings. --- zebra-network/src/serialization.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zebra-network/src/serialization.rs b/zebra-network/src/serialization.rs index e0ecfec09..cd748d4e5 100644 --- a/zebra-network/src/serialization.rs +++ b/zebra-network/src/serialization.rs @@ -221,10 +221,13 @@ impl ZcashSerialization for String { /// Try to read `self` from the given `reader`. fn try_read( - _reader: R, + mut reader: R, _magic: Magic, _version: Version, ) -> Result { - 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")) } } \ No newline at end of file