+ match ecdsa::Signature::from_compact(&buf) {
+ Ok(sig) => Ok(sig),
+ Err(_) => return Err(DecodeError::InvalidValue),
+ }
+ }
+}
+
+impl Writeable for schnorr::Signature {
+ fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
+ self.as_ref().write(w)
+ }
+}
+
+impl Readable for schnorr::Signature {
+ fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {
+ let buf: [u8; SCHNORR_SIGNATURE_SIZE] = Readable::read(r)?;
+ match schnorr::Signature::from_slice(&buf) {