"bitcoin::blockdata::transaction::Transaction"|"bitcoin::Transaction" => Some("crate::c_types::Transaction"),
"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some("crate::c_types::TxOut"),
"bitcoin::network::constants::Network" => Some("crate::bitcoin::network::Network"),
+ "bitcoin::util::address::WitnessVersion" => Some("crate::c_types::WitnessVersion"),
"bitcoin::blockdata::block::BlockHeader" if is_ref => Some("*const [u8; 80]"),
"bitcoin::blockdata::block::Block" if is_ref => Some("crate::c_types::u8slice"),
"bitcoin::blockdata::transaction::OutPoint" => Some("crate::c_types::C_to_bitcoin_outpoint("),
"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some(""),
"bitcoin::network::constants::Network" => Some(""),
+ "bitcoin::util::address::WitnessVersion" => Some(""),
"bitcoin::blockdata::block::BlockHeader" => Some("&::bitcoin::consensus::encode::deserialize(unsafe { &*"),
"bitcoin::blockdata::block::Block" if is_ref => Some("&::bitcoin::consensus::encode::deserialize("),
"bitcoin::blockdata::transaction::OutPoint" => Some(")"),
"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some(".into_rust()"),
"bitcoin::network::constants::Network" => Some(".into_bitcoin()"),
+ "bitcoin::util::address::WitnessVersion" => Some(".into()"),
"bitcoin::blockdata::block::BlockHeader" => Some(" }).unwrap()"),
"bitcoin::blockdata::block::Block" => Some(".to_slice()).unwrap()"),
"bitcoin::blockdata::transaction::OutPoint" => Some("crate::c_types::bitcoin_to_C_outpoint("),
"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some("crate::c_types::TxOut::from_rust("),
"bitcoin::network::constants::Network" => Some("crate::bitcoin::network::Network::from_bitcoin("),
+ "bitcoin::util::address::WitnessVersion" => Some(""),
"bitcoin::blockdata::block::BlockHeader" if is_ref => Some("&local_"),
"bitcoin::blockdata::block::Block" if is_ref => Some("crate::c_types::u8slice::from_slice(&local_"),
"bitcoin::blockdata::transaction::OutPoint" => Some(")"),
"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some(")"),
"bitcoin::network::constants::Network" => Some(")"),
+ "bitcoin::util::address::WitnessVersion" => Some(".into()"),
"bitcoin::blockdata::block::BlockHeader" if is_ref => Some(""),
"bitcoin::blockdata::block::Block" if is_ref => Some(")"),
use bitcoin::secp256k1::ecdsa::RecoveryId;
use bitcoin::secp256k1::ecdsa::RecoverableSignature as SecpRecoverableSignature;
use bitcoin::bech32;
+use bitcoin::util::address;
use core::convert::TryInto; // Bindings need at least rustc 1.34
use core::ffi::c_void;
fn into(self) -> bech32::u5 { bech32::u5::try_from_u8(self.0).expect("u5 objects must be in the range 0..32") }
}
+/// Integer in the range `0..=16`
+#[derive(PartialEq, Eq, Copy, Clone)]
+#[repr(C)]
+pub struct WitnessVersion(u8);
+
+impl From<address::WitnessVersion> for WitnessVersion {
+ fn from(o: address::WitnessVersion) -> Self { Self(o.into_num()) }
+}
+impl Into<address::WitnessVersion> for WitnessVersion {
+ fn into(self) -> address::WitnessVersion { address::WitnessVersion::from_num(self.0).expect("WitnessVersion objects must be in the range 0..=16") }
+}
+
#[derive(Clone)]
#[repr(C)]
/// Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.