Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.

Commit c40efdb

Browse files
authored
Support latest Bitcoin Core versions (#21)
Add support for the latest Bitcoin Core versions - Patch 1: `v26.1` and `v26.2` - Patch 2: `v27.0` and `v27.1`
2 parents 79a7390 + ad04577 commit c40efdb

18 files changed

+644
-17
lines changed

.github/workflows/rust.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ jobs:
178178
matrix:
179179
feature:
180180
[
181+
"27_1",
182+
"27_0",
183+
"26_2",
184+
"26_1",
181185
"26_0",
182186
"25_2",
183187
"25_1",

client/src/client_sync/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub mod v23;
1313
pub mod v24;
1414
pub mod v25;
1515
pub mod v26;
16+
pub mod v27;
1617

1718
use std::fs::File;
1819
use std::io::{BufRead, BufReader};

client/src/client_sync/v26.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ crate::impl_client_v17__generatetoaddress!();
2626

2727
// == Network ==
2828
crate::impl_client_v17__getnetworkinfo!();
29-
crate::impl_client_check_expected_server_version!({ [260000] });
29+
crate::impl_client_check_expected_server_version!({ [260000, 260100, 260200] });
3030

3131
// == Rawtransactions ==
3232
crate::impl_client_v17__sendrawtransaction!();

client/src/client_sync/v27.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// SPDX-License-Identifier: CC0-1.0
2+
3+
//! A JSON-RPC client for testing against Bitcoin Core `v27`.
4+
//!
5+
//! We ignore option arguments unless they effect the shape of the returned JSON data.
6+
7+
use bitcoin::address::{Address, NetworkChecked};
8+
use bitcoin::{Amount, Block, BlockHash, Txid};
9+
10+
use crate::client_sync::{handle_defaults, into_json};
11+
use crate::json::v27::*;
12+
13+
crate::define_jsonrpc_minreq_client!("v27");
14+
15+
// == Blockchain ==
16+
crate::impl_client_v17__getblockchaininfo!();
17+
crate::impl_client_v17__getbestblockhash!();
18+
crate::impl_client_v17__getblock!();
19+
crate::impl_client_v17__gettxout!();
20+
21+
// == Control ==
22+
crate::impl_client_v17__stop!();
23+
24+
// == Generating ==
25+
crate::impl_client_v17__generatetoaddress!();
26+
27+
// == Network ==
28+
crate::impl_client_v17__getnetworkinfo!();
29+
crate::impl_client_check_expected_server_version!({ [270000, 270100] });
30+
31+
// == Rawtransactions ==
32+
crate::impl_client_v17__sendrawtransaction!();
33+
34+
// == Wallet ==
35+
crate::impl_client_v17__createwallet!();
36+
crate::impl_client_v22__unloadwallet!();
37+
crate::impl_client_v22__loadwallet!();
38+
crate::impl_client_v17__getbalance!();
39+
crate::impl_client_v19__getbalances!();
40+
crate::impl_client_v17__getnewaddress!();
41+
crate::impl_client_v17__sendtoaddress!();
42+
crate::impl_client_v17__gettransaction!();
43+
44+
pub use crate::client_sync::v23::AddressType;

contrib/run_bitcoind.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ COMMAND
2323
- stop Kill all bitcoind nodes using 'pkill bitcoind'.
2424
2525
KNOWN_VERSION
26-
- v26 Bitcoin Core v26.0
26+
- v27 Bitcoin Core v27.1
27+
- v26 Bitcoin Core v26.2
2728
- v25 Bitcoin Core v25.2
2829
- v24 Bitcoin Core v24.2
2930
- v23 Bitcoin Core v23.2
@@ -48,7 +49,8 @@ main() {
4849

4950
case $cmd in
5051
all)
51-
start "v26" # 26.0
52+
start "v27" # 27.1
53+
start "v26" # 26.2
5254
start "v25" # 25.2
5355
start "v24" # 24.2
5456
start "v23" # 23.2
@@ -82,9 +84,14 @@ start() {
8284
local version="$1"
8385

8486
case $version in
87+
v27)
88+
local version_number="27.1"
89+
local version_id="271"
90+
;;
91+
8592
v26)
86-
local version_number="26.0"
87-
local version_id="260"
93+
local version_number="26.2"
94+
local version_id="262"
8895
;;
8996

9097
v25)

integration_test/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ edition = "2021"
88

99
# Please note, in this crate the version features are mutally exclusive.
1010
#
11-
# - `cargo test --all-features` is the same as `cargo test --features=v26_0`
11+
# - `cargo test --all-features` is the same as `cargo test --features=v26_2`
1212
# - `cargo test --no-default-features` skips all tests.
1313
[features]
1414
# Enable the same feature in `bitcoind` and the version feature here.
1515
# All minor releases (but only the latest patch release).
16+
"27_1" = ["v27", "bitcoind/27_1"]
17+
"27_0" = ["v27", "bitcoind/27_0"]
18+
"26_2" = ["v26", "bitcoind/26_2"]
19+
"26_1" = ["v26", "bitcoind/26_1"]
1620
"26_0" = ["v26", "bitcoind/26_0"]
1721
"25_2" = ["v25", "bitcoind/25_2"]
1822
"25_1" = ["v25", "bitcoind/25_1"]
@@ -33,6 +37,7 @@ edition = "2021"
3337
"0_17_1" = ["v17", "bitcoind/0_17_1"]
3438

3539
# Each minor version is tested with the same client.
40+
"v27" = []
3641
"v26" = []
3742
"v25" = []
3843
"v24" = []

integration_test/tests/v26_api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Test the JSON-RPC API against `bitcoind v26.0`.
1+
//! Test the JSON-RPC API against `bitcoind v26`.
22
33
#![cfg(feature = "v26")]
44

integration_test/tests/v27_api.rs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
//! Test the JSON-RPC API against `bitcoind v27.1`.
2+
3+
#![cfg(feature = "v27")]
4+
5+
use integration_test::*;
6+
7+
// == Blockchain ==
8+
mod blockchain {
9+
use super::*;
10+
11+
impl_test_v17__getblockchaininfo!();
12+
impl_test_v17__getbestblockhash!();
13+
impl_test_v17__getblock_verbosity_0!();
14+
impl_test_v17__getblock_verbosity_1!();
15+
}
16+
17+
// == Control ==
18+
mod control {
19+
use super::*;
20+
21+
impl_test_v17__stop!();
22+
}
23+
24+
// == Generating ==
25+
mod generating {
26+
use super::*;
27+
28+
impl_test_v17__generatetoaddress!();
29+
}
30+
31+
// == Network ==
32+
mod network {
33+
use super::*;
34+
35+
impl_test_v17__getnetworkinfo!();
36+
}
37+
38+
// == Rawtransactions ==
39+
mod raw_transactions {
40+
use super::*;
41+
42+
impl_test_v17__sendrawtransaction!();
43+
}
44+
45+
// == Wallet ==
46+
mod wallet {
47+
use super::*;
48+
49+
impl_test_v17__createwallet!();
50+
impl_test_v17__loadwallet!();
51+
52+
impl_test_v17__getnewaddress!();
53+
impl_test_v17__getbalance!();
54+
impl_test_v19__getbalances!();
55+
impl_test_v17__sendtoaddress!();
56+
impl_test_v17__gettransaction!();
57+
}

json/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub mod v23;
1818
pub mod v24;
1919
pub mod v25;
2020
pub mod v26;
21+
pub mod v27;
2122

2223
// JSON types that model _all_ `bitcoind` versions.
2324
pub mod model;

0 commit comments

Comments
 (0)