_test_vectors = []
no-std = ["hashbrown", "possiblyrandom", "core2/alloc", "libm"]
-std = ["bitcoin/std", "bech32/std"]
+std = ["bitcoin/std", "bech32/std", "core2/alloc"]
# Generates low-r bitcoin signatures, which saves 1 byte in 50% of the cases
grind_signatures = []
extern crate hex;
#[cfg(any(test, feature = "_test_utils"))] extern crate regex;
+extern crate core2;
+
#[cfg(not(feature = "std"))] extern crate core2;
#[cfg(not(feature = "std"))] extern crate libm;
pub(crate) mod crypto;
+pub mod io {
+ pub use bitcoin::io::*;
+
+ pub use core2::io::Seek;
+ pub use core2::io::SeekFrom;
+}
+
#[cfg(feature = "std")]
/// Re-export of either `core2::io` or `std::io`, depending on the `std` feature flag.
-pub use std::io;
+// pub use bitcoin::io;
#[cfg(not(feature = "std"))]
/// Re-export of either `core2::io` or `std::io`, depending on the `std` feature flag.
-pub use core2::io;
+// pub use bitcoin::io;
#[cfg(not(feature = "std"))]
#[doc(hidden)]
match consensus::encode::Decodable::consensus_decode(r) {
Ok(t) => Ok(t),
Err(consensus::encode::Error::Io(ref e)) if e.kind() == io::ErrorKind::UnexpectedEof => Err(DecodeError::ShortRead),
- Err(consensus::encode::Error::Io(e)) => Err(DecodeError::Io(e.kind())),
+ Err(consensus::encode::Error::Io(e)) => Err(DecodeError::Io(e.kind().into())),
Err(_) => Err(DecodeError::InvalidValue),
}
}
}
}
-impl Into<io::ErrorKind> for bitcoin::io::ErrorKind {
- fn into(self) -> io::ErrorKind {
- todo!()
- }
-}
-
-impl Writeable for Witness {
- fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
- match self.consensus_encode(&mut WriterWriteAdaptor(writer)) {
- Ok(_) => Ok(()),
- Err(e) => Err(e.into()),
- }
- }
-}
-impl Readable for Witness {
- fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {
- match consensus::encode::Decodable::consensus_decode(r) {
- Ok(t) => Ok(t),
- Err(consensus::encode::Error::Io(ref e)) if e.kind() == bitcoin::io::ErrorKind::UnexpectedEof => Err(DecodeError::ShortRead),
- Err(consensus::encode::Error::Io(e)) => Err(DecodeError::Io(e.kind())),
- Err(_) => Err(DecodeError::InvalidValue),
- }
- }
-}
-
impl_consensus_ser!(Transaction);
impl_consensus_ser!(TxOut);
-// impl_consensus_ser!(Witness);
+impl_consensus_ser!(Witness);
impl<T: Readable> Readable for Mutex<T> {
fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {