Skip to content

Commit 79d457d

Browse files
committed
Merge #210: Bump 'bitcoin' crate to 0.28.0
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
2 parents 9bbca7f + e35368f commit 79d457d

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

client/src/client.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use serde;
2020
use serde_json;
2121

2222
use bitcoin::hashes::hex::{FromHex, ToHex};
23-
use bitcoin::secp256k1::Signature;
23+
use bitcoin::secp256k1::ecdsa::Signature;
2424
use bitcoin::{
2525
Address, Amount, Block, BlockHeader, OutPoint, PrivateKey, PublicKey, Script, Transaction,
2626
};
@@ -1091,7 +1091,7 @@ pub trait RpcApi: Sized {
10911091
];
10921092
let defaults = [
10931093
true.into(),
1094-
into_json(json::SigHashType::from(bitcoin::SigHashType::All))?,
1094+
into_json(json::SigHashType::from(bitcoin::EcdsaSighashType::All))?,
10951095
true.into(),
10961096
];
10971097
self.call("walletprocesspsbt", handle_defaults(&mut args, &defaults))

integration_test/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ authors = ["Steven Roose <[email protected]>"]
55

66
[dependencies]
77
bitcoincore-rpc = { path = "../client" }
8-
bitcoin = { version = "0.27", features = [ "use-serde", "rand" ] }
8+
bitcoin = { version = "0.28.0", features = [ "use-serde", "rand" ] }
99
lazy_static = "1.4.0"
1010
log = "0.4"

