diff --git a/client/src/client.rs b/client/src/client.rs index 574de5f5..57f70678 100644 --- a/client/src/client.rs +++ b/client/src/client.rs @@ -20,7 +20,7 @@ use serde; use serde_json; use bitcoin::hashes::hex::{FromHex, ToHex}; -use bitcoin::secp256k1::Signature; +use bitcoin::secp256k1::ecdsa::Signature; use bitcoin::{ Address, Amount, Block, BlockHeader, OutPoint, PrivateKey, PublicKey, Script, Transaction, }; @@ -1091,7 +1091,7 @@ pub trait RpcApi: Sized { ]; let defaults = [ true.into(), - into_json(json::SigHashType::from(bitcoin::SigHashType::All))?, + into_json(json::SigHashType::from(bitcoin::EcdsaSighashType::All))?, true.into(), ]; self.call("walletprocesspsbt", handle_defaults(&mut args, &defaults)) diff --git a/integration_test/Cargo.toml b/integration_test/Cargo.toml index f2b0ee09..c9c635b9 100644 --- a/integration_test/Cargo.toml +++ b/integration_test/Cargo.toml @@ -5,6 +5,6 @@ authors = ["Steven Roose "] [dependencies] bitcoincore-rpc = { path = "../client" } -bitcoin = { version = "0.27", features = [ "use-serde", "rand" ] } +bitcoin = { version = "0.28.0", features = [ "use-serde", "rand" ] } lazy_static = "1.4.0" log = "0.4" diff --git a/integration_test/src/main.rs b/integration_test/src/main.rs index 2c94b8fd..a8b7a33e 100644 --- a/integration_test/src/main.rs +++ b/integration_test/src/main.rs @@ -27,8 +27,8 @@ use bitcoin::hashes::hex::{FromHex, ToHex}; use bitcoin::hashes::Hash; use bitcoin::secp256k1; use bitcoin::{ - Address, Amount, Network, OutPoint, PrivateKey, Script, SigHashType, SignedAmount, Transaction, - TxIn, TxOut, Txid, + Address, Amount, Network, OutPoint, PrivateKey, Script, EcdsaSighashType, SignedAmount, Transaction, + TxIn, TxOut, Txid, Witness, }; use bitcoincore_rpc::bitcoincore_rpc_json::{ GetBlockTemplateModes, GetBlockTemplateRules, ScanTxOutRequest, @@ -537,7 +537,7 @@ fn test_get_block_filter(cl: &Client) { fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) { let sk = PrivateKey { network: Network::Regtest, - key: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()), + inner: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()), compressed: true, }; let addr = Address::p2wpkh(&sk.public_key(&SECP), Network::Regtest).unwrap(); @@ -559,7 +559,7 @@ fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) { }, sequence: 0xFFFFFFFF, script_sig: Script::new(), - witness: Vec::new(), + witness: Witness::new(), }], output: vec![TxOut { value: (unspent.amount - *FEE).as_sat(), @@ -588,7 +588,7 @@ fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) { }, script_sig: Script::new(), sequence: 0xFFFFFFFF, - witness: Vec::new(), + witness: Witness::new(), }], output: vec![TxOut { value: (unspent.amount - *FEE - *FEE).as_sat(), @@ -597,7 +597,7 @@ fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) { }; let res = - cl.sign_raw_transaction_with_key(&tx, &[sk], None, Some(SigHashType::All.into())).unwrap(); + cl.sign_raw_transaction_with_key(&tx, &[sk], None, Some(EcdsaSighashType::All.into())).unwrap(); assert!(res.complete); let _ = cl.send_raw_transaction(&res.transaction().unwrap()).unwrap(); } @@ -846,7 +846,7 @@ fn test_list_received_by_address(cl: &Client) { fn test_import_public_key(cl: &Client) { let sk = PrivateKey { network: Network::Regtest, - key: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()), + inner: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()), compressed: true, }; cl.import_public_key(&sk.public_key(&SECP), None, None).unwrap(); @@ -857,7 +857,7 @@ fn test_import_public_key(cl: &Client) { fn test_import_priv_key(cl: &Client) { let sk = PrivateKey { network: Network::Regtest, - key: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()), + inner: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()), compressed: true, }; cl.import_private_key(&sk, None, None).unwrap(); @@ -868,7 +868,7 @@ fn test_import_priv_key(cl: &Client) { fn test_import_address(cl: &Client) { let sk = PrivateKey { network: Network::Regtest, - key: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()), + inner: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()), compressed: true, }; let addr = Address::p2pkh(&sk.public_key(&SECP), Network::Regtest); @@ -880,7 +880,7 @@ fn test_import_address(cl: &Client) { fn test_import_address_script(cl: &Client) { let sk = PrivateKey { network: Network::Regtest, - key: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()), + inner: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()), compressed: true, }; let addr = Address::p2pkh(&sk.public_key(&SECP), Network::Regtest); diff --git a/json/Cargo.toml b/json/Cargo.toml index a3c0c074..c3e0c635 100644 --- a/json/Cargo.toml +++ b/json/Cargo.toml @@ -21,4 +21,4 @@ path = "src/lib.rs" serde = { version = "1", features = [ "derive" ] } serde_json = "1" -bitcoin = { version = "0.27", features = [ "use-serde" ] } +bitcoin = { version = "0.28.0", features = [ "use-serde" ] } diff --git a/json/src/lib.rs b/json/src/lib.rs index 61930614..58e8933c 100644 --- a/json/src/lib.rs +++ b/json/src/lib.rs @@ -1095,7 +1095,7 @@ impl<'a> serde::Serialize for ImportMultiRequestScriptPubkey<'a> { #[derive(Serialize)] struct Tmp<'a> { pub address: &'a Address, - }; + } serde::Serialize::serialize( &Tmp { address: addr, @@ -1733,12 +1733,12 @@ pub enum EstimateMode { Conservative, } -/// A wrapper around bitcoin::SigHashType that will be serialized +/// A wrapper around bitcoin::EcdsaSighashType that will be serialized /// according to what the RPC expects. -pub struct SigHashType(bitcoin::SigHashType); +pub struct SigHashType(bitcoin::EcdsaSighashType); -impl From for SigHashType { - fn from(sht: bitcoin::SigHashType) -> SigHashType { +impl From for SigHashType { + fn from(sht: bitcoin::EcdsaSighashType) -> SigHashType { SigHashType(sht) } } @@ -1749,12 +1749,12 @@ impl serde::Serialize for SigHashType { S: serde::Serializer, { serializer.serialize_str(match self.0 { - bitcoin::SigHashType::All => "ALL", - bitcoin::SigHashType::None => "NONE", - bitcoin::SigHashType::Single => "SINGLE", - bitcoin::SigHashType::AllPlusAnyoneCanPay => "ALL|ANYONECANPAY", - bitcoin::SigHashType::NonePlusAnyoneCanPay => "NONE|ANYONECANPAY", - bitcoin::SigHashType::SinglePlusAnyoneCanPay => "SINGLE|ANYONECANPAY", + bitcoin::EcdsaSighashType::All => "ALL", + bitcoin::EcdsaSighashType::None => "NONE", + bitcoin::EcdsaSighashType::Single => "SINGLE", + bitcoin::EcdsaSighashType::AllPlusAnyoneCanPay => "ALL|ANYONECANPAY", + bitcoin::EcdsaSighashType::NonePlusAnyoneCanPay => "NONE|ANYONECANPAY", + bitcoin::EcdsaSighashType::SinglePlusAnyoneCanPay => "SINGLE|ANYONECANPAY", }) } }