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

Support latest Bitcoin Core versions #21

Merged
merged 2 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ jobs:
matrix:
feature:
[
"27_1",
"27_0",
"26_2",
"26_1",
"26_0",
"25_2",
"25_1",
Expand Down
1 change: 1 addition & 0 deletions client/src/client_sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub mod v23;
pub mod v24;
pub mod v25;
pub mod v26;
pub mod v27;

use std::fs::File;
use std::io::{BufRead, BufReader};
Expand Down
2 changes: 1 addition & 1 deletion client/src/client_sync/v26.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ crate::impl_client_v17__generatetoaddress!();

// == Network ==
crate::impl_client_v17__getnetworkinfo!();
crate::impl_client_check_expected_server_version!({ [260000] });
crate::impl_client_check_expected_server_version!({ [260000, 260100, 260200] });

// == Rawtransactions ==
crate::impl_client_v17__sendrawtransaction!();
Expand Down
44 changes: 44 additions & 0 deletions client/src/client_sync/v27.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// SPDX-License-Identifier: CC0-1.0

//! A JSON-RPC client for testing against Bitcoin Core `v27`.
//!
//! We ignore option arguments unless they effect the shape of the returned JSON data.

use bitcoin::address::{Address, NetworkChecked};
use bitcoin::{Amount, Block, BlockHash, Txid};

use crate::client_sync::{handle_defaults, into_json};
use crate::json::v27::*;

crate::define_jsonrpc_minreq_client!("v27");

// == Blockchain ==
crate::impl_client_v17__getblockchaininfo!();
crate::impl_client_v17__getbestblockhash!();
crate::impl_client_v17__getblock!();
crate::impl_client_v17__gettxout!();

// == Control ==
crate::impl_client_v17__stop!();

// == Generating ==
crate::impl_client_v17__generatetoaddress!();

// == Network ==
crate::impl_client_v17__getnetworkinfo!();
crate::impl_client_check_expected_server_version!({ [270000, 270100] });

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

// == Wallet ==
crate::impl_client_v17__createwallet!();
crate::impl_client_v22__unloadwallet!();
crate::impl_client_v22__loadwallet!();
crate::impl_client_v17__getbalance!();
crate::impl_client_v19__getbalances!();
crate::impl_client_v17__getnewaddress!();
crate::impl_client_v17__sendtoaddress!();
crate::impl_client_v17__gettransaction!();

pub use crate::client_sync::v23::AddressType;
15 changes: 11 additions & 4 deletions contrib/run_bitcoind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ COMMAND
- stop Kill all bitcoind nodes using 'pkill bitcoind'.

KNOWN_VERSION
- v26 Bitcoin Core v26.0
- v27 Bitcoin Core v27.1
- v26 Bitcoin Core v26.2
- v25 Bitcoin Core v25.2
- v24 Bitcoin Core v24.2
- v23 Bitcoin Core v23.2
Expand All @@ -48,7 +49,8 @@ main() {

case $cmd in
all)
start "v26" # 26.0
start "v27" # 27.1
start "v26" # 26.2
start "v25" # 25.2
start "v24" # 24.2
start "v23" # 23.2
Expand Down Expand Up @@ -82,9 +84,14 @@ start() {
local version="$1"

case $version in
v27)
local version_number="27.1"
local version_id="271"
;;

v26)
local version_number="26.0"
local version_id="260"
local version_number="26.2"
local version_id="262"
;;

v25)
Expand Down
7 changes: 6 additions & 1 deletion integration_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ edition = "2021"

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

# Each minor version is tested with the same client.
"v27" = []
"v26" = []
"v25" = []
"v24" = []
Expand Down
2 changes: 1 addition & 1 deletion integration_test/tests/v26_api.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Test the JSON-RPC API against `bitcoind v26.0`.
//! Test the JSON-RPC API against `bitcoind v26`.

#![cfg(feature = "v26")]

Expand Down
57 changes: 57 additions & 0 deletions integration_test/tests/v27_api.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//! Test the JSON-RPC API against `bitcoind v27.1`.

#![cfg(feature = "v27")]

use integration_test::*;

// == Blockchain ==
mod blockchain {
use super::*;

impl_test_v17__getblockchaininfo!();
impl_test_v17__getbestblockhash!();
impl_test_v17__getblock_verbosity_0!();
impl_test_v17__getblock_verbosity_1!();
}

// == Control ==
mod control {
use super::*;

impl_test_v17__stop!();
}

// == Generating ==
mod generating {
use super::*;

impl_test_v17__generatetoaddress!();
}

// == Network ==
mod network {
use super::*;

impl_test_v17__getnetworkinfo!();
}

// == Rawtransactions ==
mod raw_transactions {
use super::*;

impl_test_v17__sendrawtransaction!();
}

// == Wallet ==
mod wallet {
use super::*;

impl_test_v17__createwallet!();
impl_test_v17__loadwallet!();

impl_test_v17__getnewaddress!();
impl_test_v17__getbalance!();
impl_test_v19__getbalances!();
impl_test_v17__sendtoaddress!();
impl_test_v17__gettransaction!();
}
1 change: 1 addition & 0 deletions json/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub mod v23;
pub mod v24;
pub mod v25;
pub mod v26;
pub mod v27;

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