diff --git a/bitcoin/src/psbt/raw.rs b/bitcoin/src/psbt/raw.rs index 110624b58..fb49001d9 100644 --- a/bitcoin/src/psbt/raw.rs +++ b/bitcoin/src/psbt/raw.rs @@ -143,8 +143,8 @@ where Subtype: Copy + From + Into, { fn consensus_encode(&self, w: &mut W) -> Result { - let mut len = self.prefix.consensus_encode(w)? + 1; - w.emit_compact_size(self.subtype.into())?; + let mut len = self.prefix.consensus_encode(w)?; + len += w.emit_compact_size(self.subtype.into())?; w.write_all(&self.key)?; len += self.key.len(); Ok(len)