integration_test/src/main.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ use bitcoin::hashes::hex::{FromHex, ToHex};
2727
use bitcoin::hashes::Hash;
2828
use bitcoin::secp256k1;
2929
use bitcoin::{
30-
Address, Amount, Network, OutPoint, PrivateKey, Script, SigHashType, SignedAmount, Transaction,
31-
TxIn, TxOut, Txid,
30+
Address, Amount, Network, OutPoint, PrivateKey, Script, EcdsaSighashType, SignedAmount, Transaction,
31+
TxIn, TxOut, Txid, Witness,
3232
};
3333
use bitcoincore_rpc::bitcoincore_rpc_json::{
3434
GetBlockTemplateModes, GetBlockTemplateRules, ScanTxOutRequest,
@@ -537,7 +537,7 @@ fn test_get_block_filter(cl: &Client) {
537537
fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) {
538538
let sk = PrivateKey {
539539
network: Network::Regtest,
540-
key: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()),
540+
inner: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()),
541541
compressed: true,
542542
};
543543
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) {
559559
},
560560
sequence: 0xFFFFFFFF,
561561
script_sig: Script::new(),
562-
witness: Vec::new(),
562+
witness: Witness::new(),
563563
}],
564564
output: vec![TxOut {
565565
value: (unspent.amount - *FEE).as_sat(),
@@ -588,7 +588,7 @@ fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) {
588588
},
589589
script_sig: Script::new(),
590590
sequence: 0xFFFFFFFF,
591-
witness: Vec::new(),
591+
witness: Witness::new(),
592592
}],
593593
output: vec![TxOut {
594594
value: (unspent.amount - *FEE - *FEE).as_sat(),
@@ -597,7 +597,7 @@ fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) {
597597
};
598598

599599
let res =
600-
cl.sign_raw_transaction_with_key(&tx, &[sk], None, Some(SigHashType::All.into())).unwrap();
600+
cl.sign_raw_transaction_with_key(&tx, &[sk], None, Some(EcdsaSighashType::All.into())).unwrap();
601601
assert!(res.complete);
602602
let _ = cl.send_raw_transaction(&res.transaction().unwrap()).unwrap();
603603
}
@@ -846,7 +846,7 @@ fn test_list_received_by_address(cl: &Client) {
846846
fn test_import_public_key(cl: &Client) {
847847
let sk = PrivateKey {
848848
network: Network::Regtest,
849-
key: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()),
849+
inner: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()),
850850
compressed: true,
851851
};
852852
cl.import_public_key(&sk.public_key(&SECP), None, None).unwrap();
@@ -857,7 +857,7 @@ fn test_import_public_key(cl: &Client) {
857857
fn test_import_priv_key(cl: &Client) {
858858
let sk = PrivateKey {
859859
network: Network::Regtest,
860-
key: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()),
860+
inner: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()),
861861
compressed: true,
862862
};
863863
cl.import_private_key(&sk, None, None).unwrap();
@@ -868,7 +868,7 @@ fn test_import_priv_key(cl: &Client) {
868868
fn test_import_address(cl: &Client) {
869869
let sk = PrivateKey {
870870
network: Network::Regtest,
871-
key: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()),
871+
inner: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()),
872872
compressed: true,
873873
};
874874
let addr = Address::p2pkh(&sk.public_key(&SECP), Network::Regtest);
@@ -880,7 +880,7 @@ fn test_import_address(cl: &Client) {
880880
fn test_import_address_script(cl: &Client) {
881881
let sk = PrivateKey {
882882
network: Network::Regtest,
883-
key: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()),
883+
inner: secp256k1::SecretKey::new(&mut secp256k1::rand::thread_rng()),
884884
compressed: true,
885885
};
886886
let addr = Address::p2pkh(&sk.public_key(&SECP), Network::Regtest);

json/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ path = "src/lib.rs"
2121
serde = { version = "1", features = [ "derive" ] }
2222
serde_json = "1"
2323

24-
bitcoin = { version = "0.27", features = [ "use-serde" ] }
24+
bitcoin = { version = "0.28.0", features = [ "use-serde" ] }

json/src/lib.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ impl<'a> serde::Serialize for ImportMultiRequestScriptPubkey<'a> {
10951095
#[derive(Serialize)]
10961096
struct Tmp<'a> {
10971097
pub address: &'a Address,
1098-
};
1098+
}
10991099
serde::Serialize::serialize(
11001100
&Tmp {
11011101
address: addr,
@@ -1733,12 +1733,12 @@ pub enum EstimateMode {
17331733
Conservative,
17341734
}
17351735

1736-
/// A wrapper around bitcoin::SigHashType that will be serialized
1736+
/// A wrapper around bitcoin::EcdsaSighashType that will be serialized
17371737
/// according to what the RPC expects.
1738-
pub struct SigHashType(bitcoin::SigHashType);
1738+
pub struct SigHashType(bitcoin::EcdsaSighashType);
17391739

1740-
impl From<bitcoin::SigHashType> for SigHashType {
1741-
fn from(sht: bitcoin::SigHashType) -> SigHashType {
1740+
impl From<bitcoin::EcdsaSighashType> for SigHashType {
1741+
fn from(sht: bitcoin::EcdsaSighashType) -> SigHashType {
17421742
SigHashType(sht)
17431743
}
17441744
}
@@ -1749,12 +1749,12 @@ impl serde::Serialize for SigHashType {
17491749
S: serde::Serializer,
17501750
{
17511751
serializer.serialize_str(match self.0 {
1752-
bitcoin::SigHashType::All => "ALL",
1753-
bitcoin::SigHashType::None => "NONE",
1754-
bitcoin::SigHashType::Single => "SINGLE",
1755-
bitcoin::SigHashType::AllPlusAnyoneCanPay => "ALL|ANYONECANPAY",
1756-
bitcoin::SigHashType::NonePlusAnyoneCanPay => "NONE|ANYONECANPAY",
1757-
bitcoin::SigHashType::SinglePlusAnyoneCanPay => "SINGLE|ANYONECANPAY",
1752+
bitcoin::EcdsaSighashType::All => "ALL",
1753+
bitcoin::EcdsaSighashType::None => "NONE",
1754+
bitcoin::EcdsaSighashType::Single => "SINGLE",
1755+
bitcoin::EcdsaSighashType::AllPlusAnyoneCanPay => "ALL|ANYONECANPAY",
1756+
bitcoin::EcdsaSighashType::NonePlusAnyoneCanPay => "NONE|ANYONECANPAY",
1757+
bitcoin::EcdsaSighashType::SinglePlusAnyoneCanPay => "SINGLE|ANYONECANPAY",
17581758
})
17591759
}
17601760
}

0 commit comments

Comments
 (0)