Skip to content

Commit 096c25d

Browse files
committed
Merge #598: Add initial support for Bitcoin Core v31
2ee03d2 Add support for Bitcoin Core 31.0 (Tobin C. Harding) a287e5f integration_test: Remove incorrect feature gate (Tobin C. Harding) 5eb5963 bitcoind: Remove support for v30.0 (Tobin C. Harding) 56a0949 bitcoind: Remove support for old point releases (Tobin C. Harding) 405423a bitcoind: Fix client versions re-exports (Tobin C. Harding) 9ac43a8 bitcoind: Move and document features (Tobin C. Harding) 514a613 bitcoind: Simplify no-default-features feature gate (Tobin C. Harding) Pull request description: First do a bunch of cleanups. Then add initial support. We include types for the three new methods but they are untested. All failing tests, typically caused by changed fields, are feature gated out and marked as `TODO`. These can be tackled at a later date because downstream is waiting for this and don't need full support immediately. ref: #599 ACKs for top commit: jamillambert: ACK 2ee03d2 satsfy: ACK 2ee03d2 Tree-SHA512: f4e961618ba4b55fc791819406c300bc646423d55db4fbb60cb8e3e5da769026a679eddda6f78cfed9528a4509b0edbfa3762c01771cccf6c84eaffae3285782
2 parents ed7d0fe + 2ee03d2 commit 096c25d

32 files changed

Lines changed: 1370 additions & 144 deletions

File tree

