]> git.bitcoin.ninja Git - rust-lightning/commitdiff
TODO: FIXME! experimental upgrade to bitcoin 0.32.2
authorArik Sosman <git@arik.io>
Fri, 28 Jun 2024 19:07:37 +0000 (15:07 -0400)
committerArik Sosman <git@arik.io>
Thu, 18 Jul 2024 08:06:47 +0000 (01:06 -0700)
lightning/Cargo.toml
lightning/src/lib.rs
lightning/src/util/ser.rs

index dfb17b957299a3e4ceb29f00260b94754aaa9ada..b0d68fc10383513b0fcacdbe313cbee0f5841844 100644 (file)
@@ -32,7 +32,7 @@ unsafe_revoked_tx_signing = []
 _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 = []
index 5274ea0bf309ce2d0709936d496d8a098b561ebc..191788ad6d33c7de202ace70a11edc1f9efc4942 100644 (file)
@@ -68,6 +68,8 @@ extern crate core;
 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;
 
@@ -86,12 +88,19 @@ pub mod events;
 
 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)]
index 42efdc46d590200c3ce13368236b9f9dcefae3a5..ec9022ca4ffdd0f3827810dcc956b451ecac16ca 100644 (file)
@@ -1238,7 +1238,7 @@ macro_rules! impl_consensus_ser {
                                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),
                                }
                        }
@@ -1246,34 +1246,9 @@ macro_rules! impl_consensus_ser {
        }
 }
 
-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> {