Skip to content

Commit b3fd549

Browse files
committed
Add support for bitcoin core 29.0
2 parents 94554b6 + 40810ad commit b3fd549

File tree

48 files changed

+415
-289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+415
-289
lines changed

.github/workflows/rust.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,6 @@ jobs:
217217
"27_1",
218218
"27_0",
219219
"26_2",
220-
"26_1",
221-
"26_0",
222220
"25_2",
223221
"24_2",
224222
"23_2",

client/src/client_sync/v29/blockchain.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,11 @@
1414
macro_rules! impl_client_v29__getdescriptoractivity {
1515
() => {
1616
impl Client {
17-
pub fn get_descriptor_activity(
18-
&self,
19-
blockhashes: &[BlockHash],
20-
scan_objects: &[&str],
21-
include_mempool: bool,
22-
) -> Result<GetDescriptorActivity> {
23-
let blockhashes_val = json!(blockhashes);
24-
let scan_objects_val = json!(scan_objects);
25-
let include_mempool_val = json!(include_mempool);
26-
27-
let params = vec![blockhashes_val, scan_objects_val, include_mempool_val];
28-
17+
pub fn get_descriptor_activity(&self) -> Result<GetDescriptorActivity> {
18+
let block_hashes: &[BlockHash] = &[];
19+
let scan_objects: &[&str] = &[];
20+
// FIXME: Core errors if we don't pass empty arrays?
21+
let params = vec![json!(block_hashes), json!(scan_objects)];
2922
self.call("getdescriptoractivity", &params)
3023
}
3124
}

client/src/client_sync/v29/mod.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//! A JSON-RPC client for testing against Bitcoin Core `v29`.
44
//!
55
//! We ignore option arguments unless they effect the shape of the returned JSON data.
6+
67
pub mod blockchain;
78

89
use std::collections::BTreeMap;
@@ -141,20 +142,6 @@ crate::impl_client_v21__unloadwallet!();
141142
crate::impl_client_v17__walletcreatefundedpsbt!();
142143
crate::impl_client_v17__walletprocesspsbt!();
143144

144-
/// Client side supported softfork deployment.
145-
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
146-
#[serde(rename_all = "lowercase")]
147-
pub enum TemplateRules {
148-
/// SegWit v0 supported.
149-
Segwit,
150-
/// Signet supported.
151-
Signet,
152-
/// CSV supported.
153-
Csv,
154-
/// Taproot supported.
155-
Taproot,
156-
}
157-
158145
/// Arg for the `getblocktemplate` method. (v29+).
159146
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
160147
pub struct TemplateRequest {
@@ -169,3 +156,17 @@ pub struct TemplateRequest {
169156
#[serde(skip_serializing_if = "Option::is_none")]
170157
pub data: Option<String>,
171158
}
159+
160+
/// Client side supported softfork deployment.
161+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
162+
#[serde(rename_all = "lowercase")]
163+
pub enum TemplateRules {
164+
/// SegWit v0 supported.
165+
Segwit,
166+
/// Signet supported.
167+
Signet,
168+
/// CSV supported.
169+
Csv,
170+
/// Taproot supported.
171+
Taproot,
172+
}

integration_test/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ edition = "2021"
1919
27_2 = ["v27", "node/27_2"]
2020
27_1 = ["v27", "node/27_1"]
2121
27_0 = ["v27", "node/27_0"]
22-
26_2 = ["v26", "node/26_2"]
23-
26_1 = ["v26", "node/26_1"]
24-
26_0 = ["v26", "node/26_0"]
2522
# Only the latest minor version for older versions.
23+
26_2 = ["v26", "node/26_2"]
2624
25_2 = ["v25", "node/25_2"]
2725
24_2 = ["v24", "node/24_2"]
2826
23_2 = ["v23", "node/23_2"]

integration_test/tests/blockchain.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ fn blockchain__get_block__modelled() {
3636
// assert!(json.into_model().is_ok());
3737
}
3838

39-
#[cfg(not(feature = "v29"))]
4039
#[test]
4140
fn blockchain__get_blockchain_info__modelled() {
4241
let node = Node::with_wallet(Wallet::None, &[]);
@@ -154,7 +153,7 @@ fn blockchain__get_chain_tx_stats__modelled() {
154153
fn blockchain__get_descriptor_activity__modelled() {
155154
let node = Node::with_wallet(Wallet::None, &["-coinstatsindex=1", "-txindex=1"]);
156155

157-
let json: GetDescriptorActivity = node.client.get_descriptor_activity(&[], &[], false).expect("getdescriptoractivity");
156+
let json: GetDescriptorActivity = node.client.get_descriptor_activity().expect("getdescriptoractivity");
158157
let model: Result<mtype::GetDescriptorActivity, GetDescriptorActivityError> = json.into_model();
159158
model.unwrap();
160159
}

integration_test/tests/mining.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ fn mining__get_block_template__modelled() {
1818
node1.mine_a_block();
1919
node2.mine_a_block();
2020
node3.mine_a_block();
21-
std::thread::sleep(std::time::Duration::from_millis(500));
2221

2322
let options = match () {
2423
#[cfg(not(feature = "v29"))]
@@ -38,8 +37,18 @@ fn mining__get_block_template__modelled() {
3837

3938
#[test]
4039
fn mining__get_mining_info() {
41-
let node = Node::with_wallet(Wallet::Default, &[]);
42-
let _: GetMiningInfo = node.client.get_mining_info().expect("rpc");
40+
#[cfg(not(feature = "v29"))]
41+
{
42+
let node = Node::with_wallet(Wallet::Default, &[]);
43+
let _: GetMiningInfo = node.client.get_mining_info().expect("rpc");
44+
}
45+
46+
#[cfg(feature = "v29")]
47+
{
48+
let node = Node::with_wallet(Wallet::Default, &[]);
49+
let json: GetMiningInfo = node.client.get_mining_info().expect("rpc");
50+
let _: Result<mtype::GetMiningInfo, GetMiningInfoError> = json.into_model();
51+
}
4352
}
4453

4554
#[test]

integration_test/tests/network.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ fn network__get_network_info__modelled() {
3737
fn network__get_node_addresses() {
3838
let node = Node::with_wallet(Wallet::None, &[]);
3939
let json: GetNodeAddresses = node.client.get_node_addresses().expect("getnodeaddresses");
40-
assert!(json.0.len() <= 2500);
41-
if let Some(addr) = json.0.first() {
40+
let res: Result<mtype::GetNodeAddresses, _> = json.into_model();
41+
let model = res.expect("GetNodeAddresses into model");
42+
assert!(model.0.len() <= 2500);
43+
if let Some(addr) = model.0.first() {
4244
assert!(addr.port > 0);
43-
assert!(!addr.address.is_empty());
4445
assert!(addr.time > 1231006505);
4546
}
4647
}

node/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ download = ["anyhow", "bitcoin_hashes", "flate2", "tar", "minreq", "zip"]
5151
27_2 = ["27_1"]
5252
27_1 = ["27_0"]
5353
27_0 = ["26_2"]
54-
26_2 = ["26_1"]
55-
26_1 = ["26_0"]
56-
26_0 = ["25_2"]
5754

5855
# We only support the latest minor version for older versions.
56+
26_2 = ["25_2"]
5957
25_2 = ["24_2"]
6058
24_2 = ["23_2"]
6159
23_2 = ["22_1"]

node/contrib/extra_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
set -euox pipefail
1616

17-
FEATURES=("29_0" "28_1" "28_0" "27_1" "27_0" "26_2" "26_1" "26_0" "25_2" "24_2" \
17+
FEATURES=("29_0" "28_1" "28_0" "27_1" "27_0" "26_2" "25_2" "24_2" \
1818
"23_2" "22_1" "0_21_2" "0_20_2" "0_19_1" "0_18_1" "0_17_2")
1919

2020
# Use the current `Cargo.lock` file without updating it.

node/src/client_versions.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,7 @@ pub use corepc_client::{client_sync::v27::*, types::v27 as vtype};
2727
#[cfg(all(feature = "26_2", not(feature = "27_0")))]
2828
pub use corepc_client::{client_sync::v26::*, types::v26 as vtype};
2929

30-
#[cfg(all(feature = "26_1", not(feature = "26_2")))]
31-
pub use corepc_client::{client_sync::v26::*, types::v26 as vtype};
32-
33-
#[cfg(all(feature = "26_0", not(feature = "26_1")))]
34-
pub use corepc_client::{client_sync::v26::*, types::v26 as vtype};
35-
36-
#[cfg(all(feature = "25_2", not(feature = "26_0")))]
30+
#[cfg(all(feature = "25_2", not(feature = "26_2")))]
3731
pub use corepc_client::{client_sync::v25::*, types::v25 as vtype};
3832

3933
#[cfg(all(feature = "24_2", not(feature = "25_2")))]
@@ -70,8 +64,6 @@ pub use corepc_client::{client_sync::v17::*, types::v17 as vtype};
7064
not(feature = "27_1"),
7165
not(feature = "27_0"),
7266
not(feature = "26_2"),
73-
not(feature = "26_1"),
74-
not(feature = "26_0"),
7567
not(feature = "25_2"),
7668
not(feature = "24_2"),
7769
not(feature = "23_2"),

0 commit comments

Comments
 (0)