.github/workflows/rust.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,12 @@ jobs:
130130
matrix:
131131
version:
132132
[
133+
"31_0",
133134
"30_2",
134-
# Don't integration test v30.0 and v30.1 as the binaries have been
135-
# removed due to a wallet migration bug.
135+
# No `30_0` or `30_1` because of wallet migration bug.
136136
"29_0",
137137
"28_2",
138-
"28_1",
139-
"28_0",
140138
"27_2",
141-
"27_1",
142-
"27_0",
143139
"26_2",
144140
"25_2",
145141
"24_2",

bitcoind/Cargo.toml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,28 @@ zip = { version = "0.6.6", default-features = false, features = ["bzip2", "defla
3434
# Please note, it is expected that a single version feature will be enabled however if you enable
3535
# multiple the highest version number will take precedence.
3636
#
37+
# - `cargo test --features=latest,download` to download the latest version of Core that we support.
3738
# - `cargo test --features=27_2,download` to download Bitcoin Core binary `v27.2`.
3839
# - `cargo test --features=28_0` to use `bitcoind` from the host environment.
3940
# - `cargo test` is equivalent to `cargo test --features=0_17_2`.
40-
# - `cargo test --all-features`: Same as using latest version.
41-
# - `cargo test --no-default-features` does not work, you MUST enable a version feature.
41+
# - `cargo test --all-features`: Will download latest version of Core we support.
42+
# - `cargo test --no-default-features` does not build, you MUST enable a version feature.
4243
[features]
4344
default = ["0_17_2"]
45+
# TODO: Set this to 31_0 after all the TODOs are cleared from `types/src/v31/mod.rs`.
46+
latest = ["30_2"]
4447

4548
download = ["anyhow", "bitcoin_hashes", "flate2", "tar", "bitreq", "zip"]
4649

47-
latest = ["30_2"]
48-
49-
# We support all minor releases of the latest four versions.
50-
30_2 = ["30_0"]
51-
# Skip v30.1 due to wallet migration bug.
52-
30_0 = ["29_0"]
50+
# We support all minor releases of the latest three versions.
51+
31_0 = ["30_2"]
52+
30_2 = ["29_0"]
53+
# No `30_0` or `30_1` because of wallet migration bug.
5354
29_0 = ["28_2"]
54-
28_2 = ["28_1"]
55-
28_1 = ["28_0"]
56-
28_0 = ["27_2"]
57-
27_2 = ["27_1"]
58-
27_1 = ["27_0"]
59-
27_0 = ["26_2"]
6055

6156
# We only support the latest minor version for older versions.
57+
28_2 = ["27_2"]
58+
27_2 = ["26_2"]
6259
26_2 = ["25_2"]
6360
25_2 = ["24_2"]
6461
24_2 = ["23_2"]

bitcoind/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ mod download {
9595
#[cfg(not(target_os = "windows"))]
9696
let cache_complete = existing_filename.exists()
9797
&& version_dir.join("bin").join("bitcoin-cli").exists()
98-
&& (!cfg!(feature = "30_0")
98+
&& (!cfg!(feature = "30_2")
9999
|| version_dir.join("libexec").join("bitcoin-node").exists());
100100
#[cfg(target_os = "windows")]
101101
let cache_complete = existing_filename.exists();
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
91917647aaf50965fc834e048256fce17e8f5590658c7e8de2879fb66cdc9a73 bitcoin-31.0-aarch64-linux-gnu-debug.tar.gz
2+
4de1d568dedd48604f75132421bc0abeca432639589b49a3909c81db3a813112 bitcoin-31.0-aarch64-linux-gnu.tar.gz
3+
fc17562b66707d0c8d1863af0cd40d7c6818a8d7d7b360b8d43276b1593924d9 bitcoin-31.0-arm-linux-gnueabihf-debug.tar.gz
4+
8c19d007bfc73502625095ea4073af3a98ceb722d500556ab173bac5bcadd0d6 bitcoin-31.0-arm-linux-gnueabihf.tar.gz
5+
a2d7a13b4da53d4a3e4c517f3a0269e2429813417bb320d3b268993cfdc545d0 bitcoin-31.0-arm64-apple-darwin.tar.gz
6+
fc119a34915daac57e5fbdf181c9295d862d6843d52a9380e39dc0d0ac69cf20 bitcoin-31.0-arm64-apple-darwin.zip
7+
955563c720b4d5fc22a11d4b102940d605f1cb9eb0b564f50deb606412c631e5 bitcoin-31.0-arm64-apple-darwin-codesigning.tar.gz
8+
48d34a140aeaacd63a4bd37c24ed1876df4b077c98a7e0dd9a4483d1032839f4 bitcoin-31.0-arm64-apple-darwin-unsigned.tar.gz
9+
b639946d343114cca5d87b218aaece04d0d111374b725d90dffc7e2d1d3b99f5 bitcoin-31.0-arm64-apple-darwin-unsigned.zip
10+
7e45bab1787af974307fc077e6688d3eaab6788f3ad0e3a65d8cc9e428c41219 bitcoin-31.0-codesignatures-31.0.tar.gz
11+
0ba0ef5eea3aefd96cc1774be274c3d594812cfac0988809d706738bb067b3e3 bitcoin-31.0.tar.gz
12+
efe3e7d0383d54e5d79ac47911be0100b99872fa5205510a2a22d1194a0212d8 bitcoin-31.0-powerpc64-linux-gnu-debug.tar.gz
13+
1d9c865aa0ccf675fc068e79d9fa57a5a70b59132fca38bb322a7d44ce2f0ff2 bitcoin-31.0-powerpc64-linux-gnu.tar.gz
14+
acd0e38f4bb99c7c3024e494ca218d3ae67ec4a8b3b7ae556a8292353fe308b5 bitcoin-31.0-riscv64-linux-gnu-debug.tar.gz
15+
7ece4ea365bba9b2008b27f0717ef6a518598a572edaa2815e775faadc53c136 bitcoin-31.0-riscv64-linux-gnu.tar.gz
16+
56824dd705bc2a3b22d42e8aa02ed53498d491ff7c2c8aa96831333871887ead bitcoin-31.0-x86_64-apple-darwin.tar.gz
17+
8e230f36a2020072763adf742b20d95348cb20aaa0b0a918ca44ecdc83ac4efd bitcoin-31.0-x86_64-apple-darwin.zip
18+
fccf54f31bd58a3f834add05fa5df36520313d936445c556be8f71ccf314b658 bitcoin-31.0-x86_64-apple-darwin-codesigning.tar.gz
19+
d1d0174f07cf87d9af4318f7072350510fa0f1bf8d3d3b1ee7143ad5967b6bdf bitcoin-31.0-x86_64-apple-darwin-unsigned.tar.gz
20+
b8d9b9915a1871ee12a3a9883fd47860028454fcd192864735f2e0d3a88b4735 bitcoin-31.0-x86_64-apple-darwin-unsigned.zip
21+
96e3506195c5cc2ea9ca72fb2ddcbcf5246dd0db0d21d726f3c98eaf0c6b9078 bitcoin-31.0-x86_64-linux-gnu-debug.tar.gz
22+
d3e4c58a35b1d0a97a457462c94f55501ad167c660c245cb1ffa565641c65074 bitcoin-31.0-x86_64-linux-gnu.tar.gz
23+
1893e819d7554ca43e6e812dc642bd1fb4570a4077b07a03180ad1041e74e223 bitcoin-31.0-win64-setup.exe
24+
82fd2c504a0f20a31d4d13bd407783d6fc7bf17622d0ce85228a9b92694e03f0 bitcoin-31.0-win64.zip
25+
62baf547357029ac557d6fbbe91742c4ba6c1461c19ed4fab5131d4300b74d93 bitcoin-31.0-win64-codesigning.tar.gz
26+
df3f8c2f6ce8fde8d2661d3c01f5265f90f938019d52e2f94acf2a9001af70ae bitcoin-31.0-win64-debug.zip
27+
ad31d4d82a0ddcf1340a447575ca958ee664656ca2e77282737898e1b8209ec8 bitcoin-31.0-win64-setup-unsigned.exe
28+
5ecd365b53a2896850178f90302375480933e6c85ef81bb8abe8675fd44e1d9c bitcoin-31.0-win64-unsigned.zip

bitcoind/src/client_versions.rs

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,22 @@
66

77
#![allow(unused_imports)] // Not all users need the json types.
88

9-
#[cfg(feature = "30_0")]
9+
#[cfg(feature = "31_0")]
10+
pub use corepc_client::{client_sync::v31::*, types::v31 as vtype};
11+
12+
#[cfg(all(feature = "30_2", not(feature = "31_0")))]
1013
pub use corepc_client::{client_sync::v30::*, types::v30 as vtype};
1114

12-
#[cfg(all(feature = "29_0", not(feature = "30_0")))]
15+
#[cfg(all(feature = "29_0", not(feature = "30_2")))]
1316
pub use corepc_client::{client_sync::v29::*, types::v29 as vtype};
1417

1518
#[cfg(all(feature = "28_2", not(feature = "29_0")))]
1619
pub use corepc_client::{client_sync::v28::*, types::v28 as vtype};
1720

18-
#[cfg(all(feature = "28_1", not(feature = "28_2")))]
19-
pub use corepc_client::{client_sync::v28::*, types::v28 as vtype};
20-
21-
#[cfg(all(feature = "28_0", not(feature = "28_1")))]
22-
pub use corepc_client::{client_sync::v28::*, types::v28 as vtype};
23-
24-
#[cfg(all(feature = "27_2", not(feature = "28_0")))]
25-
pub use corepc_client::{client_sync::v27::*, types::v27 as vtype};
26-
27-
#[cfg(all(feature = "27_1", not(feature = "27_2")))]
28-
pub use corepc_client::{client_sync::v27::*, types::v27 as vtype};
29-
30-
#[cfg(all(feature = "27_0", not(feature = "27_1")))]
21+
#[cfg(all(feature = "27_2", not(feature = "28_2")))]
3122
pub use corepc_client::{client_sync::v27::*, types::v27 as vtype};
3223

33-
#[cfg(all(feature = "26_2", not(feature = "27_0")))]
24+
#[cfg(all(feature = "26_2", not(feature = "27_2")))]
3425
pub use corepc_client::{client_sync::v26::*, types::v26 as vtype};
3526

3627
#[cfg(all(feature = "25_2", not(feature = "26_2")))]
@@ -62,24 +53,5 @@ pub use corepc_client::{client_sync::v17::*, types::v17 as vtype};
6253

6354
/// This is meaningless but we need it otherwise we can't get far enough into
6455
/// the build process to trigger the `compile_error!` in `./versions.rs`.
65-
#[cfg(all(
66-
not(feature = "30_0"),
67-
not(feature = "29_0"),
68-
not(feature = "28_2"),
69-
not(feature = "28_1"),
70-
not(feature = "28_0"),
71-
not(feature = "27_2"),
72-
not(feature = "27_1"),
73-
not(feature = "27_0"),
74-
not(feature = "26_2"),
75-
not(feature = "25_2"),
76-
not(feature = "24_2"),
77-
not(feature = "23_2"),
78-
not(feature = "22_1"),
79-
not(feature = "0_21_2"),
80-
not(feature = "0_20_2"),
81-
not(feature = "0_19_1"),
82-
not(feature = "0_18_1"),
83-
not(feature = "0_17_2"),
84-
))]
56+
#[cfg(not(feature = "0_17_2"))] // Remember: later version features enable earlier ones.
8557
pub use corepc_client::{client_sync::v28::*, types::v28 as vtype};

bitcoind/src/versions.rs

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,25 @@
11
// An explicit version of Bitcoin Core must be selected by enabling some feature.
22
// We check this here instead of in `lib.rs` because this file is included in `build.rs`.
3-
#[cfg(all(
4-
not(feature = "30_2"),
5-
not(feature = "30_0"),
6-
not(feature = "29_0"),
7-
not(feature = "28_2"),
8-
not(feature = "28_1"),
9-
not(feature = "28_0"),
10-
not(feature = "27_2"),
11-
not(feature = "27_1"),
12-
not(feature = "27_0"),
13-
not(feature = "26_2"),
14-
not(feature = "25_2"),
15-
not(feature = "24_2"),
16-
not(feature = "23_2"),
17-
not(feature = "22_1"),
18-
not(feature = "0_21_2"),
19-
not(feature = "0_20_2"),
20-
not(feature = "0_19_1"),
21-
not(feature = "0_18_1"),
22-
not(feature = "0_17_2")
23-
))]
3+
#[cfg(not(feature = "0_17_2"))] // Remember: later version features enable earlier ones.
244
compile_error!("enable a feature in order to select the version of Bitcoin Core to use");
255

