Skip to content

Commit 1b51e3d

Browse files
authored
Merge pull request #313 from tcharding/10-30-bump-version
Tracking PR for release `0.18.0`
2 parents 413da8c + f0efe22 commit 1b51e3d

File tree

9 files changed

+35
-31
lines changed

9 files changed

+35
-31
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# Unreleased
1+
# 0.18.0
22

33
- MSRV changed from 1.41.1 to 1.48.0
4+
- Use `bitcoin::Network` in `GetBlockchainInfoResult `.
5+
- Make checksum optional in `GetDescriptorInfoResult`.
6+
- Make `getmempoolinfo` compatible with supported RPC versions.
47

58
# 0.17.0
69

client/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bitcoincore-rpc"
3-
version = "0.17.0"
3+
version = "0.18.0"
44
authors = [
55
"Steven Roose <[email protected]>",
66
"Jean Pierre Dudey <[email protected]>",
@@ -19,15 +19,15 @@ name = "bitcoincore_rpc"
1919
path = "src/lib.rs"
2020

2121
[dependencies]
22-
bitcoincore-rpc-json = { version = "0.17.0", path = "../json" }
22+
bitcoincore-rpc-json = { version = "0.18.0", path = "../json" }
2323

2424
log = "0.4.5"
2525
jsonrpc = "0.14.0"
2626

2727
# Used for deserialization of JSON.
2828
serde = "1"
2929
serde_json = "1"
30-
bitcoin-private = "0.1.0"
3130

3231
[dev-dependencies]
3332
tempfile = "3.3.0"
33+

client/src/client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::path::PathBuf;
1616
use std::{fmt, result};
1717

1818
use crate::{bitcoin, deserialize_hex};
19-
use bitcoin_private::hex::exts::DisplayHex;
19+
use bitcoin::hex::DisplayHex;
2020
use jsonrpc;
2121
use serde;
2222
use serde_json;

client/src/error.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use serde_json;
2020
#[derive(Debug)]
2121
pub enum Error {
2222
JsonRpc(jsonrpc::error::Error),
23-
Hex(hex::Error),
23+
Hex(hex::HexToBytesError),
2424
Json(serde_json::error::Error),
2525
BitcoinSerialization(bitcoin::consensus::encode::Error),
2626
Secp256k1(secp256k1::Error),
@@ -39,8 +39,8 @@ impl From<jsonrpc::error::Error> for Error {
3939
}
4040
}
4141

42-
impl From<hex::Error> for Error {
43-
fn from(e: hex::Error) -> Error {
42+
impl From<hex::HexToBytesError> for Error {
43+
fn from(e: hex::HexToBytesError) -> Error {
4444
Error::Hex(e)
4545
}
4646
}

client/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub extern crate bitcoincore_rpc_json;
2828
pub use crate::json::bitcoin;
2929
pub use bitcoincore_rpc_json as json;
3030
use json::bitcoin::consensus::{Decodable, ReadExt};
31-
use json::bitcoin::hashes::hex::HexIterator;
31+
use json::bitcoin::hex::HexToBytesIter;
3232

3333
mod client;
3434
mod error;
@@ -39,7 +39,7 @@ pub use crate::error::Error;
3939
pub use crate::queryable::*;
4040

4141
fn deserialize_hex<T: Decodable>(hex: &str) -> Result<T> {
42-
let mut reader = HexIterator::new(&hex)?;
42+
let mut reader = HexToBytesIter::new(&hex)?;
4343
let object = Decodable::consensus_decode(&mut reader)?;
4444
if reader.read_u8().is_ok() {
4545
Err(Error::BitcoinSerialization(bitcoin::consensus::encode::Error::ParseFailed(

integration_test/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ edition = "2018"
66

77
[dependencies]
88
bitcoincore-rpc = { path = "../client" }
9-
bitcoin = { version = "0.30.0", features = ["serde", "rand"]}
9+
bitcoin = { version = "0.31.0", features = ["serde", "rand"]}
1010
lazy_static = "1.4.0"
1111
log = "0.4"

integration_test/src/main.rs

+14-10
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::collections::HashMap;
1717
use std::str::FromStr;
1818

1919
use bitcoin::absolute::LockTime;
20-
use bitcoin::address::NetworkChecked;
20+
use bitcoin::address::{NetworkChecked, NetworkUnchecked};
2121
use bitcoincore_rpc::json;
2222
use bitcoincore_rpc::jsonrpc::error::Error as JsonRpcError;
2323
use bitcoincore_rpc::{Auth, Client, Error, RpcApi};
@@ -28,8 +28,8 @@ use bitcoin::hashes::hex::FromHex;
2828
use bitcoin::hashes::Hash;
2929
use bitcoin::{secp256k1, ScriptBuf, sighash};
3030
use bitcoin::{
31-
Address, Amount, Network, OutPoint, PrivateKey,
32-
Sequence, SignedAmount, Transaction, TxIn, TxOut, Txid, Witness,
31+
transaction, Address, Amount, Network, OutPoint, PrivateKey, Sequence, SignedAmount,
32+
Transaction, TxIn, TxOut, Txid, Witness,
3333
};
3434
use bitcoincore_rpc::bitcoincore_rpc_json::{
3535
GetBlockTemplateModes, GetBlockTemplateRules, ScanTxOutRequest,
@@ -584,7 +584,7 @@ fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) {
584584
let unspent = unspent.into_iter().nth(0).unwrap();
585585

586586
let tx = Transaction {
587-
version: 1,
587+
version: transaction::Version::ONE,
588588
lock_time: LockTime::ZERO,
589589
input: vec![TxIn {
590590
previous_output: OutPoint {
@@ -596,7 +596,7 @@ fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) {
596596
witness: Witness::new(),
597597
}],
598598
output: vec![TxOut {
599-
value: (unspent.amount - *FEE).to_sat(),
599+
value: (unspent.amount - *FEE),
600600
script_pubkey: addr.script_pubkey(),
601601
}],
602602
};
@@ -613,7 +613,7 @@ fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) {
613613
let txid = cl.send_raw_transaction(&res.transaction().unwrap()).unwrap();
614614

615615
let tx = Transaction {
616-
version: 1,
616+
version: transaction::Version::ONE,
617617
lock_time: LockTime::ZERO,
618618
input: vec![TxIn {
619619
previous_output: OutPoint {
@@ -625,7 +625,7 @@ fn test_sign_raw_transaction_with_send_raw_transaction(cl: &Client) {
625625
witness: Witness::new(),
626626
}],
627627
output: vec![TxOut {
628-
value: (unspent.amount - *FEE - *FEE).to_sat(),
628+
value: (unspent.amount - *FEE - *FEE),
629629
script_pubkey: RANDOM_ADDRESS.script_pubkey(),
630630
}],
631631
};
@@ -1367,18 +1367,22 @@ fn test_add_multisig_address(cl: &Client) {
13671367
assert!(cl.add_multisig_address(addresses.len(), &addresses, None, Some(json::AddressType::Bech32)).is_ok());
13681368
}
13691369

1370+
#[rustfmt::skip]
13701371
fn test_derive_addresses(cl: &Client) {
13711372
let descriptor = r"pkh(02e96fe52ef0e22d2f131dd425ce1893073a3c6ad20e8cac36726393dfb4856a4c)#62k9sn4x";
1372-
assert_eq!(cl.derive_addresses(descriptor, None).unwrap(), vec!["mrkwtj5xpYQjHeJe5wsweNjVeTKkvR5fCr".parse().unwrap()]);
1373+
assert_eq!(
1374+
cl.derive_addresses(descriptor, None).unwrap(),
1375+
vec!["mrkwtj5xpYQjHeJe5wsweNjVeTKkvR5fCr".parse::<Address<NetworkUnchecked>>().unwrap()]
1376+
);
13731377
assert!(cl.derive_addresses(descriptor, Some([0, 1])).is_err()); // Range should not be specified for an unranged descriptor
13741378

13751379
let descriptor = std::concat!(
13761380
r"wpkh([1004658e/84'/1'/0']tpubDCBEcmVKbfC9KfdydyLbJ2gfNL88grZu1XcWSW9ytTM6fi",
13771381
r"tvaRmVyr8Ddf7SjZ2ZfMx9RicjYAXhuh3fmLiVLPodPEqnQQURUfrBKiiVZc8/0/*)#g8l47ngv",
13781382
);
13791383
assert_eq!(cl.derive_addresses(descriptor, Some([0, 1])).unwrap(), vec![
1380-
"bcrt1q5n5tjkpva8v5s0uadu2y5f0g7pn4h5eqaq2ux2".parse().unwrap(),
1381-
"bcrt1qcgl303ht03ja2e0hudpwk7ypcxk5t478wspzlt".parse().unwrap(),
1384+
"bcrt1q5n5tjkpva8v5s0uadu2y5f0g7pn4h5eqaq2ux2".parse::<Address<NetworkUnchecked>>().unwrap(),
1385+
"bcrt1qcgl303ht03ja2e0hudpwk7ypcxk5t478wspzlt".parse::<Address<NetworkUnchecked>>().unwrap(),
13821386
]);
13831387
assert!(cl.derive_addresses(descriptor, None).is_err()); // Range must be specified for a ranged descriptor
13841388
}

json/Cargo.toml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bitcoincore-rpc-json"
3-
version = "0.17.0"
3+
version = "0.18.0"
44
authors = [
55
"Steven Roose <[email protected]>",
66
"Jean Pierre Dudey <[email protected]>",
@@ -22,5 +22,4 @@ path = "src/lib.rs"
2222
serde = { version = "1", features = [ "derive" ] }
2323
serde_json = "1"
2424

25-
bitcoin = { version = "0.30.0", features = ["serde", "rand-std"]}
26-
bitcoin-private = "0.1.0"
25+
bitcoin = { version = "0.31.0", features = ["serde", "rand-std"]}

json/src/lib.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ use std::fmt;
4141
///
4242
/// The module is compatible with the serde attribute.
4343
pub mod serde_hex {
44-
use bitcoin::hashes::hex::FromHex;
45-
use bitcoin_private::hex::exts::DisplayHex;
44+
use bitcoin::hex::{DisplayHex, FromHex};
4645
use serde::de::Error;
4746
use serde::{Deserializer, Serializer};
4847

@@ -56,8 +55,7 @@ pub mod serde_hex {
5655
}
5756

5857
pub mod opt {
59-
use bitcoin::hashes::hex::FromHex;
60-
use bitcoin_private::hex::exts::DisplayHex;
58+
use bitcoin::hex::{DisplayHex, FromHex};
6159
use serde::de::Error;
6260
use serde::{Deserializer, Serializer};
6361

@@ -174,7 +172,7 @@ pub struct GetWalletInfoResult {
174172
#[serde(rename = "paytxfee", with = "bitcoin::amount::serde::as_btc")]
175173
pub pay_tx_fee: Amount,
176174
#[serde(rename = "hdseedid")]
177-
pub hd_seed_id: Option<bitcoin::hash_types::XpubIdentifier>,
175+
pub hd_seed_id: Option<bitcoin::bip32::XKeyIdentifier>,
178176
pub private_keys_enabled: bool,
179177
pub avoid_reuse: Option<bool>,
180178
pub scanning: Option<ScanningDetails>,
@@ -944,7 +942,7 @@ pub struct GetAddressInfoResultEmbedded {
944942
#[serde(rename = "hdkeypath")]
945943
pub hd_key_path: Option<bip32::DerivationPath>,
946944
#[serde(rename = "hdseedid")]
947-
pub hd_seed_id: Option<bitcoin::hash_types::XpubIdentifier>,
945+
pub hd_seed_id: Option<bitcoin::bip32::XKeyIdentifier>,
948946
#[serde(default)]
949947
pub labels: Vec<GetAddressInfoResultLabel>,
950948
}
@@ -998,7 +996,7 @@ pub struct GetAddressInfoResult {
998996
#[serde(rename = "hdkeypath")]
999997
pub hd_key_path: Option<bip32::DerivationPath>,
1000998
#[serde(rename = "hdseedid")]
1001-
pub hd_seed_id: Option<bitcoin::hash_types::XpubIdentifier>,
999+
pub hd_seed_id: Option<bitcoin::bip32::XKeyIdentifier>,
10021000
pub labels: Vec<GetAddressInfoResultLabel>,
10031001
/// Deprecated in v0.20.0. See `labels` field instead.
10041002
#[deprecated(note = "since Core v0.20.0")]

0 commit comments

Comments
 (0)