Use &[u8] instead of Cursor as Read

This commit is contained in:
DanGould 2023-01-09 23:21:20 -05:00
parent 81ca10701a
commit 1a409ecc8e
No known key found for this signature in database
GPG Key ID: B07290B28996AFE0
2 changed files with 3 additions and 3 deletions

View File

@ -54,7 +54,7 @@ macro_rules! impl_psbtmap_deserialize {
($thing:ty) => {
impl $crate::psbt::serialize::Deserialize for $thing {
fn deserialize(bytes: &[u8]) -> Result<Self, $crate::consensus::encode::Error> {
let mut decoder = crate::io::Cursor::new(bytes);
let mut decoder = bytes;
Self::decode(&mut decoder)
}
}

View File

@ -11,7 +11,7 @@ use crate::prelude::*;
use core::fmt;
use core::convert::TryFrom;
use crate::io::{self, Cursor};
use crate::io;
use crate::consensus::encode::{self, ReadExt, WriteExt, Decodable, Encodable, VarInt, serialize, deserialize, MAX_VEC_SIZE};
use crate::psbt::Error;
@ -125,7 +125,7 @@ impl Serialize for Pair {
impl Deserialize for Pair {
fn deserialize(bytes: &[u8]) -> Result<Self, encode::Error> {
let mut decoder = Cursor::new(bytes);
let mut decoder = bytes;
Pair::decode(&mut decoder)
}
}