26-
#[cfg(feature = "30_2")]
6+
#[cfg(feature = "31_0")]
277
#[allow(dead_code)] // Triggers in --all-features builds.
28-
pub const VERSION: &str = "30.2";
8+
pub const VERSION: &str = "31.0";
299

30-
#[cfg(all(feature = "30_0", not(feature = "30_2")))]
31-
pub const VERSION: &str = "30.0";
10+
#[cfg(all(feature = "30_2", not(feature = "31_0")))]
11+
pub const VERSION: &str = "30.2";
3212

33-
#[cfg(all(feature = "29_0", not(feature = "30_0")))]
13+
#[cfg(all(feature = "29_0", not(feature = "30_2")))]
3414
pub const VERSION: &str = "29.0";
3515

3616
#[cfg(all(feature = "28_2", not(feature = "29_0")))]
3717
pub const VERSION: &str = "28.2";
3818

39-
#[cfg(all(feature = "28_1", not(feature = "28_2")))]
40-
pub const VERSION: &str = "28.1";
41-
42-
#[cfg(all(feature = "28_0", not(feature = "28_1")))]
43-
pub const VERSION: &str = "28.0";
44-
45-
#[cfg(all(feature = "27_2", not(feature = "28_0")))]
19+
#[cfg(all(feature = "27_2", not(feature = "28_2")))]
4620
pub const VERSION: &str = "27.2";
4721

