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

Commit 383c1cf

Browse files
committed
WIP: Add support for Bitcoin Core v28
Add support and testing for Bitcoin Core versions `28.0`
1 parent d4301fc commit 383c1cf

File tree

13 files changed

+503
-10
lines changed

13 files changed

+503
-10
lines changed

.github/workflows/rust.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ jobs:
178178
matrix:
179179
feature:
180180
[
181+
"28_0",
181182
"27_1",
182183
"27_0",
183184
"26_2",

client/src/client_sync/v28.rs

+44
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::v28::*;
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

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ COMMAND
2323
- stop Kill all bitcoind nodes using 'pkill bitcoind'.
2424
2525
KNOWN_VERSION
26+
- v28 Bitcoin Core v28.0
2627
- v27 Bitcoin Core v27.1
2728
- v26 Bitcoin Core v26.2
2829
- v25 Bitcoin Core v25.2
@@ -49,6 +50,7 @@ main() {
4950

5051
case $cmd in
5152
all)
53+
start "v28" # 28.0
5254
start "v27" # 27.1
5355
start "v26" # 26.2
5456
start "v25" # 25.2
@@ -84,6 +86,11 @@ start() {
8486
local version="$1"
8587

8688
case $version in
89+
v28)
90+
local version_number="28.0"
91+
local version_id="280"
92+
;;
93+
8794
v27)
8895
local version_number="27.1"
8996
local version_id="271"

integration_test/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ edition = "2021"
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+
"28_0" = ["v28", "bitcoind/28_0"]
1617
"27_1" = ["v27", "bitcoind/27_1"]
1718
"27_0" = ["v27", "bitcoind/27_0"]
1819
"26_2" = ["v26", "bitcoind/26_2"]
@@ -37,6 +38,7 @@ edition = "2021"
3738
"0_17_1" = ["v17", "bitcoind/0_17_1"]
3839

3940
# Each minor version is tested with the same client.
41+
"v28" = []
4042
"v27" = []
4143
"v26" = []
4244
"v25" = []

integration_test/tests/v28_api.rs

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
//! Test the JSON-RPC API against `bitcoind v28.0`.
2+
3+
#![cfg(feature = "v28")]
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

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub mod v24;
1919
pub mod v25;
2020
pub mod v26;
2121
pub mod v27;
22+
pub mod v28;
2223

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

json/src/v17/network.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,9 @@ impl fmt::Display for GetNetworkInfoError {
155155

156156
match *self {
157157
RelayFee(ref e) => write_err!(f, "conversion of the `relay_fee` field failed"; e),
158-
IncrementalFee(ref e) =>
159-
write_err!(f, "conversion of the `incremental_fee` field failed"; e),
158+
IncrementalFee(ref e) => {
159+
write_err!(f, "conversion of the `incremental_fee` field failed"; e)
160+
}
160161
}
161162
}
162163
}

json/src/v28/mod.rs

