From 7d2510cdf0444754900bbd41ad7c2ea9c158136e Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Wed, 10 Sep 2025 09:35:08 +0100 Subject: [PATCH 1/3] Update justfile to format tests and verify Running `just fmt` only formats modules in the workspace, and not `integration_test` and `verify`. Add a line for both of these modules so that they are formatted when running `just fmt`. --- justfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/justfile b/justfile index e5c96ee6..4849b552 100644 --- a/justfile +++ b/justfile @@ -31,6 +31,8 @@ lint-integration-tests: # Run cargo fmt fmt: cargo +$(cat ./nightly-version) fmt --all + cargo +$(cat ./nightly-version) fmt --manifest-path $REPO_DIR/integration_test/Cargo.toml + cargo +$(cat ./nightly-version) fmt --manifest-path $REPO_DIR/verify/Cargo.toml # Check the formatting format: From e678deb4a6cc83d9e4d87ced312d1df2257d42cb Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Wed, 10 Sep 2025 09:31:58 +0100 Subject: [PATCH 2/3] Run the formatter in integration_test Run `just fmt` in the integration_test directory to format the code. Format only, no code changes. --- integration_test/tests/blockchain.rs | 67 +++++---- integration_test/tests/control.rs | 2 +- integration_test/tests/generating.rs | 20 ++- integration_test/tests/mining.rs | 34 +++-- integration_test/tests/network.rs | 12 +- integration_test/tests/raw_transactions.rs | 103 ++++++-------- integration_test/tests/signer.rs | 10 +- integration_test/tests/util.rs | 37 ++--- integration_test/tests/wallet.rs | 154 ++++++++++----------- integration_test/tests/zmq.rs | 7 +- 10 files changed, 230 insertions(+), 216 deletions(-) diff --git a/integration_test/tests/blockchain.rs b/integration_test/tests/blockchain.rs index 047ede35..a14f39e2 100644 --- a/integration_test/tests/blockchain.rs +++ b/integration_test/tests/blockchain.rs @@ -4,13 +4,12 @@ #![allow(non_snake_case)] // Test names intentionally use double underscore. -use bitcoin::hex; use bitcoin::consensus::encode; +use bitcoin::hex; use integration_test::{Node, NodeExt as _, Wallet}; use node::client::client_sync; -use node::vtype::*; // All the version specific types. -use node::mtype; -use node::{Input, Output}; +use node::vtype::*; // All the version specific types. +use node::{mtype, Input, Output}; #[test] #[cfg(not(feature = "v25_and_below"))] @@ -50,11 +49,13 @@ fn blockchain__get_block__modelled() { let node = Node::with_wallet(Wallet::None, &[]); let block_hash = node.client.best_block_hash().expect("best_block_hash failed"); - let json: GetBlockVerboseZero = node.client.get_block_verbose_zero(block_hash).expect("getblock verbose=0"); + let json: GetBlockVerboseZero = + node.client.get_block_verbose_zero(block_hash).expect("getblock verbose=0"); let model: Result = json.into_model(); model.unwrap(); - let json: GetBlockVerboseOne = node.client.get_block_verbose_one(block_hash).expect("getblock verbose=1"); + let json: GetBlockVerboseOne = + node.client.get_block_verbose_one(block_hash).expect("getblock verbose=1"); let model: Result = json.into_model(); model.unwrap(); @@ -143,7 +144,8 @@ fn blockchain__get_block_header__modelled() { model.unwrap(); // verbose = true - let json:GetBlockHeaderVerbose = node.client.get_block_header_verbose(&block_hash).expect("getblockheader"); + let json: GetBlockHeaderVerbose = + node.client.get_block_header_verbose(&block_hash).expect("getblockheader"); let model: Result = json.into_model(); model.unwrap(); } @@ -169,7 +171,8 @@ fn getblockstats() { // No need for explicit types, used explicitly in test below. let block_hash = node.client.best_block_hash().expect("best_block_hash failed"); - let json: GetBlockStats = node.client.get_block_stats_by_block_hash(&block_hash).expect("getblockstats"); + let json: GetBlockStats = + node.client.get_block_stats_by_block_hash(&block_hash).expect("getblockstats"); let model: Result = json.into_model(); model.unwrap(); } @@ -185,7 +188,8 @@ fn getblockstats_txindex() { // Get block stats by block hash. let block_hash = node.client.best_block_hash().expect("best_block_hash failed"); - let json: GetBlockStats = node.client.get_block_stats_by_block_hash(&block_hash).expect("getblockstats"); + let json: GetBlockStats = + node.client.get_block_stats_by_block_hash(&block_hash).expect("getblockstats"); let model: Result = json.into_model(); model.unwrap(); } @@ -228,7 +232,8 @@ fn blockchain__get_deployment_info__modelled() { let node = Node::with_wallet(Wallet::None, &[]); let block_hash = node.client.best_block_hash().expect("best_block_hash failed"); - let json: GetDeploymentInfo = node.client.get_deployment_info(&block_hash).expect("getdeploymentinfo"); + let json: GetDeploymentInfo = + node.client.get_deployment_info(&block_hash).expect("getdeploymentinfo"); let model: Result = json.into_model(); model.unwrap(); } @@ -238,7 +243,8 @@ fn blockchain__get_deployment_info__modelled() { fn blockchain__get_descriptor_activity__modelled() { let node = Node::with_wallet(Wallet::None, &["-coinstatsindex=1", "-txindex=1"]); - let json: GetDescriptorActivity = node.client.get_descriptor_activity().expect("getdescriptoractivity"); + let json: GetDescriptorActivity = + node.client.get_descriptor_activity().expect("getdescriptoractivity"); let model: Result = json.into_model(); model.unwrap(); } @@ -273,10 +279,8 @@ fn blockchain__get_mempool_ancestors_verbose__modelled() { let (_address, parent_txid) = node.create_mempool_transaction(); let child_txid = create_child_spending_parent(&node, parent_txid); - let json: GetMempoolAncestorsVerbose = node - .client - .get_mempool_ancestors_verbose(child_txid) - .expect("getmempoolancestors verbose"); + let json: GetMempoolAncestorsVerbose = + node.client.get_mempool_ancestors_verbose(child_txid).expect("getmempoolancestors verbose"); let model: Result = json.into_model(); let ancestors = model.unwrap(); @@ -309,7 +313,8 @@ fn blockchain__get_mempool_descendants_verbose__modelled() { .client .get_mempool_descendants_verbose(parent_txid) .expect("getmempooldescendants verbose"); - let model: Result = json.into_model(); + let model: Result = + json.into_model(); let descendants = model.unwrap(); assert!(descendants.0.contains_key(&child_txid)); @@ -406,17 +411,12 @@ fn blockchain__get_tx_spending_prevout__modelled() { let (_address2, txid_2) = node.create_mempool_transaction(); let inputs = vec![ - bitcoin::OutPoint { - txid: txid_1, - vout: 0, - }, - bitcoin::OutPoint { - txid: txid_2, - vout: 0, - }, + bitcoin::OutPoint { txid: txid_1, vout: 0 }, + bitcoin::OutPoint { txid: txid_2, vout: 0 }, ]; - let json: GetTxSpendingPrevout = node.client.get_tx_spending_prevout(&inputs).expect("gettxspendingprevout"); + let json: GetTxSpendingPrevout = + node.client.get_tx_spending_prevout(&inputs).expect("gettxspendingprevout"); let model: Result = json.into_model(); let spending_prevout = model.unwrap(); @@ -454,8 +454,15 @@ fn blockchain__prune_blockchain() { let node = Node::with_wallet(Wallet::Default, &["-prune=550"]); let address = node.client.new_address().expect("Failed to get new address"); - let gen_result = node.client.generate_to_address(NBLOCKS, &address).expect("generate_to_address RPC call failed"); - assert_eq!(gen_result.0.len(), NBLOCKS, "generate_to_address did not return the expected number of block hashes"); + let gen_result = node + .client + .generate_to_address(NBLOCKS, &address) + .expect("generate_to_address RPC call failed"); + assert_eq!( + gen_result.0.len(), + NBLOCKS, + "generate_to_address did not return the expected number of block hashes" + ); let target_height: u64 = 500; @@ -487,7 +494,8 @@ fn blockchain__scan_blocks_modelled() { // Arbitrary scan descriptor let scan_desc = "pkh(022afc20bf379bc96a2f4e9e63ffceb8652b2b6a097f63fbee6ecec2a49a48010e)"; - let json: ScanBlocksStart = node.client.scan_blocks_start(&[scan_desc]).expect("scanblocks start"); + let json: ScanBlocksStart = + node.client.scan_blocks_start(&[scan_desc]).expect("scanblocks start"); let model: Result = json.into_model(); model.unwrap(); @@ -552,7 +560,8 @@ fn create_child_spending_parent(node: &Node, parent_txid: bitcoin::Txid) -> bitc .client .sign_raw_transaction_with_wallet(&funded_tx) .expect("signrawtransactionwithwallet"); - let sign_raw_transaction = signed.into_model().expect("SignRawTransactionWithWallet into model"); + let sign_raw_transaction = + signed.into_model().expect("SignRawTransactionWithWallet into model"); let child_txid = sign_raw_transaction.tx.compute_txid(); let _ = node.client.send_raw_transaction(&sign_raw_transaction.tx).expect("sendrawtransaction"); diff --git a/integration_test/tests/control.rs b/integration_test/tests/control.rs index 2b693a39..4020d151 100644 --- a/integration_test/tests/control.rs +++ b/integration_test/tests/control.rs @@ -5,7 +5,7 @@ #![allow(non_snake_case)] // Test names intentionally use double underscore. use integration_test::{Node, NodeExt as _, Wallet}; -use node::vtype::*; // All the version specific types. +use node::vtype::*; // All the version specific types. #[test] fn control__get_memory_info() { diff --git a/integration_test/tests/generating.rs b/integration_test/tests/generating.rs index 9e2d06e4..9c698987 100644 --- a/integration_test/tests/generating.rs +++ b/integration_test/tests/generating.rs @@ -6,8 +6,8 @@ use bitcoin::hex; use integration_test::{Node, NodeExt as _, Wallet}; -use node::vtype::*; // All the version specific types. use node::mtype; +use node::vtype::*; // All the version specific types. #[test] #[cfg(not(feature = "v20_and_below"))] @@ -29,7 +29,10 @@ fn generating__generate_block__modelled() { #[cfg(feature = "v24_and_below")] { // No `submit` argument - json = node.client.generate_block(&mining_addr.to_string(), &transactions).expect("generateblock"); + json = node + .client + .generate_block(&mining_addr.to_string(), &transactions) + .expect("generateblock"); let model: Result = json.into_model(); model.unwrap(); } @@ -37,7 +40,10 @@ fn generating__generate_block__modelled() { #[cfg(not(feature = "v24_and_below"))] { // Check with `submit = false` so that `hex` is returned. v25 and later only. - json = node.client.generate_block(&mining_addr.to_string(), &transactions, false).expect("generateblock"); + json = node + .client + .generate_block(&mining_addr.to_string(), &transactions, false) + .expect("generateblock"); let model: Result = json.into_model(); model.unwrap(); } @@ -62,9 +68,10 @@ fn generating__generate_to_address__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); let address = node.client.new_address().expect("failed to get new address"); - let json: GenerateToAddress = node.client.generate_to_address(NBLOCKS, &address).expect("generatetoaddress"); + let json: GenerateToAddress = + node.client.generate_to_address(NBLOCKS, &address).expect("generatetoaddress"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); model.unwrap(); } @@ -77,7 +84,8 @@ fn generating__generate_to_descriptor__modelled() { let address = node.client.new_address().expect("failed to get new address"); let descriptor = format!("addr({})", address); - let json: GenerateToDescriptor = node.client.generate_to_descriptor(NBLOCKS, &descriptor).expect("generatetodescriptor"); + let json: GenerateToDescriptor = + node.client.generate_to_descriptor(NBLOCKS, &descriptor).expect("generatetodescriptor"); let model: Result = json.into_model(); model.unwrap(); } diff --git a/integration_test/tests/mining.rs b/integration_test/tests/mining.rs index 5dc7ff98..897018ab 100644 --- a/integration_test/tests/mining.rs +++ b/integration_test/tests/mining.rs @@ -6,8 +6,8 @@ use bitcoin::SignedAmount; use integration_test::{Node, NodeExt as _, Wallet}; -use node::{mtype, TemplateRequest, TemplateRules}; -use node::vtype::*; // All the version specific types. +use node::vtype::*; +use node::{mtype, TemplateRequest, TemplateRules}; // All the version specific types. #[test] fn mining__get_block_template__modelled() { @@ -27,11 +27,11 @@ fn mining__get_block_template__modelled() { rules: vec![TemplateRules::Segwit], mode: Some("template".to_string()), ..Default::default() - } + }, }; - let json: GetBlockTemplate = node1.client.get_block_template(&options) - .expect("get_block_template RPC failed"); + let json: GetBlockTemplate = + node1.client.get_block_template(&options).expect("get_block_template RPC failed"); let model: Result = json.into_model(); model.unwrap(); } @@ -82,7 +82,7 @@ fn mining__prioritise_transaction() { } #[test] -#[cfg(feature = "TODO")] // This test is flaky - no clue why. +#[cfg(feature = "TODO")] // This test is flaky - no clue why. fn mining__submit_block() { // Requires connected nodes otherwise the RPC call errors. let (node1, node2, node3) = integration_test::three_node_network(); @@ -93,7 +93,8 @@ fn mining__submit_block() { node3.mine_a_block(); let options = TemplateRequest { rules: vec![TemplateRules::Segwit] }; - let json: GetBlockTemplate = node1.client.get_block_template(&options).expect("getblocktemplate"); + let json: GetBlockTemplate = + node1.client.get_block_template(&options).expect("getblocktemplate"); let template: mtype::GetBlockTemplate = json.into_model().unwrap(); submit_empty_block(&node1, &template); @@ -106,8 +107,8 @@ fn mining__submit_block() { fn submit_empty_block(node: &Node, bt: &mtype::GetBlockTemplate) { use bitcoin::hashes::Hash as _; use bitcoin::{ - absolute, block, transaction, Amount, Block, OutPoint, ScriptBuf, Sequence, - Transaction, TxIn, TxOut, Witness, ScriptHash, TxMerkleNode, + absolute, block, transaction, Amount, Block, OutPoint, ScriptBuf, ScriptHash, Sequence, + Transaction, TxIn, TxMerkleNode, TxOut, Witness, }; let txdata = vec![Transaction { @@ -134,7 +135,10 @@ fn submit_empty_block(node: &Node, bt: &mtype::GetBlockTemplate) { version: block::Version::default(), prev_blockhash: bt.previous_block_hash, merkle_root: TxMerkleNode::all_zeros(), - time: Ord::max(bt.min_time, std::time::UNIX_EPOCH.elapsed().expect("elapsed").as_secs() as u32), + time: Ord::max( + bt.min_time, + std::time::UNIX_EPOCH.elapsed().expect("elapsed").as_secs() as u32, + ), bits: bt.bits, nonce: 0, }, @@ -158,8 +162,8 @@ fn submit_empty_block(node: &Node, bt: &mtype::GetBlockTemplate) { fn mining__submit_block_with_dummy_coinbase(node: &Node, bt: &mtype::GetBlockTemplate) { use bitcoin::hashes::Hash as _; use bitcoin::{ - absolute, block, transaction, Amount, Block, OutPoint, ScriptBuf, Sequence, - Transaction, TxIn, TxOut, Witness, TxMerkleNode, + absolute, block, transaction, Amount, Block, OutPoint, ScriptBuf, Sequence, Transaction, + TxIn, TxMerkleNode, TxOut, Witness, }; let address = node.client.new_address().expect("failed to get new address"); @@ -218,8 +222,10 @@ fn mining__submit_header() { node.fund_wallet(); node.mine_a_block(); - let best_block = node.client.get_best_block_hash().expect("getbestblockhash").into_model().unwrap().0; - let mut header = node.client.get_block_header(&best_block).expect("getblockheader").into_model().unwrap().0; + let best_block = + node.client.get_best_block_hash().expect("getbestblockhash").into_model().unwrap().0; + let mut header = + node.client.get_block_header(&best_block).expect("getblockheader").into_model().unwrap().0; for _ in 1..=u32::MAX { header.nonce = header.nonce.wrapping_add(1); diff --git a/integration_test/tests/network.rs b/integration_test/tests/network.rs index 2fdcd271..45d0649e 100644 --- a/integration_test/tests/network.rs +++ b/integration_test/tests/network.rs @@ -5,8 +5,8 @@ #![allow(non_snake_case)] // Test names intentionally use double underscore. use integration_test::{Node, NodeExt as _, Wallet}; -use node::vtype::*; // All the version specific types. -use node::{AddNodeCommand, mtype, SetBanCommand}; +use node::vtype::*; // All the version specific types. +use node::{mtype, AddNodeCommand, SetBanCommand}; #[test] fn network__add_node() { @@ -59,7 +59,7 @@ fn network__get_addr_man_info() { for (network_name, network_info) in &json.0 { assert!(!network_name.is_empty()); assert_eq!(network_info.total, network_info.new + network_info.tried); - }; + } } #[test] @@ -169,9 +169,11 @@ fn network__set_ban() { #[test] fn network__set_network_active() { let node = Node::with_wallet(Wallet::None, &[]); - let json: SetNetworkActive = node.client.set_network_active(false).expect("setnetworkactive false"); + let json: SetNetworkActive = + node.client.set_network_active(false).expect("setnetworkactive false"); assert!(!json.0); - let json: SetNetworkActive = node.client.set_network_active(true).expect("setnetworkactive true"); + let json: SetNetworkActive = + node.client.set_network_active(true).expect("setnetworkactive true"); assert!(json.0); } diff --git a/integration_test/tests/raw_transactions.rs b/integration_test/tests/raw_transactions.rs index f8e21556..66e8094d 100644 --- a/integration_test/tests/raw_transactions.rs +++ b/integration_test/tests/raw_transactions.rs @@ -9,14 +9,14 @@ use bitcoin::consensus::encode; use bitcoin::hex::FromHex as _; use bitcoin::opcodes::all::*; use bitcoin::{ - absolute, consensus, hex, psbt, script, transaction, Amount, TxOut, Transaction, ScriptBuf, + absolute, consensus, hex, psbt, script, transaction, Amount, ScriptBuf, Transaction, TxOut, }; use integration_test::{Node, NodeExt as _, Wallet}; -use node::{mtype, Input, Output}; -use node::vtype::*; // All the version specific types. +use node::vtype::*; +use node::{mtype, Input, Output}; // All the version specific types. #[test] -#[cfg(not(feature = "v17"))] // analyzepsbt was added in v0.18. +#[cfg(not(feature = "v17"))] // analyzepsbt was added in v0.18. fn raw_transactions__analyze_psbt__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); node.fund_wallet(); @@ -37,7 +37,7 @@ fn raw_transactions__combine_psbt__modelled() { let tx_out = node .client - .get_tx_out(txid, 0) // Might be previous spend or might be change. + .get_tx_out(txid, 0) // Might be previous spend or might be change. .expect("gettxout") .into_model() .expect("GetTxOut into model") @@ -86,17 +86,14 @@ fn raw_transactions__combine_raw_transaction__modelled() { node.fund_wallet(); let (_, txid) = node.create_mempool_transaction(); - let tx = node - .client - .get_raw_transaction(txid) - .expect("getrawtransaction") - .transaction() - .unwrap(); + let tx = + node.client.get_raw_transaction(txid).expect("getrawtransaction").transaction().unwrap(); // Quick and dirty test, just combine the same tx with itself. let txs = vec![tx.clone(), tx.clone()]; - let json: CombineRawTransaction = node.client.combine_raw_transaction(&txs).expect("combinerawtransaction"); + let json: CombineRawTransaction = + node.client.combine_raw_transaction(&txs).expect("combinerawtransaction"); let model: Result = json.into_model(); let combined = model.unwrap(); @@ -150,14 +147,16 @@ fn raw_transactions__decode_psbt__modelled() { // from v23 onwards in should be in its own field. { use std::collections::BTreeMap; - use bitcoin::bip32::{Fingerprint, DerivationPath, Xpub}; + + use bitcoin::bip32::{DerivationPath, Fingerprint, Xpub}; let mut map = BTreeMap::default(); // Some arbitrary xpub I grabbed from rust-bitcoin. let xpub = "xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL"; let xpub = xpub.parse::().expect("failed to parse xpub"); let fp = Fingerprint::from([1u8, 2, 3, 42]); - let path = "m/84'/0'/0'/0/1".parse::().expect("failed to parse derivation path"); + let path = + "m/84'/0'/0'/0/1".parse::().expect("failed to parse derivation path"); map.insert(xpub, (fp, path)); psbt.xpub = map; @@ -188,13 +187,10 @@ fn raw_transactions__decode_raw_transaction__modelled() { let (_, txid) = node.create_mempool_transaction(); - let tx = node - .client - .get_raw_transaction(txid) - .expect("getrawtransaction") - .transaction() - .unwrap(); - let json: DecodeRawTransaction = node.client.decode_raw_transaction(&tx).expect("decoderawtransaction"); + let tx = + node.client.get_raw_transaction(txid).expect("getrawtransaction").transaction().unwrap(); + let json: DecodeRawTransaction = + node.client.decode_raw_transaction(&tx).expect("decoderawtransaction"); let model: Result = json.into_model(); model.unwrap(); } @@ -276,7 +272,7 @@ fn raw_transactions__fund_raw_transaction__modelled() { fn raw_transactions__send_raw_transaction__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); node.fund_wallet(); - create_sign_send(&node); // Calls `sendrawtransaction`. + create_sign_send(&node); // Calls `sendrawtransaction`. } #[test] @@ -309,7 +305,6 @@ fn raw_transactions__get_raw_transaction__modelled() { .expect("getrawtransaction verbose") .into_model() .unwrap(); - } #[test] @@ -321,11 +316,9 @@ fn raw_transactions__join_psbts__modelled() { let psbt1 = create_a_psbt(&node); let psbt2 = create_a_psbt(&node); - let json: JoinPsbts = node - .client - .join_psbts(&[psbt1.clone(), psbt2.clone()]) - .expect("joinpsbts"); - let model: Result = json.into_model(); + let json: JoinPsbts = + node.client.join_psbts(&[psbt1.clone(), psbt2.clone()]).expect("joinpsbts"); + let model: Result = json.into_model(); let join_psbts = model.unwrap(); assert_eq!(join_psbts.0.inputs.len(), psbt1.inputs.len() + psbt2.inputs.len()); @@ -363,10 +356,8 @@ fn raw_transactions__submit_package__modelled() { // The call for submitting this package should succeed, but yield an 'already known' // error for all transactions. - let json: SubmitPackage = node - .client - .submit_package(&[tx_0, tx_1]) - .expect("failed to submit package"); + let json: SubmitPackage = + node.client.submit_package(&[tx_0, tx_1]).expect("failed to submit package"); let model: Result = json.into_model(); let submit_package = model.unwrap(); for tx_result in submit_package.tx_results.values() { @@ -391,10 +382,8 @@ fn raw_transactions__submit_package__modelled() { // The call for submitting this package should succeed, but yield an 'already known' // error for all transactions. - let json: SubmitPackage = node - .client - .submit_package(&[tx_0, tx_1], None, None) - .expect("failed to submit package"); + let json: SubmitPackage = + node.client.submit_package(&[tx_0, tx_1], None, None).expect("failed to submit package"); let model: Result = json.into_model(); let submit_package = model.unwrap(); for tx_result in submit_package.tx_results.values() { @@ -410,22 +399,17 @@ fn raw_transactions__test_mempool_accept__modelled() { let tx = create_a_raw_transaction(&node); // Sign (but don't broadcast). - let signed: SignRawTransaction = node - .client - .sign_raw_transaction_with_wallet(&tx) - .expect("signrawtransactionwithwallet"); - let signed_model: mtype::SignRawTransaction = signed - .into_model() - .expect("SignRawTransaction into model"); + let signed: SignRawTransaction = + node.client.sign_raw_transaction_with_wallet(&tx).expect("signrawtransactionwithwallet"); + let signed_model: mtype::SignRawTransaction = + signed.into_model().expect("SignRawTransaction into model"); let signed_tx = signed_model.tx; // Call testmempoolaccept with the valid (not yet broadcast) transaction. - let json: TestMempoolAccept = node - .client - .test_mempool_accept(&[signed_tx.clone()]) - .expect("testmempoolaccept"); + let json: TestMempoolAccept = + node.client.test_mempool_accept(&[signed_tx.clone()]).expect("testmempoolaccept"); #[cfg(feature = "v20_and_below")] - type TestMempoolAcceptError = hex::HexToArrayError; + type TestMempoolAcceptError = hex::HexToArrayError; let model: Result = json.into_model(); let test_mempool = model.unwrap(); @@ -442,10 +426,7 @@ fn raw_transactions__utxo_update_psbt__modelled() { node.fund_wallet(); let psbt = create_a_psbt(&node); - let json: UtxoUpdatePsbt = node - .client - .utxo_update_psbt(&psbt) - .expect("utxoupdatepsbt"); + let json: UtxoUpdatePsbt = node.client.utxo_update_psbt(&psbt).expect("utxoupdatepsbt"); let model: Result = json.into_model(); let update_psbts = model.unwrap(); @@ -486,7 +467,8 @@ fn create_sign_send(node: &Node) { let json: CreateRawTransaction = node.client.create_raw_transaction(&inputs, &outputs).expect("createrawtransaction"); - let model: Result = json.clone().into_model(); + let model: Result = + json.clone().into_model(); model.unwrap(); let tx = json.transaction().unwrap(); @@ -542,7 +524,8 @@ fn create_sign_with_key_send(node: &Node) { let json: CreateRawTransaction = node.client.create_raw_transaction(&inputs, &outputs).expect("createrawtransaction"); - let model: Result = json.clone().into_model(); + let model: Result = + json.clone().into_model(); model.unwrap(); let tx = json.transaction().unwrap(); @@ -584,13 +567,15 @@ fn create_fund_sign_send(node: &Node) { let json: CreateRawTransaction = node.client.create_raw_transaction(&inputs, &outputs).expect("createrawtransaction"); - let model: Result = json.clone().into_model(); + let model: Result = + json.clone().into_model(); model.unwrap(); let tx = json.transaction().unwrap(); let json: FundRawTransaction = node.client.fund_raw_transaction(&tx).expect("fundrawtransaction"); - let model: Result = json.clone().into_model(); + let model: Result = + json.clone().into_model(); model.unwrap(); let funded = json.transaction().unwrap(); @@ -602,7 +587,8 @@ fn create_fund_sign_send(node: &Node) { // This proves we did everything correctly. let model: Result = json.into_model(); let sign_raw_transaction = model.unwrap(); - let _ = node.client.send_raw_transaction(&sign_raw_transaction.tx).expect("createrawtransaction"); + let _ = + node.client.send_raw_transaction(&sign_raw_transaction.tx).expect("createrawtransaction"); } // Creates a transaction using client to do RPC call `create_raw_transaction`. @@ -634,7 +620,8 @@ fn create_a_raw_transaction(node: &Node) -> Transaction { let json: CreateRawTransaction = node.client.create_raw_transaction(&inputs, &outputs).expect("createrawtransaction"); - let model: Result = json.clone().into_model(); + let model: Result = + json.clone().into_model(); model.unwrap(); json.transaction().unwrap() } diff --git a/integration_test/tests/signer.rs b/integration_test/tests/signer.rs index 04e6eedd..baa0e25c 100644 --- a/integration_test/tests/signer.rs +++ b/integration_test/tests/signer.rs @@ -6,8 +6,8 @@ #![allow(unused_imports)] // Because of feature gated tests. use integration_test::{Node, NodeExt as _, Wallet}; -use node::{mtype, Input, Output}; -use node::vtype::*; // All the version specific types. +use node::vtype::*; +use node::{mtype, Input, Output}; // All the version specific types. #[test] #[cfg(unix)] @@ -19,12 +19,12 @@ fn signer__enumerate_signers() { // `script_body` is minimal JSON array expected by `enumeratesigners` RPC: an array // of signer objects with at least a fingerprint and name. Using a hard-coded // dummy signer (fingerprint "deadbeef"). - let script_body = "#!/bin/sh\necho '[{\"fingerprint\":\"deadbeef\",\"name\":\"TestSigner\"}]'\n"; + let script_body = + "#!/bin/sh\necho '[{\"fingerprint\":\"deadbeef\",\"name\":\"TestSigner\"}]'\n"; std::fs::write(&script_path, script_body).expect("write signer script"); // Script needs to be executable so bitcoind can invoke it via the -signer arg. - std::fs::set_permissions(&script_path, std::fs::Permissions::from_mode(0o755)) - .expect("chmod"); + std::fs::set_permissions(&script_path, std::fs::Permissions::from_mode(0o755)).expect("chmod"); let signer_arg = format!("-signer={}", script_path.to_str().unwrap()); let node = Node::with_wallet(Wallet::None, &[&signer_arg]); diff --git a/integration_test/tests/util.rs b/integration_test/tests/util.rs index 6566c717..b3501c6c 100644 --- a/integration_test/tests/util.rs +++ b/integration_test/tests/util.rs @@ -5,10 +5,10 @@ #![allow(non_snake_case)] // Test names intentionally use double underscore. #![allow(unused_imports)] // Because of feature gated tests. -use bitcoin::{address, amount, sign_message, PublicKey, PrivateKey}; +use bitcoin::{address, amount, sign_message, PrivateKey, PublicKey}; use integration_test::{Node, NodeExt as _, Wallet}; -use node::vtype::*; use node::mtype; +use node::vtype::*; #[test] fn util__create_multisig__modelled() { @@ -23,10 +23,8 @@ fn util__create_multisig__modelled() { .unwrap(); let node = Node::with_wallet(Wallet::Default, &[]); - let json: CreateMultisig = node - .client - .create_multisig(nrequired, vec![pubkey1, pubkey2]) - .expect("createmultisig"); + let json: CreateMultisig = + node.client.create_multisig(nrequired, vec![pubkey1, pubkey2]).expect("createmultisig"); let model: Result = json.into_model(); model.unwrap(); } @@ -37,7 +35,8 @@ fn util__derive_addresses__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); // Use a valid, deterministic public key from the pubkey_sort test vectors and the checksum for it. - let descriptor = "pkh(02ff12471208c14bd580709cb2358d98975247d8765f92bc25eab3b2763ed605f8)#sf4k0g3u"; + let descriptor = + "pkh(02ff12471208c14bd580709cb2358d98975247d8765f92bc25eab3b2763ed605f8)#sf4k0g3u"; let json: DeriveAddresses = node.client.derive_addresses(descriptor).expect("deriveaddresses"); let model: Result = json.into_model(); @@ -50,7 +49,9 @@ fn util__derive_addresses__modelled() { let multipath_descriptor = "wpkh([26b4ed16/84h/1h/0h]tpubDDe7JUw2CGU1rYZxupmNrhDXuE1fv25gs4je3BBuWCFwTW9QHGgyh5cjAEugd14ysJXTVshPvnUVABfD66HZKCS9gp5AYFd5K2WN2oVFp8t/<0;1>/*)#grvmsm8m"; let range = (0, 3); - let json: DeriveAddressesMultipath = node.client.derive_addresses_multipath(multipath_descriptor, range) + let json: DeriveAddressesMultipath = node + .client + .derive_addresses_multipath(multipath_descriptor, range) .expect("deriveaddresses"); let model: Result = json.into_model(); let derived = model.unwrap(); @@ -79,7 +80,8 @@ fn util__get_descriptor_info() { // Use a valid, deterministic public key from the pubkey_sort test vectors let descriptor = "pkh(02ff12471208c14bd580709cb2358d98975247d8765f92bc25eab3b2763ed605f8)"; - let _: GetDescriptorInfo = node.client.get_descriptor_info(descriptor).expect("getdescriptorinfo"); + let _: GetDescriptorInfo = + node.client.get_descriptor_info(descriptor).expect("getdescriptorinfo"); } #[test] @@ -89,7 +91,10 @@ fn util__get_index_info() { let index_info: GetIndexInfo = node.client.get_index_info().expect("getindexinfo"); let txindex_info = index_info.0.get("txindex").unwrap(); - assert!(txindex_info.best_block_height < u32::MAX, "best_block_height should be a valid block height"); + assert!( + txindex_info.best_block_height < u32::MAX, + "best_block_height should be a valid block height" + ); } #[test] @@ -107,19 +112,15 @@ fn util__sign_message_with_priv_key__modelled() { let addr = bitcoin::Address::p2pkh(pubkey, privkey.network); // Sign the message with the private key - let json: SignMessageWithPrivKey = node - .client - .sign_message_with_privkey(&privkey, message) - .expect("signmessagewithprivkey"); + let json: SignMessageWithPrivKey = + node.client.sign_message_with_privkey(&privkey, message).expect("signmessagewithprivkey"); let model: Result = json.into_model(); let sig = model.unwrap(); // Verify the message using the returned signature - let verified: VerifyMessage = node - .client - .verify_message(&addr, &sig.0, message) - .expect("verifymessage"); + let verified: VerifyMessage = + node.client.verify_message(&addr, &sig.0, message).expect("verifymessage"); assert!(verified.0, "Signature should verify for the correct address and message"); } diff --git a/integration_test/tests/wallet.rs b/integration_test/tests/wallet.rs index f52fd298..c3bb822f 100644 --- a/integration_test/tests/wallet.rs +++ b/integration_test/tests/wallet.rs @@ -5,28 +5,32 @@ #![allow(non_snake_case)] // Test names intentionally use double underscore. #![allow(unused_imports)] // Some imports are only used in specific versions. +use std::collections::BTreeMap; +use std::fs; +use std::time::{SystemTime, UNIX_EPOCH}; + use bitcoin::address::{self, Address, KnownHrp, NetworkChecked}; use bitcoin::bip32::{Xpriv, Xpub}; -use bitcoin::{amount, key, hex, psbt, sign_message, secp256k1, Amount, CompressedPublicKey, FeeRate, Network, PrivateKey, PublicKey}; -use integration_test::{Node, NodeExt as _, Wallet}; -use node::{ - mtype, AddressType, ImportMultiRequest, ImportMultiScriptPubKey, ImportMultiTimestamp, WalletCreateFundedPsbtInput +use bitcoin::{ + amount, hex, key, psbt, secp256k1, sign_message, Amount, CompressedPublicKey, FeeRate, Network, + PrivateKey, PublicKey, }; - +use integration_test::{Node, NodeExt as _, Wallet}; +use node::vtype::*; // All the version specific types. #[cfg(not(feature = "v20_and_below"))] use node::ImportDescriptorsRequest; - -use node::vtype::*; // All the version specific types. -use std::collections::BTreeMap; -use std::fs; -use std::time::{SystemTime, UNIX_EPOCH}; +use node::{ + mtype, AddressType, ImportMultiRequest, ImportMultiScriptPubKey, ImportMultiTimestamp, + WalletCreateFundedPsbtInput, +}; #[test] fn wallet__abandon_transaction() { let node = Node::with_wallet(Wallet::Default, &[]); let mining_addr = node.client.new_address().expect("newaddress"); - let json: GenerateToAddress = node.client.generate_to_address(101, &mining_addr).expect("generatetoaddress"); + let json: GenerateToAddress = + node.client.generate_to_address(101, &mining_addr).expect("generatetoaddress"); let block_hashes = json.into_model(); let block_hash = block_hashes.expect("blockhash").0[0]; @@ -82,9 +86,7 @@ fn wallet__add_multisig_address__modelled() { } #[test] -fn wallet__backup_wallet() { - backup_and_restore_wallet() -} +fn wallet__backup_wallet() { backup_and_restore_wallet() } fn backup_and_restore_wallet() { let node = Node::with_wallet(Wallet::Default, &[]); @@ -99,7 +101,8 @@ fn backup_and_restore_wallet() { { let wallet_name = "test_wallet"; let node2 = Node::with_wallet(Wallet::None, &[]); - let restored_wallet: RestoreWallet = node2.client.restore_wallet(wallet_name, &file_path).expect("restorewallet"); + let restored_wallet: RestoreWallet = + node2.client.restore_wallet(wallet_name, &file_path).expect("restorewallet"); assert_eq!(restored_wallet.name, wallet_name); } @@ -156,8 +159,8 @@ fn wallet__create_wallet_descriptor() { let import_req = ImportDescriptorsRequest::new(descriptor, 0); node.client.import_descriptors(&[import_req]).expect("importdescriptors"); - let json: CreateWalletDescriptor = node.client.create_wallet_descriptor("bech32", &hdkey) - .expect("createwalletdescriptor"); + let json: CreateWalletDescriptor = + node.client.create_wallet_descriptor("bech32", &hdkey).expect("createwalletdescriptor"); // Check that a SigWit descriptor was created. let prefix = &json.descriptors[0][0..4]; @@ -173,7 +176,10 @@ fn wallet__dump_priv_key__modelled() { let node = Node::with_wallet(Wallet::None, &[]); node.client.create_legacy_wallet("legacy_wallet").expect("legacy create_wallet"); - let address = node.client.get_new_address(Some("label"), Some(AddressType::Legacy)).expect("legacy get_new_address"); + let address = node + .client + .get_new_address(Some("label"), Some(AddressType::Legacy)) + .expect("legacy get_new_address"); let model: Result = address.into_model(); let address = model.unwrap().0.assume_checked(); @@ -229,7 +235,8 @@ fn wallet__get_addresses_by_label__modelled() { let label = "some-label"; let addr = node.client.new_address_with_label(label).expect("failed to get new address"); - let json: GetAddressesByLabel = node.client.get_addresses_by_label(label).expect("getaddressesbylabel"); + let json: GetAddressesByLabel = + node.client.get_addresses_by_label(label).expect("getaddressesbylabel"); let model: Result = json.into_model(); let map = model.unwrap(); @@ -253,7 +260,8 @@ fn wallet__get_address_info__modelled() { // Test a SegWit address with embedded information. let addr_p2sh = node.client.new_address_with_type(AddressType::P2shSegwit).unwrap(); - let json: GetAddressInfo = node.client.get_address_info(&addr_p2sh).expect("getaddressinfo p2sh-segwit"); + let json: GetAddressInfo = + node.client.get_address_info(&addr_p2sh).expect("getaddressinfo p2sh-segwit"); let model: Result = json.into_model(); let address_info = model.unwrap(); let embedded = address_info.embedded.unwrap(); @@ -263,7 +271,8 @@ fn wallet__get_address_info__modelled() { // Test a Bech32 address. let addr_bech32 = node.client.new_address_with_type(AddressType::Bech32).unwrap(); - let json: GetAddressInfo = node.client.get_address_info(&addr_bech32).expect("getaddressinfo bech32"); + let json: GetAddressInfo = + node.client.get_address_info(&addr_bech32).expect("getaddressinfo bech32"); let model: Result = json.into_model(); let address_info = model.unwrap(); assert_eq!(address_info.address.assume_checked(), addr_bech32); @@ -324,7 +333,8 @@ fn wallet__get_new_address__modelled() { #[test] fn wallet__get_raw_change_address__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); - let json: GetRawChangeAddress = node.client.get_raw_change_address().expect("getrawchangeaddress"); + let json: GetRawChangeAddress = + node.client.get_raw_change_address().expect("getrawchangeaddress"); let model: Result = json.into_model(); model.unwrap(); } @@ -341,7 +351,8 @@ fn wallet__get_received_by_address__modelled() { node.client.send_to_address(&address, amount).expect("sendtoaddress").txid().unwrap(); node.mine_a_block(); - let json: GetReceivedByAddress = node.client.get_received_by_address(&address).expect("getreceivedbyaddress"); + let json: GetReceivedByAddress = + node.client.get_received_by_address(&address).expect("getreceivedbyaddress"); let model: Result = json.into_model(); let received_by_address = model.unwrap(); @@ -361,7 +372,8 @@ fn wallet__get_received_by_label__modelled() { let _ = node.client.send_to_address(&address, amount).unwrap(); node.mine_a_block(); - let json: GetReceivedByLabel = node.client.get_received_by_label(label).expect("getreceivedbylabel"); + let json: GetReceivedByLabel = + node.client.get_received_by_label(label).expect("getreceivedbylabel"); let model: Result = json.into_model(); let received = model.unwrap(); assert_eq!(received.0, amount); @@ -388,7 +400,8 @@ fn wallet__get_transaction__modelled() { #[test] fn wallet__get_unconfirmed_balance__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); - let json: GetUnconfirmedBalance = node.client.get_unconfirmed_balance().expect("getunconfirmedbalance"); + let json: GetUnconfirmedBalance = + node.client.get_unconfirmed_balance().expect("getunconfirmedbalance"); let model: Result = json.into_model(); model.unwrap(); } @@ -412,7 +425,8 @@ fn wallet__get_wallet_info__modelled() { #[cfg(not(feature = "v25_and_below"))] { - let last_processed = wallet_info.last_processed_block.as_ref().expect("last_processed_block"); + let last_processed = + wallet_info.last_processed_block.as_ref().expect("last_processed_block"); let best_hash = node.client.best_block_hash().expect("best_block_hash"); assert_eq!(last_processed.hash, best_hash); } @@ -458,10 +472,8 @@ fn wallet__import_descriptors() { node.fund_wallet(); // 1. Get the current time - let start_time = SystemTime::now() - .duration_since(UNIX_EPOCH) - .expect("failed to get current time") - .as_secs(); + let start_time = + SystemTime::now().duration_since(UNIX_EPOCH).expect("failed to get current time").as_secs(); // 2. Use a known private key, derive the address from it and send some coins to it. let privkey = @@ -483,7 +495,8 @@ fn wallet__import_descriptors() { // 5. Scan for the descriptor using the time from (1) let request = ImportDescriptorsRequest::new(descriptor, start_time); - let result: ImportDescriptors = node.client.import_descriptors(&[request]).expect("importdescriptors"); + let result: ImportDescriptors = + node.client.import_descriptors(&[request]).expect("importdescriptors"); assert_eq!(result.0.len(), 1, "should have exactly one import result"); assert!(result.0[0].success); } @@ -499,7 +512,8 @@ fn wallet__import_pruned_funds() { let raw_tx = node.client.get_raw_transaction(txid).expect("getrawtransaction"); let tx_out_proof = node.client.get_tx_out_proof(&[txid]).expect("gettxoutproof"); - let _: () = node.client.import_pruned_funds(&raw_tx.0, &tx_out_proof).expect("importprunedfunds"); + let _: () = + node.client.import_pruned_funds(&raw_tx.0, &tx_out_proof).expect("importprunedfunds"); } #[test] @@ -573,7 +587,8 @@ fn wallet__list_received_by_label__modelled() { let _ = node.client.send_to_address(&address, amount).unwrap(); node.mine_a_block(); - let json: ListReceivedByLabel = node.client.list_received_by_label().expect("listreceivedbylabel"); + let json: ListReceivedByLabel = + node.client.list_received_by_label().expect("listreceivedbylabel"); let model: Result = json.into_model(); let received_by_label = model.unwrap(); assert!(received_by_label.0.iter().any(|item| item.label == label)); @@ -588,7 +603,8 @@ fn wallet__list_received_by_address__modelled() { let _ = node.client.send_to_address(&address, amount).expect("sendtoaddress"); node.mine_a_block(); - let json: ListReceivedByAddress = node.client.list_received_by_address().expect("listreceivedbyaddress"); + let json: ListReceivedByAddress = + node.client.list_received_by_address().expect("listreceivedbyaddress"); let model: Result = json.into_model(); let received_by_address = model.unwrap(); @@ -646,7 +662,8 @@ fn wallet__import_multi() { let dummy_script_hex = "76a914aabbccddeeff00112233445566778899aabbccdd88ac"; let addr = node.client.new_address().expect("newaddress"); - let dummy_desc = "pkh(02c6047f9441ed7d6d3045406e95c07cd85a2a0e5c1e507a7a7e3d2f0d6c3d8ef8)#tp9h0863"; + let dummy_desc = + "pkh(02c6047f9441ed7d6d3045406e95c07cd85a2a0e5c1e507a7a7e3d2f0d6c3d8ef8)#tp9h0863"; // Uses scriptPubKey (valid): success - true, without warnings nor error. // NOTE: On v17, use a wallet-generated address (not raw script) @@ -660,9 +677,7 @@ fn wallet__import_multi() { // Uses an address (valid): success - false, with JSON-RPC error. let req2 = ImportMultiRequest { descriptor: None, - script_pubkey: Some(ImportMultiScriptPubKey::Address { - address: addr.to_string(), - }), + script_pubkey: Some(ImportMultiScriptPubKey::Address { address: addr.to_string() }), timestamp: ImportMultiTimestamp::Now, }; @@ -749,7 +764,9 @@ fn wallet__list_descriptors() { let json: ListDescriptors = node.client.list_descriptors().expect("listdescriptors"); - let has_descriptor = json.descriptors.iter().any(|desc_info| desc_info.descriptor.starts_with("wpkh(") || desc_info.descriptor.starts_with("pkh(")); + let has_descriptor = json.descriptors.iter().any(|desc_info| { + desc_info.descriptor.starts_with("wpkh(") || desc_info.descriptor.starts_with("pkh(") + }); assert!(has_descriptor, "No standard descriptors found in listdescriptors result"); } @@ -816,9 +833,7 @@ fn wallet__list_wallets__modelled() { } #[test] -fn wallet__load_wallet__modelled() { - create_load_unload_wallet(); -} +fn wallet__load_wallet__modelled() { create_load_unload_wallet(); } #[test] fn wallet__lock_unspent() { @@ -887,7 +902,8 @@ fn wallet__remove_pruned_funds() { let raw_tx = node.client.get_raw_transaction(txid).expect("getrawtransaction"); let tx_out_proof = node.client.get_tx_out_proof(&[txid]).expect("gettxoutproof"); - let _: () = node.client.import_pruned_funds(&raw_tx.0, &tx_out_proof).expect("importprunedfunds"); + let _: () = + node.client.import_pruned_funds(&raw_tx.0, &tx_out_proof).expect("importprunedfunds"); let _: () = node.client.remove_pruned_funds(txid).expect("removeprunedfunds"); } @@ -916,9 +932,7 @@ fn wallet__restore_wallet() {} fn wallet__sign_raw_transaction_with_wallet__modelled() {} #[test] -fn wallet__unload_wallet() { - create_load_unload_wallet(); -} +fn wallet__unload_wallet() { create_load_unload_wallet(); } #[test] fn wallet__send_many__modelled() { @@ -938,12 +952,10 @@ fn wallet__send_many__modelled() { #[cfg(not(feature = "v20_and_below"))] { - let json_verbose: SendManyVerbose = node - .client - .send_many_verbose(amounts) - .expect("sendmany verbose"); + let json_verbose: SendManyVerbose = + node.client.send_many_verbose(amounts).expect("sendmany verbose"); let model_verbose: Result = - json_verbose.into_model(); + json_verbose.into_model(); model_verbose.unwrap(); } } @@ -1035,10 +1047,7 @@ fn wallet__sign_message__modelled() { let message = "integration test message"; // Sign the message with the address key - let json: SignMessage = node - .client - .sign_message(&address, message) - .expect("signmessage"); + let json: SignMessage = node.client.sign_message(&address, message).expect("signmessage"); let model: Result = json.into_model(); model.unwrap(); } @@ -1052,28 +1061,18 @@ fn wallet__simulate_raw_transaction() { let address = node.client.new_address().expect("failed to create new address"); let amount = Amount::from_sat(10_000); - let txid1 = node - .client - .send_to_address(&address, amount) - .expect("sendtoaddress") - .txid() - .unwrap(); + let txid1 = + node.client.send_to_address(&address, amount).expect("sendtoaddress").txid().unwrap(); let raw_tx1 = node.client.get_raw_transaction(txid1).expect("getrawtransaction"); - let txid2 = node - .client - .send_to_address(&address, amount) - .expect("sendtoaddress") - .txid() - .unwrap(); + let txid2 = + node.client.send_to_address(&address, amount).expect("sendtoaddress").txid().unwrap(); let raw_tx2 = node.client.get_raw_transaction(txid2).expect("getrawtransaction"); // Simulate raw transaction with the 2 transactions let rawtxs = vec![raw_tx1.0, raw_tx2.0]; - let json: SimulateRawTransaction = node - .client - .simulate_raw_transaction(&rawtxs) - .expect("simulaterawtransaction"); + let json: SimulateRawTransaction = + node.client.simulate_raw_transaction(&rawtxs).expect("simulaterawtransaction"); let model: Result = json.into_model(); let raw_transaction = model.unwrap(); @@ -1094,7 +1093,8 @@ fn wallet__wallet_create_funded_psbt__modelled() { .wallet_create_funded_psbt(vec![], vec![outputs]) .expect("walletcreatefundedpsbt"); - let model: Result = json.into_model(); + let model: Result = + json.into_model(); let psbt = model.unwrap(); assert!(!psbt.psbt.inputs.is_empty()); @@ -1115,10 +1115,8 @@ fn wallet__wallet_process_psbt__modelled() { funded_psbt.into_model(); let funded_psbt_model = model.unwrap(); - let json: WalletProcessPsbt = node - .client - .wallet_process_psbt(&funded_psbt_model.psbt) - .expect("walletprocesspsbt"); + let json: WalletProcessPsbt = + node.client.wallet_process_psbt(&funded_psbt_model.psbt).expect("walletprocesspsbt"); #[cfg(feature = "v25_and_below")] type WalletProcessPsbtError = psbt::PsbtParseError; @@ -1156,7 +1154,9 @@ fn wallet__wallet_passphrase_change() { node.client.create_wallet("wallet name").expect("createwallet"); node.client.encrypt_wallet("old passphrase").expect("encryptwallet"); - let _: () = node.client.wallet_passphrase_change("old passphrase", "new passphrase") + let _: () = node + .client + .wallet_passphrase_change("old passphrase", "new passphrase") .expect("walletpassphrasechange"); } diff --git a/integration_test/tests/zmq.rs b/integration_test/tests/zmq.rs index fc1e1c30..71be726d 100644 --- a/integration_test/tests/zmq.rs +++ b/integration_test/tests/zmq.rs @@ -5,8 +5,8 @@ #![allow(non_snake_case)] // Test names intentionally use double underscore. #![allow(unused_imports)] // Because of feature gated tests. -use integration_test::{Node, Wallet, NodeExt as _}; -use node::vtype::*; // All the version specific types. +use integration_test::{Node, NodeExt as _, Wallet}; +use node::vtype::*; // All the version specific types. #[test] #[cfg(not(feature = "v17"))] @@ -15,7 +15,8 @@ fn zmq__get_zmq_notifications__modelled() { // Using hashblock as it is lightweight. let node = Node::with_wallet(Wallet::Default, &["-zmqpubhashblock=tcp://127.0.0.1:29000"]); - let list: Vec = node.client.get_zmq_notifications().expect("getzmqnotifications"); + let list: Vec = + node.client.get_zmq_notifications().expect("getzmqnotifications"); let zmq_notification = &list[0]; assert_eq!(zmq_notification.type_, "pubhashblock"); assert_eq!(zmq_notification.address, "tcp://127.0.0.1:29000"); From e608af915a1bba64970247e592cc383f0ed8c906 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Wed, 10 Sep 2025 09:33:03 +0100 Subject: [PATCH 3/3] Run the formatter in verify Run `just fmt` in the verify directory to format the code. Format only, no code changes. --- verify/src/main.rs | 121 ++++++++++++++++++++++++++++----------- verify/src/method/v17.rs | 18 +++++- verify/src/method/v18.rs | 18 +++++- verify/src/method/v19.rs | 18 +++++- verify/src/method/v20.rs | 18 +++++- verify/src/method/v21.rs | 18 +++++- verify/src/method/v22.rs | 18 +++++- verify/src/method/v23.rs | 18 +++++- verify/src/method/v24.rs | 24 ++++++-- verify/src/method/v25.rs | 24 ++++++-- verify/src/method/v26.rs | 36 ++++++++++-- verify/src/method/v27.rs | 36 ++++++++++-- verify/src/method/v28.rs | 42 +++++++++++--- verify/src/method/v29.rs | 48 +++++++++++++--- verify/src/versioned.rs | 3 +- 15 files changed, 368 insertions(+), 92 deletions(-) diff --git a/verify/src/main.rs b/verify/src/main.rs index da550350..e387a277 100644 --- a/verify/src/main.rs +++ b/verify/src/main.rs @@ -21,18 +21,28 @@ use verify::{method, model, ssot, Version}; // TODO: Add a --quiet option. const VERSIONS: [Version; 13] = [ - Version::V17, Version::V18, Version::V19, Version::V20, Version::V21, Version::V22, - Version::V23, Version::V24, Version::V25, Version::V26, Version::V27, Version::V28, + Version::V17, + Version::V18, + Version::V19, + Version::V20, + Version::V21, + Version::V22, + Version::V23, + Version::V24, + Version::V25, + Version::V26, + Version::V27, + Version::V28, Version::V29, ]; fn main() -> Result<()> { - let cmd = Command::new("verify") - .args([ - arg!([version] "Verify specific version of Core (use \"all\" for all versions)").required(true), - arg!(-t --tests "Optionally check claimed status of tests").required(false), - arg!(-q --quiet ... "Run tests in quiet mode").required(false), - ]); + let cmd = Command::new("verify").args([ + arg!([version] "Verify specific version of Core (use \"all\" for all versions)") + .required(true), + arg!(-t --tests "Optionally check claimed status of tests").required(false), + arg!(-q --quiet ... "Run tests in quiet mode").required(false), + ]); let matches = cmd.clone().get_matches(); let version = matches.get_one::("version").unwrap(); @@ -61,7 +71,7 @@ fn verify_all_versions(test_output: Option<&String>, quiet: bool) -> Result<()> } } if any_failed { - return Err(anyhow::anyhow!("verification failed for one or more versions")) + return Err(anyhow::anyhow!("verification failed for one or more versions")); } Ok(()) } @@ -74,7 +84,13 @@ fn verify_version(version: Version, test_output: Option<&String>, quiet: bool) - check(&msg, quiet); match verify_correct_methods(version, method::all_methods(version), &s) { Ok(()) => close(true, quiet), - Err(e) => { if !quiet { eprintln!("{}", e); } close(false, quiet); failures += 1; } + Err(e) => { + if !quiet { + eprintln!("{}", e); + } + close(false, quiet); + failures += 1; + } } let s = "rustdoc version specific rustdocs"; @@ -82,21 +98,39 @@ fn verify_version(version: Version, test_output: Option<&String>, quiet: bool) - check(&msg, quiet); match verify_correct_methods(version, versioned::all_methods(version)?, s) { Ok(()) => close(true, quiet), - Err(e) => { if !quiet { eprintln!("{}", e); } close(false, quiet); failures += 1; } + Err(e) => { + if !quiet { + eprintln!("{}", e); + } + close(false, quiet); + failures += 1; + } } let msg = "Checking that the status claimed in the version specific rustdocs is correct"; check(msg, quiet); match verify_status(version, test_output) { Ok(()) => close(true, quiet), - Err(e) => { if !quiet { eprintln!("{}", e); } close(false, quiet); failures += 1; } + Err(e) => { + if !quiet { + eprintln!("{}", e); + } + close(false, quiet); + failures += 1; + } } let msg = "Checking that 'Returns' column matches model requirements"; check(msg, quiet); match verify_returns_method(version) { Ok(()) => close(true, quiet), - Err(e) => { if !quiet { eprintln!("{}", e); } close(false, quiet); failures += 1; } + Err(e) => { + if !quiet { + eprintln!("{}", e); + } + close(false, quiet); + failures += 1; + } } if failures > 0 { @@ -112,11 +146,13 @@ fn check(msg: &str, quiet: bool) { } fn close(correct: bool, quiet: bool) { - if quiet { return; } + if quiet { + return; + } if correct { println!("Correct \u{2713} \n"); } else { - println!("\u{001b}[31mIncorrect \u{2717}\u{001b}[0m \n"); + println!("\u{001b}[31mIncorrect \u{2717}\u{001b}[0m \n"); } } @@ -143,7 +179,9 @@ fn verify_status(version: Version, test_output: Option<&String>) -> Result<()> { } if let Some(test_output) = test_output { - if check_integration_test_crate::test_exists(version, &method.name, test_output).is_err() { + if check_integration_test_crate::test_exists(version, &method.name, test_output) + .is_err() + { eprintln!("missing integration test: {}", method.name); failures += 1; } @@ -156,23 +194,35 @@ fn verify_status(version: Version, test_output: Option<&String>) -> Result<()> { // Make sure we didn't forget to mark as tested after implementing integration test. if let Some(test_output) = test_output { - if check_integration_test_crate::test_exists(version, &method.name, test_output).is_ok() { + if check_integration_test_crate::test_exists(version, &method.name, test_output) + .is_ok() + { eprintln!("found integration test for untested method: {}", method.name); failures += 1; } } } Status::Omitted | Status::Todo => { - let out = - Method::from_name(version, &method.name).expect("guaranteed by methods_and_status()"); + let out = Method::from_name(version, &method.name) + .expect("guaranteed by methods_and_status()"); - if versioned::type_exists(version, &method.name)? && !versioned::requires_type(version, &method.name)? { - eprintln!("return type found but method is omitted or TODO: {}", output_method(out)); + if versioned::type_exists(version, &method.name)? + && !versioned::requires_type(version, &method.name)? + { + eprintln!( + "return type found but method is omitted or TODO: {}", + output_method(out) + ); failures += 1; } - if model::type_exists(version, &method.name)? && !model::requires_type(version, &method.name)? { - eprintln!("model type found but method is omitted or TODO: {}", output_method(out)); + if model::type_exists(version, &method.name)? + && !model::requires_type(version, &method.name)? + { + eprintln!( + "model type found but method is omitted or TODO: {}", + output_method(out) + ); failures += 1; } } @@ -188,7 +238,9 @@ fn verify_status(version: Version, test_output: Option<&String>) -> Result<()> { fn check_types_exist_if_required(version: Version, method_name: &str) -> Result<()> { let out = Method::from_name(version, method_name).expect("guaranteed by methods_and_status()"); - if versioned::requires_type(version, method_name)? && !versioned::type_exists(version, method_name)? { + if versioned::requires_type(version, method_name)? + && !versioned::type_exists(version, method_name)? + { eprintln!("missing return type: {}", output_method(out)); return Err(anyhow::anyhow!("missing return type")); } @@ -223,29 +275,29 @@ fn verify_returns_method(version: Version) -> Result<()> { let Some(method) = Method::from_name(version, &name) else { continue }; match entry { - ReturnsDoc::Version => { + ReturnsDoc::Version => if method.requires_model { eprintln!( "'Returns' says 'version' but method is marked as requiring a model: {}", output_method(method) ); failures += 1; - } - } - ReturnsDoc::VersionPlusModel => { + }, + ReturnsDoc::VersionPlusModel => if !method.requires_model { eprintln!( "'Returns' says 'version + model' but method is marked as not requiring a model: {}", output_method(method) ); failures += 1; - } - } + }, ReturnsDoc::Other(_) => {} } } - if failures > 0 { return Err(anyhow::anyhow!("returns/model verification failed ({} issue(s))", failures)); } + if failures > 0 { + return Err(anyhow::anyhow!("returns/model verification failed ({} issue(s))", failures)); + } Ok(()) } @@ -268,9 +320,8 @@ mod check_integration_test_crate { let mut functions = vec![]; let path = PathBuf::from(test_output); - let file = File::open(&path).with_context(|| { - format!("Failed to open test output file {}", path.display()) - })?; + let file = File::open(&path) + .with_context(|| format!("Failed to open test output file {}", path.display()))?; let reader = io::BufReader::new(file); let test_re = Regex::new(r"test ([a-z_]+) ... ok")?; @@ -304,7 +355,7 @@ mod check_integration_test_crate { }; for t in all_test_functions(test_output)? { if t.contains(&test_name) { - return Ok(true) + return Ok(true); } } Ok(false) diff --git a/verify/src/method/v17.rs b/verify/src/method/v17.rs index 17195a12..794bbef1 100644 --- a/verify/src/method/v17.rs +++ b/verify/src/method/v17.rs @@ -65,7 +65,11 @@ pub const METHODS: &[Method] = &[ Method::new_no_model("setnetworkactive", "SetNetworkActive", "set_network_active"), // raw transactions Method::new_modelled("combinepsbt", "CombinePsbt", "combine_psbt"), - Method::new_modelled("combinerawtransaction", "CombineRawTransaction", "combine_raw_transaction"), + Method::new_modelled( + "combinerawtransaction", + "CombineRawTransaction", + "combine_raw_transaction", + ), Method::new_modelled("converttopsbt", "ConvertToPsbt", "convert_to_psbt"), Method::new_modelled("createpsbt", "CreatePsbt", "create_psbt"), Method::new_modelled("createrawtransaction", "CreateRawTransaction", "create_raw_transaction"), @@ -77,12 +81,20 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("getrawtransaction", "GetRawTransaction", "get_raw_transaction"), Method::new_modelled("sendrawtransaction", "SendRawTransaction", "send_raw_transaction"), Method::new_modelled("signrawtransaction", "SignRawTransaction", "sign_raw_transaction"), - Method::new_modelled("signrawtransactionwithkey", "SignRawTransaction", "sign_raw_transaction_with_key"), + Method::new_modelled( + "signrawtransactionwithkey", + "SignRawTransaction", + "sign_raw_transaction_with_key", + ), Method::new_modelled("testmempoolaccept", "TestMempoolAccept", "test_mempool_accept"), // util Method::new_modelled("createmultisig", "CreateMultisig", "create_multisig"), Method::new_modelled("estimatesmartfee", "EstimateSmartFee", "estimate_smart_fee"), - Method::new_modelled("signmessagewithprivkey", "SignMessageWithPrivKey", "sign_message_with_priv_key"), + Method::new_modelled( + "signmessagewithprivkey", + "SignMessageWithPrivKey", + "sign_message_with_priv_key", + ), Method::new_modelled("validateaddress", "ValidateAddress", "validate_address"), Method::new_no_model("verifymessage", "VerifyMessage", "verify_message"), // wallet diff --git a/verify/src/method/v18.rs b/verify/src/method/v18.rs index 374c8773..0e58b075 100644 --- a/verify/src/method/v18.rs +++ b/verify/src/method/v18.rs @@ -69,7 +69,11 @@ pub const METHODS: &[Method] = &[ // rawtransactions Method::new_modelled("analyzepsbt", "AnalyzePsbt", "analyze_psbt"), Method::new_modelled("combinepsbt", "CombinePsbt", "combine_psbt"), - Method::new_modelled("combinerawtransaction", "CombineRawTransaction", "combine_raw_transaction"), + Method::new_modelled( + "combinerawtransaction", + "CombineRawTransaction", + "combine_raw_transaction", + ), Method::new_modelled("converttopsbt", "ConvertToPsbt", "convert_to_psbt"), Method::new_modelled("createpsbt", "CreatePsbt", "create_psbt"), Method::new_modelled("createrawtransaction", "CreateRawTransaction", "create_raw_transaction"), @@ -81,7 +85,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("getrawtransaction", "GetRawTransaction", "get_raw_transaction"), Method::new_modelled("joinpsbts", "JoinPsbts", "join_psbts"), Method::new_modelled("sendrawtransaction", "SendRawTransaction", "send_raw_transaction"), - Method::new_modelled("signrawtransactionwithkey", "SignRawTransaction", "sign_raw_transaction_with_key"), + Method::new_modelled( + "signrawtransactionwithkey", + "SignRawTransaction", + "sign_raw_transaction_with_key", + ), Method::new_modelled("testmempoolaccept", "TestMempoolAccept", "test_mempool_accept"), Method::new_modelled("utxoupdatepsbt", "UtxoUpdatePsbt", "utxo_update_psbt"), // util @@ -89,7 +97,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("deriveaddresses", "DeriveAddresses", "derive_addresses"), Method::new_modelled("estimatesmartfee", "EstimateSmartFee", "estimate_smart_fee"), Method::new_no_model("getdescriptorinfo", "GetDescriptorInfo", "get_descriptor_info"), - Method::new_modelled("signmessagewithprivkey", "SignMessageWithPrivKey", "sign_message_with_priv_key"), + Method::new_modelled( + "signmessagewithprivkey", + "SignMessageWithPrivKey", + "sign_message_with_priv_key", + ), Method::new_modelled("validateaddress", "ValidateAddress", "validate_address"), Method::new_bool("verifymessage", "verify_message"), // wallet diff --git a/verify/src/method/v19.rs b/verify/src/method/v19.rs index 6916787e..a2127ab4 100644 --- a/verify/src/method/v19.rs +++ b/verify/src/method/v19.rs @@ -69,7 +69,11 @@ pub const METHODS: &[Method] = &[ // raw transactions Method::new_modelled("analyzepsbt", "AnalyzePsbt", "analyze_psbt"), Method::new_modelled("combinepsbt", "CombinePsbt", "combine_psbt"), - Method::new_modelled("combinerawtransaction", "CombineRawTransaction", "combine_raw_transaction"), + Method::new_modelled( + "combinerawtransaction", + "CombineRawTransaction", + "combine_raw_transaction", + ), Method::new_modelled("converttopsbt", "ConvertToPsbt", "convert_to_psbt"), Method::new_modelled("createpsbt", "CreatePsbt", "create_psbt"), Method::new_modelled("createrawtransaction", "CreateRawTransaction", "create_raw_transaction"), @@ -81,7 +85,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("getrawtransaction", "GetRawTransaction", "get_raw_transaction"), Method::new_modelled("joinpsbts", "JoinPsbts", "join_psbts"), Method::new_modelled("sendrawtransaction", "SendRawTransaction", "send_raw_transaction"), - Method::new_modelled("signrawtransactionwithkey", "SignRawTransaction", "sign_raw_transaction_with_key"), + Method::new_modelled( + "signrawtransactionwithkey", + "SignRawTransaction", + "sign_raw_transaction_with_key", + ), Method::new_modelled("testmempoolaccept", "TestMempoolAccept", "test_mempool_accept"), Method::new_modelled("utxoupdatepsbt", "UtxoUpdatePsbt", "utxo_update_psbt"), // util @@ -89,7 +97,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("deriveaddresses", "DeriveAddresses", "derive_addresses"), Method::new_modelled("estimatesmartfee", "EstimateSmartFee", "estimate_smart_fee"), Method::new_no_model("getdescriptorinfo", "GetDescriptorInfo", "get_descriptor_info"), - Method::new_modelled("signmessagewithprivkey", "SignMessageWithPrivKey", "sign_message_with_priv_key"), + Method::new_modelled( + "signmessagewithprivkey", + "SignMessageWithPrivKey", + "sign_message_with_priv_key", + ), Method::new_modelled("validateaddress", "ValidateAddress", "validate_address"), Method::new_bool("verifymessage", "verify_message"), // wallet diff --git a/verify/src/method/v20.rs b/verify/src/method/v20.rs index 2957268c..b6dd89aa 100644 --- a/verify/src/method/v20.rs +++ b/verify/src/method/v20.rs @@ -70,7 +70,11 @@ pub const METHODS: &[Method] = &[ // raw transactions Method::new_modelled("analyzepsbt", "AnalyzePsbt", "analyze_psbt"), Method::new_modelled("combinepsbt", "CombinePsbt", "combine_psbt"), - Method::new_modelled("combinerawtransaction", "CombineRawTransaction", "combine_raw_transaction"), + Method::new_modelled( + "combinerawtransaction", + "CombineRawTransaction", + "combine_raw_transaction", + ), Method::new_modelled("converttopsbt", "ConvertToPsbt", "convert_to_psbt"), Method::new_modelled("createpsbt", "CreatePsbt", "create_psbt"), Method::new_modelled("createrawtransaction", "CreateRawTransaction", "create_raw_transaction"), @@ -82,7 +86,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("getrawtransaction", "GetRawTransaction", "get_raw_transaction"), Method::new_modelled("joinpsbts", "JoinPsbts", "join_psbts"), Method::new_modelled("sendrawtransaction", "SendRawTransaction", "send_raw_transaction"), - Method::new_modelled("signrawtransactionwithkey", "SignRawTransaction", "sign_raw_transaction_with_key"), + Method::new_modelled( + "signrawtransactionwithkey", + "SignRawTransaction", + "sign_raw_transaction_with_key", + ), Method::new_modelled("testmempoolaccept", "TestMempoolAccept", "test_mempool_accept"), Method::new_modelled("utxoupdatepsbt", "UtxoUpdatePsbt", "utxo_update_psbt"), // util @@ -90,7 +98,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("deriveaddresses", "DeriveAddresses", "derive_addresses"), Method::new_modelled("estimatesmartfee", "EstimateSmartFee", "estimate_smart_fee"), Method::new_no_model("getdescriptorinfo", "GetDescriptorInfo", "get_descriptor_info"), - Method::new_modelled("signmessagewithprivkey", "SignMessageWithPrivKey", "sign_message_with_priv_key"), + Method::new_modelled( + "signmessagewithprivkey", + "SignMessageWithPrivKey", + "sign_message_with_priv_key", + ), Method::new_modelled("validateaddress", "ValidateAddress", "validate_address"), Method::new_bool("verifymessage", "verify_message"), // wallet diff --git a/verify/src/method/v21.rs b/verify/src/method/v21.rs index 5b68aed1..4bf08f1a 100644 --- a/verify/src/method/v21.rs +++ b/verify/src/method/v21.rs @@ -71,7 +71,11 @@ pub const METHODS: &[Method] = &[ // raw transactions Method::new_modelled("analyzepsbt", "AnalyzePsbt", "analyze_psbt"), Method::new_modelled("combinepsbt", "CombinePsbt", "combine_psbt"), - Method::new_modelled("combinerawtransaction", "CombineRawTransaction", "combine_raw_transaction"), + Method::new_modelled( + "combinerawtransaction", + "CombineRawTransaction", + "combine_raw_transaction", + ), Method::new_modelled("converttopsbt", "ConvertToPsbt", "convert_to_psbt"), Method::new_modelled("createpsbt", "CreatePsbt", "create_psbt"), Method::new_modelled("createrawtransaction", "CreateRawTransaction", "create_raw_transaction"), @@ -83,7 +87,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("getrawtransaction", "GetRawTransaction", "get_raw_transaction"), Method::new_modelled("joinpsbts", "JoinPsbts", "join_psbts"), Method::new_modelled("sendrawtransaction", "SendRawTransaction", "send_raw_transaction"), - Method::new_modelled("signrawtransactionwithkey", "SignRawTransaction", "sign_raw_transaction_with_key"), + Method::new_modelled( + "signrawtransactionwithkey", + "SignRawTransaction", + "sign_raw_transaction_with_key", + ), Method::new_modelled("testmempoolaccept", "TestMempoolAccept", "test_mempool_accept"), Method::new_modelled("utxoupdatepsbt", "UtxoUpdatePsbt", "utxo_update_psbt"), // util @@ -92,7 +100,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("estimatesmartfee", "EstimateSmartFee", "estimate_smart_fee"), Method::new_no_model("getdescriptorinfo", "GetDescriptorInfo", "get_descriptor_info"), Method::new_no_model("getindexinfo", "GetIndexInfo", "get_index_info"), - Method::new_modelled("signmessagewithprivkey", "SignMessageWithPrivKey", "sign_message_with_priv_key"), + Method::new_modelled( + "signmessagewithprivkey", + "SignMessageWithPrivKey", + "sign_message_with_priv_key", + ), Method::new_modelled("validateaddress", "ValidateAddress", "validate_address"), Method::new_bool("verifymessage", "verify_message"), // wallet diff --git a/verify/src/method/v22.rs b/verify/src/method/v22.rs index 41a539f2..6b7ef498 100644 --- a/verify/src/method/v22.rs +++ b/verify/src/method/v22.rs @@ -71,7 +71,11 @@ pub const METHODS: &[Method] = &[ // raw transactions Method::new_modelled("analyzepsbt", "AnalyzePsbt", "analyze_psbt"), Method::new_modelled("combinepsbt", "CombinePsbt", "combine_psbt"), - Method::new_modelled("combinerawtransaction", "CombineRawTransaction", "combine_raw_transaction"), + Method::new_modelled( + "combinerawtransaction", + "CombineRawTransaction", + "combine_raw_transaction", + ), Method::new_modelled("converttopsbt", "ConvertToPsbt", "convert_to_psbt"), Method::new_modelled("createpsbt", "CreatePsbt", "create_psbt"), Method::new_modelled("createrawtransaction", "CreateRawTransaction", "create_raw_transaction"), @@ -83,7 +87,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("getrawtransaction", "GetRawTransaction", "get_raw_transaction"), Method::new_modelled("joinpsbts", "JoinPsbts", "join_psbts"), Method::new_modelled("sendrawtransaction", "SendRawTransaction", "send_raw_transaction"), - Method::new_modelled("signrawtransactionwithkey", "SignRawTransaction", "sign_raw_transaction_with_key"), + Method::new_modelled( + "signrawtransactionwithkey", + "SignRawTransaction", + "sign_raw_transaction_with_key", + ), Method::new_modelled("testmempoolaccept", "TestMempoolAccept", "test_mempool_accept"), Method::new_modelled("utxoupdatepsbt", "UtxoUpdatePsbt", "utxo_update_psbt"), // signer @@ -94,7 +102,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("estimatesmartfee", "EstimateSmartFee", "estimate_smart_fee"), Method::new_no_model("getdescriptorinfo", "GetDescriptorInfo", "get_descriptor_info"), Method::new_no_model("getindexinfo", "GetIndexInfo", "get_index_info"), - Method::new_modelled("signmessagewithprivkey", "SignMessageWithPrivKey", "sign_message_with_priv_key"), + Method::new_modelled( + "signmessagewithprivkey", + "SignMessageWithPrivKey", + "sign_message_with_priv_key", + ), Method::new_modelled("validateaddress", "ValidateAddress", "validate_address"), Method::new_bool("verifymessage", "verify_message"), // wallet diff --git a/verify/src/method/v23.rs b/verify/src/method/v23.rs index 4678629c..290d5daa 100644 --- a/verify/src/method/v23.rs +++ b/verify/src/method/v23.rs @@ -69,7 +69,11 @@ pub const METHODS: &[Method] = &[ // raw transactions Method::new_modelled("analyzepsbt", "AnalyzePsbt", "analyze_psbt"), Method::new_modelled("combinepsbt", "CombinePsbt", "combine_psbt"), - Method::new_modelled("combinerawtransaction", "CombineRawTransaction", "combine_raw_transaction"), + Method::new_modelled( + "combinerawtransaction", + "CombineRawTransaction", + "combine_raw_transaction", + ), Method::new_modelled("converttopsbt", "ConvertToPsbt", "convert_to_psbt"), Method::new_modelled("createpsbt", "CreatePsbt", "create_psbt"), Method::new_modelled("createrawtransaction", "CreateRawTransaction", "create_raw_transaction"), @@ -81,7 +85,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("getrawtransaction", "GetRawTransaction", "get_raw_transaction"), Method::new_modelled("joinpsbts", "JoinPsbts", "join_psbts"), Method::new_modelled("sendrawtransaction", "SendRawTransaction", "send_raw_transaction"), - Method::new_modelled("signrawtransactionwithkey", "SignRawTransaction", "sign_raw_transaction_with_key"), + Method::new_modelled( + "signrawtransactionwithkey", + "SignRawTransaction", + "sign_raw_transaction_with_key", + ), Method::new_modelled("testmempoolaccept", "TestMempoolAccept", "test_mempool_accept"), Method::new_modelled("utxoupdatepsbt", "UtxoUpdatePsbt", "utxo_update_psbt"), Method::new_modelled("createmultisig", "CreateMultisig", "create_multisig"), @@ -89,7 +97,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("estimatesmartfee", "EstimateSmartFee", "estimate_smart_fee"), Method::new_no_model("getdescriptorinfo", "GetDescriptorInfo", "get_descriptor_info"), Method::new_no_model("getindexinfo", "GetIndexInfo", "get_index_info"), - Method::new_modelled("signmessagewithprivkey", "SignMessageWithPrivKey", "sign_message_with_priv_key"), + Method::new_modelled( + "signmessagewithprivkey", + "SignMessageWithPrivKey", + "sign_message_with_priv_key", + ), Method::new_modelled("validateaddress", "ValidateAddress", "validate_address"), Method::new_bool("verifymessage", "verify_message"), // signer diff --git a/verify/src/method/v24.rs b/verify/src/method/v24.rs index 4fad9356..22bc17ef 100644 --- a/verify/src/method/v24.rs +++ b/verify/src/method/v24.rs @@ -70,7 +70,11 @@ pub const METHODS: &[Method] = &[ // raw transactions Method::new_modelled("analyzepsbt", "AnalyzePsbt", "analyze_psbt"), Method::new_modelled("combinepsbt", "CombinePsbt", "combine_psbt"), - Method::new_modelled("combinerawtransaction", "CombineRawTransaction", "combine_raw_transaction"), + Method::new_modelled( + "combinerawtransaction", + "CombineRawTransaction", + "combine_raw_transaction", + ), Method::new_modelled("converttopsbt", "ConvertToPsbt", "convert_to_psbt"), Method::new_modelled("createpsbt", "CreatePsbt", "create_psbt"), Method::new_modelled("createrawtransaction", "CreateRawTransaction", "create_raw_transaction"), @@ -82,7 +86,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("getrawtransaction", "GetRawTransaction", "get_raw_transaction"), Method::new_modelled("joinpsbts", "JoinPsbts", "join_psbts"), Method::new_modelled("sendrawtransaction", "SendRawTransaction", "send_raw_transaction"), - Method::new_modelled("signrawtransactionwithkey", "SignRawTransaction", "sign_raw_transaction_with_key"), + Method::new_modelled( + "signrawtransactionwithkey", + "SignRawTransaction", + "sign_raw_transaction_with_key", + ), Method::new_modelled("testmempoolaccept", "TestMempoolAccept", "test_mempool_accept"), Method::new_modelled("utxoupdatepsbt", "UtxoUpdatePsbt", "utxo_update_psbt"), Method::new_modelled("createmultisig", "CreateMultisig", "create_multisig"), @@ -90,7 +98,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("estimatesmartfee", "EstimateSmartFee", "estimate_smart_fee"), Method::new_no_model("getdescriptorinfo", "GetDescriptorInfo", "get_descriptor_info"), Method::new_no_model("getindexinfo", "GetIndexInfo", "get_index_info"), - Method::new_modelled("signmessagewithprivkey", "SignMessageWithPrivKey", "sign_message_with_priv_key"), + Method::new_modelled( + "signmessagewithprivkey", + "SignMessageWithPrivKey", + "sign_message_with_priv_key", + ), Method::new_modelled("validateaddress", "ValidateAddress", "validate_address"), Method::new_bool("verifymessage", "verify_message"), // signer @@ -165,7 +177,11 @@ pub const METHODS: &[Method] = &[ "SignRawTransaction", "sign_raw_transaction_with_wallet", ), - Method::new_modelled("simulaterawtransaction", "SimulateRawTransaction", "simulate_raw_transaction"), + Method::new_modelled( + "simulaterawtransaction", + "SimulateRawTransaction", + "simulate_raw_transaction", + ), Method::new_nothing("unloadwallet", "unload_wallet"), Method::new_no_model("upgradewallet", "UpgradeWallet", "upgrade_wallet"), Method::new_modelled( diff --git a/verify/src/method/v25.rs b/verify/src/method/v25.rs index 2eaac221..4a5603ee 100644 --- a/verify/src/method/v25.rs +++ b/verify/src/method/v25.rs @@ -71,7 +71,11 @@ pub const METHODS: &[Method] = &[ // raw transactions Method::new_modelled("analyzepsbt", "AnalyzePsbt", "analyze_psbt"), Method::new_modelled("combinepsbt", "CombinePsbt", "combine_psbt"), - Method::new_modelled("combinerawtransaction", "CombineRawTransaction", "combine_raw_transaction"), + Method::new_modelled( + "combinerawtransaction", + "CombineRawTransaction", + "combine_raw_transaction", + ), Method::new_modelled("converttopsbt", "ConvertToPsbt", "convert_to_psbt"), Method::new_modelled("createpsbt", "CreatePsbt", "create_psbt"), Method::new_modelled("createrawtransaction", "CreateRawTransaction", "create_raw_transaction"), @@ -83,7 +87,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("getrawtransaction", "GetRawTransaction", "get_raw_transaction"), Method::new_modelled("joinpsbts", "JoinPsbts", "join_psbts"), Method::new_modelled("sendrawtransaction", "SendRawTransaction", "send_raw_transaction"), - Method::new_modelled("signrawtransactionwithkey", "SignRawTransaction", "sign_raw_transaction_with_key"), + Method::new_modelled( + "signrawtransactionwithkey", + "SignRawTransaction", + "sign_raw_transaction_with_key", + ), Method::new_modelled("testmempoolaccept", "TestMempoolAccept", "test_mempool_accept"), Method::new_modelled("utxoupdatepsbt", "UtxoUpdatePsbt", "utxo_update_psbt"), Method::new_modelled("createmultisig", "CreateMultisig", "create_multisig"), @@ -91,7 +99,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("estimatesmartfee", "EstimateSmartFee", "estimate_smart_fee"), Method::new_no_model("getdescriptorinfo", "GetDescriptorInfo", "get_descriptor_info"), Method::new_no_model("getindexinfo", "GetIndexInfo", "get_index_info"), - Method::new_modelled("signmessagewithprivkey", "SignMessageWithPrivKey", "sign_message_with_priv_key"), + Method::new_modelled( + "signmessagewithprivkey", + "SignMessageWithPrivKey", + "sign_message_with_priv_key", + ), Method::new_modelled("validateaddress", "ValidateAddress", "validate_address"), Method::new_bool("verifymessage", "verify_message"), Method::new_nothing("abandontransaction", "abandon_transaction"), @@ -166,7 +178,11 @@ pub const METHODS: &[Method] = &[ "SignRawTransaction", "sign_raw_transaction_with_wallet", ), - Method::new_modelled("simulaterawtransaction", "SimulateRawTransaction", "simulate_raw_transaction"), + Method::new_modelled( + "simulaterawtransaction", + "SimulateRawTransaction", + "simulate_raw_transaction", + ), Method::new_nothing("unloadwallet", "unload_wallet"), Method::new_no_model("upgradewallet", "UpgradeWallet", "upgrade_wallet"), Method::new_modelled( diff --git a/verify/src/method/v26.rs b/verify/src/method/v26.rs index 33e99cf0..a8329fe2 100644 --- a/verify/src/method/v26.rs +++ b/verify/src/method/v26.rs @@ -55,7 +55,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("getblocktemplate", "GetBlockTemplate", "get_block_template"), Method::new_modelled("getmininginfo", "GetMiningInfo", "get_mining_info"), Method::new_nothing("getnetworkhashps", "get_network_hashes_per_second"), - Method::new_modelled("getprioritisedtransactions", "GetPrioritisedTransactions", "get_prioritised_transactions"), + Method::new_modelled( + "getprioritisedtransactions", + "GetPrioritisedTransactions", + "get_prioritised_transactions", + ), Method::new_bool("prioritisetransaction", "prioritise_transaction"), Method::new_nothing("submitblock", "submit_block"), Method::new_nothing("submitheader", "submit_header"), @@ -77,20 +81,32 @@ pub const METHODS: &[Method] = &[ // raw transactions Method::new_modelled("analyzepsbt", "AnalyzePsbt", "analyze_psbt"), Method::new_modelled("combinepsbt", "CombinePsbt", "combine_psbt"), - Method::new_modelled("combinerawtransaction", "CombineRawTransaction", "combine_raw_transaction"), + Method::new_modelled( + "combinerawtransaction", + "CombineRawTransaction", + "combine_raw_transaction", + ), Method::new_modelled("converttopsbt", "ConvertToPsbt", "convert_to_psbt"), Method::new_modelled("createpsbt", "CreatePsbt", "create_psbt"), Method::new_modelled("createrawtransaction", "CreateRawTransaction", "create_raw_transaction"), Method::new_modelled("decodepsbt", "DecodePsbt", "decode_psbt"), Method::new_modelled("decoderawtransaction", "DecodeRawTransaction", "decode_raw_transaction"), Method::new_modelled("decodescript", "DecodeScript", "decode_script"), - Method::new_modelled("descriptorprocesspsbt", "DescriptorProcessPsbt", "descriptor_process_psbt"), + Method::new_modelled( + "descriptorprocesspsbt", + "DescriptorProcessPsbt", + "descriptor_process_psbt", + ), Method::new_modelled("finalizepsbt", "FinalizePsbt", "finalize_psbt"), Method::new_modelled("fundrawtransaction", "FundRawTransaction", "fund_raw_transaction"), Method::new_modelled("getrawtransaction", "GetRawTransaction", "get_raw_transaction"), Method::new_modelled("joinpsbts", "JoinPsbts", "join_psbts"), Method::new_modelled("sendrawtransaction", "SendRawTransaction", "send_raw_transaction"), - Method::new_modelled("signrawtransactionwithkey", "SignRawTransaction", "sign_raw_transaction_with_key"), + Method::new_modelled( + "signrawtransactionwithkey", + "SignRawTransaction", + "sign_raw_transaction_with_key", + ), Method::new_modelled("submitpackage", "SubmitPackage", "submit_package"), Method::new_modelled("testmempoolaccept", "TestMempoolAccept", "test_mempool_accept"), Method::new_modelled("utxoupdatepsbt", "UtxoUpdatePsbt", "utxo_update_psbt"), @@ -99,7 +115,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("estimatesmartfee", "EstimateSmartFee", "estimate_smart_fee"), Method::new_no_model("getdescriptorinfo", "GetDescriptorInfo", "get_descriptor_info"), Method::new_no_model("getindexinfo", "GetIndexInfo", "get_index_info"), - Method::new_modelled("signmessagewithprivkey", "SignMessageWithPrivKey", "sign_message_with_priv_key"), + Method::new_modelled( + "signmessagewithprivkey", + "SignMessageWithPrivKey", + "sign_message_with_priv_key", + ), Method::new_modelled("validateaddress", "ValidateAddress", "validate_address"), Method::new_bool("verifymessage", "verify_message"), // signer @@ -174,7 +194,11 @@ pub const METHODS: &[Method] = &[ "SignRawTransaction", "sign_raw_transaction_with_wallet", ), - Method::new_modelled("simulaterawtransaction", "SimulateRawTransaction", "simulate_raw_transaction"), + Method::new_modelled( + "simulaterawtransaction", + "SimulateRawTransaction", + "simulate_raw_transaction", + ), Method::new_nothing("unloadwallet", "unload_wallet"), Method::new_no_model("upgradewallet", "UpgradeWallet", "upgrade_wallet"), Method::new_modelled( diff --git a/verify/src/method/v27.rs b/verify/src/method/v27.rs index 22a7fc2b..4f41ad13 100644 --- a/verify/src/method/v27.rs +++ b/verify/src/method/v27.rs @@ -55,7 +55,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("getblocktemplate", "GetBlockTemplate", "get_block_template"), Method::new_modelled("getmininginfo", "GetMiningInfo", "get_mining_info"), Method::new_nothing("getnetworkhashps", "get_network_hashes_per_second"), - Method::new_modelled("getprioritisedtransactions", "GetPrioritisedTransactions", "get_prioritised_transactions"), + Method::new_modelled( + "getprioritisedtransactions", + "GetPrioritisedTransactions", + "get_prioritised_transactions", + ), Method::new_bool("prioritisetransaction", "prioritise_transaction"), Method::new_nothing("submitblock", "submit_block"), Method::new_bool("prioritisetransaction", "prioritise_transaction"), @@ -79,20 +83,32 @@ pub const METHODS: &[Method] = &[ // raw transactions Method::new_modelled("analyzepsbt", "AnalyzePsbt", "analyze_psbt"), Method::new_modelled("combinepsbt", "CombinePsbt", "combine_psbt"), - Method::new_modelled("combinerawtransaction", "CombineRawTransaction", "combine_raw_transaction"), + Method::new_modelled( + "combinerawtransaction", + "CombineRawTransaction", + "combine_raw_transaction", + ), Method::new_modelled("converttopsbt", "ConvertToPsbt", "convert_to_psbt"), Method::new_modelled("createpsbt", "CreatePsbt", "create_psbt"), Method::new_modelled("createrawtransaction", "CreateRawTransaction", "create_raw_transaction"), Method::new_modelled("decodepsbt", "DecodePsbt", "decode_psbt"), Method::new_modelled("decoderawtransaction", "DecodeRawTransaction", "decode_raw_transaction"), Method::new_modelled("decodescript", "DecodeScript", "decode_script"), - Method::new_modelled("descriptorprocesspsbt", "DescriptorProcessPsbt", "descriptor_process_psbt"), + Method::new_modelled( + "descriptorprocesspsbt", + "DescriptorProcessPsbt", + "descriptor_process_psbt", + ), Method::new_modelled("finalizepsbt", "FinalizePsbt", "finalize_psbt"), Method::new_modelled("fundrawtransaction", "FundRawTransaction", "fund_raw_transaction"), Method::new_modelled("getrawtransaction", "GetRawTransaction", "get_raw_transaction"), Method::new_modelled("joinpsbts", "JoinPsbts", "join_psbts"), Method::new_modelled("sendrawtransaction", "SendRawTransaction", "send_raw_transaction"), - Method::new_modelled("signrawtransactionwithkey", "SignRawTransaction", "sign_raw_transaction_with_key"), + Method::new_modelled( + "signrawtransactionwithkey", + "SignRawTransaction", + "sign_raw_transaction_with_key", + ), Method::new_modelled("submitpackage", "SubmitPackage", "submit_package"), Method::new_modelled("testmempoolaccept", "TestMempoolAccept", "test_mempool_accept"), Method::new_modelled("utxoupdatepsbt", "UtxoUpdatePsbt", "utxo_update_psbt"), @@ -101,7 +117,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("estimatesmartfee", "EstimateSmartFee", "estimate_smart_fee"), Method::new_no_model("getdescriptorinfo", "GetDescriptorInfo", "get_descriptor_info"), Method::new_no_model("getindexinfo", "GetIndexInfo", "get_index_info"), - Method::new_modelled("signmessagewithprivkey", "SignMessageWithPrivKey", "sign_message_with_priv_key"), + Method::new_modelled( + "signmessagewithprivkey", + "SignMessageWithPrivKey", + "sign_message_with_priv_key", + ), Method::new_modelled("validateaddress", "ValidateAddress", "validate_address"), Method::new_bool("verifymessage", "verify_message"), // signer @@ -176,7 +196,11 @@ pub const METHODS: &[Method] = &[ "SignRawTransaction", "sign_raw_transaction_with_wallet", ), - Method::new_modelled("simulaterawtransaction", "SimulateRawTransaction", "simulate_raw_transaction"), + Method::new_modelled( + "simulaterawtransaction", + "SimulateRawTransaction", + "simulate_raw_transaction", + ), Method::new_nothing("unloadwallet", "unload_wallet"), Method::new_no_model("upgradewallet", "UpgradeWallet", "upgrade_wallet"), Method::new_modelled( diff --git a/verify/src/method/v28.rs b/verify/src/method/v28.rs index 02ba281f..380aeee8 100644 --- a/verify/src/method/v28.rs +++ b/verify/src/method/v28.rs @@ -55,7 +55,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("getblocktemplate", "GetBlockTemplate", "get_block_template"), Method::new_modelled("getmininginfo", "GetMiningInfo", "get_mining_info"), Method::new_nothing("getnetworkhashps", "get_network_hashes_per_second"), - Method::new_modelled("getprioritisedtransactions", "GetPrioritisedTransactions", "get_prioritised_transactions"), + Method::new_modelled( + "getprioritisedtransactions", + "GetPrioritisedTransactions", + "get_prioritised_transactions", + ), Method::new_bool("prioritisetransaction", "prioritise_transaction"), Method::new_nothing("submitblock", "submit_block"), Method::new_bool("prioritisetransaction", "prioritise_transaction"), @@ -79,20 +83,32 @@ pub const METHODS: &[Method] = &[ // raw transactions Method::new_modelled("analyzepsbt", "AnalyzePsbt", "analyze_psbt"), Method::new_modelled("combinepsbt", "CombinePsbt", "combine_psbt"), - Method::new_modelled("combinerawtransaction", "CombineRawTransaction", "combine_raw_transaction"), + Method::new_modelled( + "combinerawtransaction", + "CombineRawTransaction", + "combine_raw_transaction", + ), Method::new_modelled("converttopsbt", "ConvertToPsbt", "convert_to_psbt"), Method::new_modelled("createpsbt", "CreatePsbt", "create_psbt"), Method::new_modelled("createrawtransaction", "CreateRawTransaction", "create_raw_transaction"), Method::new_modelled("decodepsbt", "DecodePsbt", "decode_psbt"), Method::new_modelled("decoderawtransaction", "DecodeRawTransaction", "decode_raw_transaction"), Method::new_modelled("decodescript", "DecodeScript", "decode_script"), - Method::new_modelled("descriptorprocesspsbt", "DescriptorProcessPsbt", "descriptor_process_psbt"), + Method::new_modelled( + "descriptorprocesspsbt", + "DescriptorProcessPsbt", + "descriptor_process_psbt", + ), Method::new_modelled("finalizepsbt", "FinalizePsbt", "finalize_psbt"), Method::new_modelled("fundrawtransaction", "FundRawTransaction", "fund_raw_transaction"), Method::new_modelled("getrawtransaction", "GetRawTransaction", "get_raw_transaction"), Method::new_modelled("joinpsbts", "JoinPsbts", "join_psbts"), Method::new_modelled("sendrawtransaction", "SendRawTransaction", "send_raw_transaction"), - Method::new_modelled("signrawtransactionwithkey", "SignRawTransaction", "sign_raw_transaction_with_key"), + Method::new_modelled( + "signrawtransactionwithkey", + "SignRawTransaction", + "sign_raw_transaction_with_key", + ), Method::new_modelled("submitpackage", "SubmitPackage", "submit_package"), Method::new_modelled("testmempoolaccept", "TestMempoolAccept", "test_mempool_accept"), Method::new_modelled("utxoupdatepsbt", "UtxoUpdatePsbt", "utxo_update_psbt"), @@ -101,7 +117,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("estimatesmartfee", "EstimateSmartFee", "estimate_smart_fee"), Method::new_no_model("getdescriptorinfo", "GetDescriptorInfo", "get_descriptor_info"), Method::new_no_model("getindexinfo", "GetIndexInfo", "get_index_info"), - Method::new_modelled("signmessagewithprivkey", "SignMessageWithPrivKey", "sign_message_with_priv_key"), + Method::new_modelled( + "signmessagewithprivkey", + "SignMessageWithPrivKey", + "sign_message_with_priv_key", + ), Method::new_modelled("validateaddress", "ValidateAddress", "validate_address"), Method::new_bool("verifymessage", "verify_message"), // signer @@ -113,7 +133,11 @@ pub const METHODS: &[Method] = &[ Method::new_nothing("backupwallet", "backup_wallet"), Method::new_modelled("bumpfee", "BumpFee", "bump_fee"), Method::new_modelled("createwallet", "CreateWallet", "create_wallet"), - Method::new_no_model("createwalletdescriptor", "CreateWalletDescriptor", "create_wallet_descriptor"), + Method::new_no_model( + "createwalletdescriptor", + "CreateWalletDescriptor", + "create_wallet_descriptor", + ), Method::new_modelled("dumpprivkey", "DumpPrivKey", "dump_priv_key"), Method::new_no_model("dumpwallet", "DumpWallet", "dump_wallet"), Method::new_no_model("encryptwallet", "EncryptWallet", "encrypt_wallet"), @@ -178,7 +202,11 @@ pub const METHODS: &[Method] = &[ "SignRawTransaction", "sign_raw_transaction_with_wallet", ), - Method::new_modelled("simulaterawtransaction", "SimulateRawTransaction", "simulate_raw_transaction"), + Method::new_modelled( + "simulaterawtransaction", + "SimulateRawTransaction", + "simulate_raw_transaction", + ), Method::new_nothing("unloadwallet", "unload_wallet"), Method::new_no_model("upgradewallet", "UpgradeWallet", "upgrade_wallet"), Method::new_modelled( diff --git a/verify/src/method/v29.rs b/verify/src/method/v29.rs index d46090d4..bf6bb684 100644 --- a/verify/src/method/v29.rs +++ b/verify/src/method/v29.rs @@ -21,7 +21,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("getchaintips", "GetChainTips", "get_chain_tips"), Method::new_modelled("getchaintxstats", "GetChainTxStats", "get_chain_tx_stats"), Method::new_modelled("getdeploymentinfo", "GetDeploymentInfo", "get_deployment_info"), - Method::new_modelled("getdescriptoractivity", "GetDescriptorActivity", "get_descriptor_activity"), + Method::new_modelled( + "getdescriptoractivity", + "GetDescriptorActivity", + "get_descriptor_activity", + ), Method::new_modelled("getdifficulty", "GetDifficulty", "get_difficulty"), Method::new_modelled("getmempoolancestors", "GetMempoolAncestors", "get_mempool_ancestors"), Method::new_modelled( @@ -56,7 +60,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("getblocktemplate", "GetBlockTemplate", "get_block_template"), Method::new_modelled("getmininginfo", "GetMiningInfo", "get_mining_info"), Method::new_nothing("getnetworkhashps", "get_network_hashes_per_second"), - Method::new_modelled("getprioritisedtransactions", "GetPrioritisedTransactions", "get_prioritised_transactions"), + Method::new_modelled( + "getprioritisedtransactions", + "GetPrioritisedTransactions", + "get_prioritised_transactions", + ), Method::new_bool("prioritisetransaction", "prioritise_transaction"), Method::new_nothing("submitblock", "submit_block"), Method::new_bool("prioritisetransaction", "prioritise_transaction"), @@ -80,20 +88,32 @@ pub const METHODS: &[Method] = &[ // raw transactions Method::new_modelled("analyzepsbt", "AnalyzePsbt", "analyze_psbt"), Method::new_modelled("combinepsbt", "CombinePsbt", "combine_psbt"), - Method::new_modelled("combinerawtransaction", "CombineRawTransaction", "combine_raw_transaction"), + Method::new_modelled( + "combinerawtransaction", + "CombineRawTransaction", + "combine_raw_transaction", + ), Method::new_modelled("converttopsbt", "ConvertToPsbt", "convert_to_psbt"), Method::new_modelled("createpsbt", "CreatePsbt", "create_psbt"), Method::new_modelled("createrawtransaction", "CreateRawTransaction", "create_raw_transaction"), Method::new_modelled("decodepsbt", "DecodePsbt", "decode_psbt"), Method::new_modelled("decoderawtransaction", "DecodeRawTransaction", "decode_raw_transaction"), Method::new_modelled("decodescript", "DecodeScript", "decode_script"), - Method::new_modelled("descriptorprocesspsbt", "DescriptorProcessPsbt", "descriptor_process_psbt"), + Method::new_modelled( + "descriptorprocesspsbt", + "DescriptorProcessPsbt", + "descriptor_process_psbt", + ), Method::new_modelled("finalizepsbt", "FinalizePsbt", "finalize_psbt"), Method::new_modelled("fundrawtransaction", "FundRawTransaction", "fund_raw_transaction"), Method::new_modelled("getrawtransaction", "GetRawTransaction", "get_raw_transaction"), Method::new_modelled("joinpsbts", "JoinPsbts", "join_psbts"), Method::new_modelled("sendrawtransaction", "SendRawTransaction", "send_raw_transaction"), - Method::new_modelled("signrawtransactionwithkey", "SignRawTransaction", "sign_raw_transaction_with_key"), + Method::new_modelled( + "signrawtransactionwithkey", + "SignRawTransaction", + "sign_raw_transaction_with_key", + ), Method::new_modelled("submitpackage", "SubmitPackage", "submit_package"), Method::new_modelled("testmempoolaccept", "TestMempoolAccept", "test_mempool_accept"), Method::new_modelled("utxoupdatepsbt", "UtxoUpdatePsbt", "utxo_update_psbt"), @@ -102,7 +122,11 @@ pub const METHODS: &[Method] = &[ Method::new_modelled("estimatesmartfee", "EstimateSmartFee", "estimate_smart_fee"), Method::new_no_model("getdescriptorinfo", "GetDescriptorInfo", "get_descriptor_info"), Method::new_no_model("getindexinfo", "GetIndexInfo", "get_index_info"), - Method::new_modelled("signmessagewithprivkey", "SignMessageWithPrivKey", "sign_message_with_priv_key"), + Method::new_modelled( + "signmessagewithprivkey", + "SignMessageWithPrivKey", + "sign_message_with_priv_key", + ), Method::new_modelled("validateaddress", "ValidateAddress", "validate_address"), Method::new_bool("verifymessage", "verify_message"), // signer @@ -114,7 +138,11 @@ pub const METHODS: &[Method] = &[ Method::new_nothing("backupwallet", "backup_wallet"), Method::new_modelled("bumpfee", "BumpFee", "bump_fee"), Method::new_modelled("createwallet", "CreateWallet", "create_wallet"), - Method::new_no_model("createwalletdescriptor", "CreateWalletDescriptor", "create_wallet_descriptor"), + Method::new_no_model( + "createwalletdescriptor", + "CreateWalletDescriptor", + "create_wallet_descriptor", + ), Method::new_modelled("dumpprivkey", "DumpPrivKey", "dump_priv_key"), Method::new_no_model("dumpwallet", "DumpWallet", "dump_wallet"), Method::new_no_model("encryptwallet", "EncryptWallet", "encrypt_wallet"), @@ -179,7 +207,11 @@ pub const METHODS: &[Method] = &[ "SignRawTransaction", "sign_raw_transaction_with_wallet", ), - Method::new_modelled("simulaterawtransaction", "SimulateRawTransaction", "simulate_raw_transaction"), + Method::new_modelled( + "simulaterawtransaction", + "SimulateRawTransaction", + "simulate_raw_transaction", + ), Method::new_nothing("unloadwallet", "unload_wallet"), Method::new_no_model("upgradewallet", "UpgradeWallet", "upgrade_wallet"), Method::new_modelled( diff --git a/verify/src/versioned.rs b/verify/src/versioned.rs index 28a8b13e..daf2822b 100644 --- a/verify/src/versioned.rs +++ b/verify/src/versioned.rs @@ -174,7 +174,8 @@ impl FromStr for Status { "version" => Ok(Status::Done), "version + model" => Ok(Status::Done), "omitted" => Ok(Status::Omitted), - "returns nothing" | "returns numeric" | "returns boolean" | "returns string"=> Ok(Status::Done), + "returns nothing" | "returns numeric" | "returns boolean" | "returns string" => + Ok(Status::Done), other => Err(anyhow::Error::msg(format!("unknown status: '{}'", other))), } }