48-
#[cfg(all(feature = "27_1", not(feature = "27_2")))]
49-
pub const VERSION: &str = "27.1";
50-
51-
#[cfg(all(feature = "27_0", not(feature = "27_1")))]
52-
pub const VERSION: &str = "27.0";
53-
54-
#[cfg(all(feature = "26_2", not(feature = "27_0")))]
22+
#[cfg(all(feature = "26_2", not(feature = "27_2")))]
5523
pub const VERSION: &str = "26.2";
5624

5725
#[cfg(all(feature = "25_2", not(feature = "26_2")))]
@@ -83,24 +51,5 @@ pub const VERSION: &str = "0.17.2";
8351

8452
/// This is meaningless but we need it otherwise we can't get far enough into
8553
/// the build process to trigger the `compile_error!` in `./versions.rs`.
86-
#[cfg(all(
87-
not(feature = "30_0"),
88-
not(feature = "29_0"),
89-
not(feature = "28_2"),
90-
not(feature = "28_1"),
91-
not(feature = "28_0"),
92-
not(feature = "27_2"),
93-
not(feature = "27_1"),
94-
not(feature = "27_0"),
95-
not(feature = "26_2"),
96-
not(feature = "25_2"),
97-
not(feature = "24_2"),
98-
not(feature = "23_2"),
99-
not(feature = "22_1"),
100-
not(feature = "0_21_2"),
101-
not(feature = "0_20_2"),
102-
not(feature = "0_19_1"),
103-
not(feature = "0_18_1"),
104-
not(feature = "0_17_2")
105-
))]
54+
#[cfg(not(feature = "0_17_2"))] // Remember: later version features enable earlier ones.
10655
pub const VERSION: &str = "never-used";

client/src/client_sync/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub mod v27;
1717
pub mod v28;
1818
pub mod v29;
1919
pub mod v30;
20+
pub mod v31;
2021

2122
use std::fs::File;
2223
use std::io::{BufRead, BufReader};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// SPDX-License-Identifier: CC0-1.0
2+
3+
//! Macros for implementing JSON-RPC methods on a client.
4+
//!
5+
//! Specifically this is methods found under the `== Blockchain ==` section of the
6+
//! API docs of Bitcoin Core `v31`.
7+
//!
8+
//! All macros require `Client` to be in scope.
9+
//!
10+
//! See or use the `define_jsonrpc_bitreq_client!` macro to define a `Client`.
11+
12+
/// Implements Bitcoin Core JSON-RPC API method `getmempoolcluster`.
13+
#[macro_export]
14+
macro_rules! impl_client_v31__get_mempool_cluster {
15+
() => {
16+
impl Client {
17+
pub fn get_mempool_cluster(&self, txid: Txid) -> Result<GetMempoolCluster> {
18+
self.call("getmempoolcluster", &[into_json(txid)?])
19+
}
20+
}
21+
};
22+
}

0 commit comments

Comments
 (0)