Skip to content

Commit

Permalink
Merge #210: Bump 'bitcoin' crate to 0.28.0
Browse files Browse the repository at this point in the history
e35368f Bump 'bitcoin' crate to 0.28.0 (Roman Zeyde)

Pull request description:

  Following rust-bitcoin/rust-bitcoin#789.

ACKs for top commit:
  sanket1729:
    ACK e35368f
  elichai:
    ACK e35368f
  dunxen:
    ACK e35368f
  RCasatta:
    ACK e35368f

Tree-SHA512: e97b09c220835e3af3e7c844c6275b62a1906919ef57c3017afa939b5d95b769126d5e6133b118e464506815b47f090b9ed59d6fd1ec1c6125a54bec64c3ffac
  • Loading branch information
RCasatta committed Apr 30, 2022
2 parents 9bbca7f + e35368f commit 79d457d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion integration_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ authors = ["Steven Roose <steven@stevenroose.org>"]

[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"
20 changes: 10 additions & 10 deletions integration_test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand All @@ -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(),
Expand Down Expand Up @@ -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(),
Expand All @@ -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();
}
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion json/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ] }
22 changes: 11 additions & 11 deletions json/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<bitcoin::SigHashType> for SigHashType {
fn from(sht: bitcoin::SigHashType) -> SigHashType {
impl From<bitcoin::EcdsaSighashType> for SigHashType {
fn from(sht: bitcoin::EcdsaSighashType) -> SigHashType {
SigHashType(sht)
}
}
Expand All @@ -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",
})
}
}
Expand Down

0 comments on commit 79d457d

Please sign in to comment.