"bitcoin::secp256k1::Error" if !is_ref => Some("crate::c_types::Secp256k1Error"),
"bitcoin::blockdata::script::Script" if is_ref => Some("crate::c_types::u8slice"),
"bitcoin::blockdata::script::Script" if !is_ref => Some("crate::c_types::derived::CVec_u8Z"),
- "bitcoin::blockdata::transaction::OutPoint" if is_ref => Some("crate::chain::transaction::OutPoint"),
+ "bitcoin::blockdata::transaction::OutPoint" => Some("crate::chain::transaction::OutPoint"),
"bitcoin::blockdata::transaction::Transaction" => Some("crate::c_types::Transaction"),
"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some("crate::c_types::TxOut"),
- "bitcoin::OutPoint" => Some("crate::chain::transaction::OutPoint"),
"bitcoin::network::constants::Network" => Some("crate::bitcoin::network::Network"),
"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::script::Script" if is_ref => Some("crate::c_types::u8slice::from_slice(&"),
"bitcoin::blockdata::script::Script" if !is_ref => Some(""),
"bitcoin::blockdata::transaction::Transaction" => Some("crate::c_types::Transaction::from_vec(local_"),
+ "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::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::script::Script" if is_ref => Some("[..])"),
"bitcoin::blockdata::script::Script" if !is_ref => Some(".into_bytes().into()"),
"bitcoin::blockdata::transaction::Transaction" => Some(")"),
+ "bitcoin::blockdata::transaction::OutPoint" => Some(")"),
"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some(")"),
"bitcoin::blockdata::block::BlockHeader" if is_ref => Some(""),
"bitcoin::blockdata::block::Block" if is_ref => Some(")"),
use bitcoin::Script as BitcoinScript;
use bitcoin::Transaction as BitcoinTransaction;
+use bitcoin::hashes::Hash;
use bitcoin::secp256k1::key::PublicKey as SecpPublicKey;
use bitcoin::secp256k1::key::SecretKey as SecpSecretKey;
use bitcoin::secp256k1::Signature as SecpSignature;
use bitcoin::secp256k1::Error as SecpError;
+use std::convert::TryInto; // Bindings need at least rustc 1.34
+
#[derive(Clone)]
#[repr(C)]
pub struct PublicKey {
#[no_mangle]
pub extern "C" fn Transaction_free(_res: Transaction) { }
+pub(crate) fn bitcoin_to_C_outpoint(outpoint: ::bitcoin::blockdata::transaction::OutPoint) -> crate::chain::transaction::OutPoint {
+ crate::chain::transaction::OutPoint_new(ThirtyTwoBytes { data: outpoint.txid.into_inner() }, outpoint.vout.try_into().unwrap())
+}
+
#[repr(C)]
#[derive(Clone)]
/// A transaction output including a scriptPubKey and value.