+197
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
// SPDX-License-Identifier: CC0-1.0
2+
3+
//! Structs with standard types.
4+
//!
5+
//! These structs model the types returned by the JSON-RPC API and use stdlib types (or custom
6+
//! types) and are specific to a specific to Bitcoin Core `v26`.
7+
//!
8+
//! **== Blockchain ==**
9+
//! - [ ] `dumptxoutset "path"`
10+
//! - [x] `getbestblockhash`
11+
//! - [x] `getblock "blockhash" ( verbosity )`
12+
//! - [x] `getblockchaininfo`
13+
//! - [ ] `getblockcount`
14+
//! - [ ] `getblockfilter "blockhash" ( "filtertype" )`
15+
//! - [ ] `getblockfrompeer "blockhash" peer_id`
16+
//! - [ ] `getblockhash height`
17+
//! - [ ] `getblockheader "blockhash" ( verbose )`
18+
//! - [ ] `getblockstats hash_or_height ( stats )`
19+
//! - [ ] `getchainstates`
20+
//! - [ ] `getchaintips`
21+
//! - [ ] `getchaintxstats ( nblocks "blockhash" )`
22+
//! - [ ] `getdeploymentinfo ( "blockhash" )`
23+
//! - [ ] `getdifficulty`
24+
//! - [ ] `getmempoolancestors "txid" ( verbose )`
25+
//! - [ ] `getmempooldescendants "txid" ( verbose )`
26+
//! - [ ] `getmempoolentry "txid"`
27+
//! - [ ] `getmempoolinfo`
28+
//! - [ ] `getrawmempool ( verbose mempool_sequence )`
29+
//! - [ ] `gettxout "txid" n ( include_mempool )`
30+
//! - [ ] `gettxoutproof ["txid",...] ( "blockhash" )`
31+
//! - [ ] `gettxoutsetinfo ( "hash_type" hash_or_height use_index )`
32+
//! - [ ] `gettxspendingprevout [{"txid":"hex","vout":n},...]`
33+
//! - [ ] `importmempool "filepath" ( options )`
34+
//! - [ ] `loadtxoutset "path"`
35+
//! - [ ] `preciousblock "blockhash"`
36+
//! - [ ] `pruneblockchain height`
37+
//! - [ ] `savemempool`
38+
//! - [ ] `scanblocks "action" ( [scanobjects,...] start_height stop_height "filtertype" options )`
39+
//! - [ ] `scantxoutset "action" ( [scanobjects,...] )`
40+
//! - [ ] `verifychain ( checklevel nblocks )`
41+
//! - [ ] `verifytxoutproof "proof"`
42+
//!
43+
//! **== Control ==**
44+
//! - [ ] `getmemoryinfo ( "mode" )`
45+
//! - [ ] `getrpcinfo`
46+
//! - [ ] `help ( "command" )`
47+
//! - [ ] `logging ( ["include_category",...] ["exclude_category",...] )`
48+
//! - [x] `stop`
49+
//! - [ ] `uptime`
50+
//!
51+
//! **== Mining ==**
52+
//! - [ ] `getblocktemplate {"mode":"str","capabilities":["str",...],"rules":["segwit","str",...],"longpollid":"str","data":"hex"}`
53+
//! - [ ] `getmininginfo`
54+
//! - [ ] `getnetworkhashps ( nblocks height )`
55+
//! - [ ] `getprioritisedtransactions`
56+
//! - [ ] `prioritisetransaction "txid" ( dummy ) fee_delta`
57+
//! - [ ] `submitblock "hexdata" ( "dummy" )`
58+
//! - [ ] `submitheader "hexdata"`
59+
//! - [ ] `//!`
60+
//! - [ ] `//! **== Network ==**`
61+
//! - [ ] `addnode "node" "command" ( v2transport )`
62+
//! - [ ] `clearbanned`
63+
//! - [ ] `disconnectnode ( "address" nodeid )`
64+
//! - [ ] `getaddednodeinfo ( "node" )`
65+
//! - [ ] `getaddrmaninfo`
66+
//! - [ ] `getconnectioncount`
67+
//! - [ ] `getnettotals`
68+
//! - [ ] `getnetworkinfo`
69+
//! - [ ] `getnodeaddresses ( count "network" )`
70+
//! - [ ] `getpeerinfo`
71+
//! - [ ] `listbanned`
72+
//! - [ ] `ping`
73+
//! - [ ] `setban "subnet" "command" ( bantime absolute )`
74+
//! - [ ] `setnetworkactive state`
75+
//!
76+
//! **== Rawtransactions ==**
77+
//! - [ ] `analyzepsbt "psbt"`
78+
//! - [ ] `combinepsbt ["psbt",...]`
79+
//! - [ ] `combinerawtransaction ["hexstring",...]`
80+
//! - [ ] `converttopsbt "hexstring" ( permitsigdata iswitness )`
81+
//! - [ ] `createpsbt [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount,...},{"data":"hex"},...] ( locktime replaceable )`
82+
//! - [ ] `createrawtransaction [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount,...},{"data":"hex"},...] ( locktime replaceable )`
83+
//! - [ ] `decodepsbt "psbt"`
84+
//! - [ ] `decoderawtransaction "hexstring" ( iswitness )`
85+
//! - [ ] `decodescript "hexstring"`
86+
//! - [ ] `descriptorprocesspsbt "psbt" ["",{"desc":"str","range":n or [n,n]},...] ( "sighashtype" bip32derivs finalize )`
87+
//! - [ ] `finalizepsbt "psbt" ( extract )`
88+
//! - [ ] `fundrawtransaction "hexstring" ( options iswitness )`
89+
//! - [ ] `getrawtransaction "txid" ( verbosity "blockhash" )`
90+
//! - [ ] `joinpsbts ["psbt",...]`
91+
//! - [ ] `sendrawtransaction "hexstring" ( maxfeerate maxburnamount )`
92+
//! - [ ] `signrawtransactionwithkey "hexstring" ["privatekey",...] ( [{"txid":"hex","vout":n,"scriptPubKey":"hex","redeemScript":"hex","witnessScript":"hex","amount":amount},...] "sighashtype" )`
93+
//! - [ ] `submitpackage ["rawtx",...] ( maxfeerate maxburnamount )`
94+
//! - [ ] `testmempoolaccept ["rawtx",...] ( maxfeerate )`
95+
//! - [ ] `utxoupdatepsbt "psbt" ( ["",{"desc":"str","range":n or [n,n]},...] )`
96+
//!
97+
//! **== Signer ==**
98+
//! - [ ] `enumeratesigners`
99+
//!
100+
//! **== Util ==**
101+
//! - [ ] `createmultisig nrequired ["key",...] ( "address_type" )`
102+
//! - [ ] `deriveaddresses "descriptor" ( range )`
103+
//! - [ ] `estimatesmartfee conf_target ( "estimate_mode" )`
104+
//! - [ ] `getdescriptorinfo "descriptor"`
105+
//! - [ ] `getindexinfo ( "index_name" )`
106+
//! - [ ] `signmessagewithprivkey "privkey" "message"`
107+
//! - [ ] `validateaddress "address"`
108+
//! - [ ] `verifymessage "address" "signature" "message"`
109+
//!
110+
//! **== Wallet ==**
111+
//! - [ ] `abandontransaction "txid"`
112+
//! - [ ] `abortrescan`
113+
//! - [ ] `addmultisigaddress nrequired ["key",...] ( "label" "address_type" )`
114+
//! - [ ] `backupwallet "destination"`
115+
//! - [ ] `bumpfee "txid" ( options )`
116+
//! - [x] `createwallet "wallet_name" ( disable_private_keys blank "passphrase" avoid_reuse descriptors load_on_startup external_signer )`
117+
//! - [ ] `createwalletdescriptor "type" ( {"internal":bool,"hdkey":"str",...} )`
118+
//! - [ ] `dumpprivkey "address"`
119+
//! - [ ] `dumpwallet "filename"`
120+
//! - [ ] `encryptwallet "passphrase"`
121+
//! - [ ] `getaddressesbylabel "label"`
122+
//! - [ ] `getaddressinfo "address"`
123+
//! - [x] `getbalance ( "dummy" minconf include_watchonly avoid_reuse )`
124+
//! - [x] `getbalances`
125+
//! - [ ] `gethdkeys ( {"active_only":bool,"private":bool,...} )`
126+
//! - [x] `getnewaddress ( "label" "address_type" )`
127+
//! - [ ] `getrawchangeaddress ( "address_type" )`
128+
//! - [ ] `getreceivedbyaddress "address" ( minconf include_immature_coinbase )`
129+
//! - [ ] `getreceivedbylabel "label" ( minconf include_immature_coinbase )`
130+
//! - [x] `gettransaction "txid" ( include_watchonly verbose )`
131+
//! - [ ] `getunconfirmedbalance`
132+
//! - [ ] `getwalletinfo`
133+
//! - [ ] `importaddress "address" ( "label" rescan p2sh )`
134+
//! - [ ] `importdescriptors requests`
135+
//! - [ ] `importmulti requests ( options )`
136+
//! - [ ] `importprivkey "privkey" ( "label" rescan )`
137+
//! - [ ] `importprunedfunds "rawtransaction" "txoutproof"`
138+
//! - [ ] `importpubkey "pubkey" ( "label" rescan )`
139+
//! - [ ] `importwallet "filename"`
140+
//! - [ ] `keypoolrefill ( newsize )`
141+
//! - [ ] `listaddressgroupings`
142+
//! - [ ] `listdescriptors ( private )`
143+
//! - [ ] `listlabels ( "purpose" )`
144+
//! - [ ] `listlockunspent`
145+
//! - [ ] `listreceivedbyaddress ( minconf include_empty include_watchonly "address_filter" include_immature_coinbase )`
146+
//! - [ ] `listreceivedbylabel ( minconf include_empty include_watchonly include_immature_coinbase )`
147+
//! - [ ] `listsinceblock ( "blockhash" target_confirmations include_watchonly include_removed include_change "label" )`
148+
//! - [ ] `listtransactions ( "label" count skip include_watchonly )`
149+
//! - [ ] `listunspent ( minconf maxconf ["address",...] include_unsafe query_options )`
150+
//! - [ ] `listwalletdir`
151+
//! - [ ] `listwallets`
152+
//! - [x] `loadwallet "filename" ( load_on_startup )`
153+
//! - [ ] `lockunspent unlock ( [{"txid":"hex","vout":n},...] persistent )`
154+
//! - [ ] `migratewallet ( "wallet_name" "passphrase" )`
155+
//! - [ ] `newkeypool`
156+
//! - [ ] `psbtbumpfee "txid" ( options )`
157+
//! - [ ] `removeprunedfunds "txid"`
158+
//! - [ ] `rescanblockchain ( start_height stop_height )`
159+
//! - [ ] `restorewallet "wallet_name" "backup_file" ( load_on_startup )`
160+
//! - [ ] `send [{"address":amount,...},{"data":"hex"},...] ( conf_target "estimate_mode" fee_rate options )`
161+
//! - [ ] `sendall ["address",{"address":amount,...},...] ( conf_target "estimate_mode" fee_rate options )`
162+
//! - [ ] `sendmany ( "" ) {"address":amount,...} ( minconf "comment" ["address",...] replaceable conf_target "estimate_mode" fee_rate verbose )`
163+
//! - [x] `sendtoaddress "address" amount ( "comment" "comment_to" subtractfeefromamount replaceable conf_target "estimate_mode" avoid_reuse fee_rate verbose )`
164+
//! - [ ] `sethdseed ( newkeypool "seed" )`
165+
//! - [ ] `setlabel "address" "label"`
166+
//! - [ ] `settxfee amount`
167+
//! - [ ] `setwalletflag "flag" ( value )`
168+
//! - [ ] `signmessage "address" "message"`
169+
//! - [ ] `signrawtransactionwithwallet "hexstring" ( [{"txid":"hex","vout":n,"scriptPubKey":"hex","redeemScript":"hex","witnessScript":"hex","amount":amount},...] "sighashtype" )`
170+
//! - [ ] `simulaterawtransaction ( ["rawtx",...] {"include_watchonly":bool,...} )`
171+
//! - [ ] `unloadwallet ( "wallet_name" load_on_startup )`
172+
//! - [ ] `upgradewallet ( version )`
173+
//! - [ ] `walletcreatefundedpsbt ( [{"txid":"hex","vout":n,"sequence":n,"weight":n},...] ) [{"address":amount,...},{"data":"hex"},...] ( locktime options bip32derivs )`
174+
//! - [ ] `walletdisplayaddress "address"`
175+
//! - [ ] `walletlock`
176+
//! - [ ] `walletpassphrase "passphrase" timeout`
177+
//! - [ ] `walletpassphrasechange "oldpassphrase" "newpassphrase"`
178+
//! - [ ] `walletprocesspsbt "psbt" ( sign "sighashtype" bip32derivs finalize )`
179+
//!
180+
//! **== Zmq ==**
181+
//! - [ ] `getzmqnotifications`
182+
183+
#[doc(inline)]
184+
pub use crate::{
185+
v17::{
186+
GenerateToAddress, GetBalance, GetBestBlockHash, GetBlockVerbosityOne,
187+
GetBlockVerbosityZero, GetNetworkInfo, GetNetworkInfoAddress, GetNetworkInfoNetwork,
188+
GetNewAddress, GetTransaction, GetTransactionDetail, GetTransactionDetailCategory,
189+
GetTxOut, SendRawTransaction,
190+
},
191+
v19::{
192+
Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, GetBalancesMine,
193+
GetBalancesWatchOnly, GetBlockchainInfo, Softfork, SoftforkType,
194+
},
195+
v22::{SendToAddress, UnloadWallet},
196+
v25::{CreateWallet, LoadWallet},
197+
};

0 commit comments

Comments
 (0)