diff --git a/integration_test/tests/blockchain.rs b/integration_test/tests/blockchain.rs index 1ce632a0..047ede35 100644 --- a/integration_test/tests/blockchain.rs +++ b/integration_test/tests/blockchain.rs @@ -4,6 +4,8 @@ #![allow(non_snake_case)] // Test names intentionally use double underscore. +use bitcoin::hex; +use bitcoin::consensus::encode; use integration_test::{Node, NodeExt as _, Wallet}; use node::client::client_sync; use node::vtype::*; // All the version specific types. @@ -38,8 +40,8 @@ fn blockchain__dump_tx_out_set__modelled() { fn blockchain__get_best_block_hash__modelled() { let node = Node::with_wallet(Wallet::None, &[]); - let json = node.client.get_best_block_hash().expect("rpc"); - let model: Result = json.into_model(); + let json: GetBestBlockHash = node.client.get_best_block_hash().expect("getbestblockhash"); + let model: Result = json.into_model(); model.unwrap(); } @@ -49,12 +51,12 @@ fn blockchain__get_block__modelled() { 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 model: Result = json.into_model(); - model.expect("GetBlock into model"); + let model: Result = json.into_model(); + model.unwrap(); let json: GetBlockVerboseOne = node.client.get_block_verbose_one(block_hash).expect("getblock verbose=1"); let model: Result = json.into_model(); - model.expect("GetBlockVerbose into model"); + model.unwrap(); // TODO: Test getblock 2 // let json = node.client.get_block_with_verbosity(block_hash, 2).expect("getblock verbosity 2"); @@ -126,7 +128,7 @@ fn blockchain__get_block_hash__modelled() { let node = Node::with_wallet(Wallet::None, &[]); let json: GetBlockHash = node.client.get_block_hash(0).expect("getblockhash"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); model.unwrap(); } @@ -161,13 +163,15 @@ fn getblockstats() { let node = Node::with_wallet(Wallet::Default, &[]); node.fund_wallet(); - let json = node.client.get_block_stats_by_height(1).expect("getblockstats"); - json.into_model().unwrap(); + let json: GetBlockStats = node.client.get_block_stats_by_height(1).expect("getblockstats"); + let model: Result = json.into_model(); + model.unwrap(); // 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 = node.client.get_block_stats_by_block_hash(&block_hash).expect("getblockstats"); - json.into_model().unwrap(); + let json: GetBlockStats = node.client.get_block_stats_by_block_hash(&block_hash).expect("getblockstats"); + let model: Result = json.into_model(); + model.unwrap(); } fn getblockstats_txindex() { @@ -177,12 +181,13 @@ fn getblockstats_txindex() { // Get block stats by height. let json: GetBlockStats = node.client.get_block_stats_by_height(101).expect("getblockstats"); let model: Result = json.into_model(); - model.expect("GetBlockStats into model"); + model.unwrap(); // Get block stats by block hash. let block_hash = node.client.best_block_hash().expect("best_block_hash failed"); - let json = node.client.get_block_stats_by_block_hash(&block_hash).expect("getblockstats"); - json.into_model().unwrap(); + let json: GetBlockStats = node.client.get_block_stats_by_block_hash(&block_hash).expect("getblockstats"); + let model: Result = json.into_model(); + model.unwrap(); } #[test] @@ -193,7 +198,7 @@ fn blockchain__get_chain_states__modelled() { let (_address, _tx) = node.create_mined_transaction(); let json: GetChainStates = node.client.get_chain_states().expect("getchainstates"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); let chain_states = model.unwrap(); assert!(chain_states.chain_states[0].blocks > 0); @@ -255,7 +260,7 @@ fn blockchain__get_mempool_ancestors__modelled() { let json: GetMempoolAncestors = node.client.get_mempool_ancestors(child_txid).expect("getmempoolancestors"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); let ancestors = model.unwrap(); assert!(ancestors.0.contains(&parent_txid)); @@ -272,7 +277,7 @@ fn blockchain__get_mempool_ancestors_verbose__modelled() { .client .get_mempool_ancestors_verbose(child_txid) .expect("getmempoolancestors verbose"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); let ancestors = model.unwrap(); assert!(ancestors.0.contains_key(&parent_txid)); @@ -287,7 +292,7 @@ fn blockchain__get_mempool_descendants__modelled() { let json: GetMempoolDescendants = node.client.get_mempool_descendants(parent_txid).expect("getmempooldescendants"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); let descendants = model.unwrap(); assert!(descendants.0.contains(&child_txid)); @@ -304,7 +309,7 @@ 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)); @@ -343,7 +348,7 @@ fn blockchain__get_raw_mempool__modelled() { // verbose = false let json: GetRawMempool = node.client.get_raw_mempool().expect("getrawmempool"); - let model: Result = json.clone().into_model(); + let model: Result = json.clone().into_model(); let mempool = model.unwrap(); // Sanity check. assert_eq!(mempool.0.len(), 1); @@ -474,8 +479,8 @@ fn blockchain__savemempool() { } } -#[cfg(not(feature = "v24_and_below"))] #[test] +#[cfg(not(feature = "v24_and_below"))] fn blockchain__scan_blocks_modelled() { let node = Node::with_wallet(Wallet::None, &["-blockfilterindex=1"]); @@ -519,7 +524,7 @@ fn verify_tx_out_proof(node: &Node) -> Result<(), client_sync::Error> { let proof = node.client.get_tx_out_proof(&[txid])?; let json: VerifyTxOutProof = node.client.verify_tx_out_proof(&proof)?; - let model: Result = json.into_model(); + let model: Result = json.into_model(); let txids = model.unwrap(); // sanity check @@ -547,9 +552,9 @@ fn create_child_spending_parent(node: &Node, parent_txid: bitcoin::Txid) -> bitc .client .sign_raw_transaction_with_wallet(&funded_tx) .expect("signrawtransactionwithwallet"); - let model = signed.into_model().expect("SignRawTransactionWithWallet into model"); - let child_txid = model.tx.compute_txid(); - let _ = node.client.send_raw_transaction(&model.tx).expect("sendrawtransaction"); + 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"); child_txid } diff --git a/integration_test/tests/control.rs b/integration_test/tests/control.rs index d324ef09..2b693a39 100644 --- a/integration_test/tests/control.rs +++ b/integration_test/tests/control.rs @@ -13,8 +13,8 @@ fn control__get_memory_info() { let _: GetMemoryInfoStats = node.client.get_memory_info().unwrap(); } -#[cfg(not(feature = "v17"))] #[test] +#[cfg(not(feature = "v17"))] fn control__get_rpc_info() { let node = Node::with_wallet(Wallet::None, &[]); let _ = node.client.get_rpc_info().unwrap(); diff --git a/integration_test/tests/generating.rs b/integration_test/tests/generating.rs index d4b13e1e..9e2d06e4 100644 --- a/integration_test/tests/generating.rs +++ b/integration_test/tests/generating.rs @@ -4,12 +4,13 @@ #![allow(non_snake_case)] // Test names intentionally use double underscore. +use bitcoin::hex; use integration_test::{Node, NodeExt as _, Wallet}; use node::vtype::*; // All the version specific types. use node::mtype; -#[cfg(not(feature = "v20_and_below"))] #[test] +#[cfg(not(feature = "v20_and_below"))] fn generating__generate_block__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); node.fund_wallet(); @@ -29,7 +30,7 @@ fn generating__generate_block__modelled() { { // No `submit` argument json = node.client.generate_block(&mining_addr.to_string(), &transactions).expect("generateblock"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); model.unwrap(); } @@ -43,7 +44,6 @@ fn generating__generate_block__modelled() { } #[test] -// The `generate` method was deprecated in Core v0.18 and was removed in v0.19. #[cfg(feature = "v17")] fn generating__generate__modelled() { const NBLOCKS: usize = 10; @@ -51,7 +51,7 @@ fn generating__generate__modelled() { let json: Generate = node.client.generate(NBLOCKS).expect("generate"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); model.unwrap(); } @@ -64,12 +64,12 @@ fn generating__generate_to_address__modelled() { let json: GenerateToAddress = node.client.generate_to_address(NBLOCKS, &address).expect("generatetoaddress"); - let model: Result = json.into_model(); - let _ = model.unwrap(); + let model: Result = json.into_model(); + model.unwrap(); } -#[cfg(not(feature = "v19_and_below"))] #[test] +#[cfg(not(feature = "v19_and_below"))] fn generating__generate_to_descriptor__modelled() { const NBLOCKS: usize = 1; @@ -78,8 +78,8 @@ fn generating__generate_to_descriptor__modelled() { let descriptor = format!("addr({})", address); let json: GenerateToDescriptor = node.client.generate_to_descriptor(NBLOCKS, &descriptor).expect("generatetodescriptor"); - let model: Result = json.into_model(); - let _ = model.unwrap(); + let model: Result = json.into_model(); + model.unwrap(); } // This method does not appear in the output of `bitcoin-cli help`. @@ -103,7 +103,10 @@ fn generating__invalidate_block() { assert_ne!(old_best_block, new_best_block); node.client.invalidate_block(new_best_block).expect("invalidateblock"); - let best_block = - node.client.get_best_block_hash().expect("getbestblockhash").into_model().unwrap().0; - assert_eq!(old_best_block, best_block); + + let json: GetBestBlockHash = node.client.get_best_block_hash().expect("getbestblockhash"); + let model: Result = json.into_model(); + let best_block = model.unwrap(); + + assert_eq!(old_best_block, best_block.0); } diff --git a/integration_test/tests/mining.rs b/integration_test/tests/mining.rs index 2ece5e92..5dc7ff98 100644 --- a/integration_test/tests/mining.rs +++ b/integration_test/tests/mining.rs @@ -32,7 +32,8 @@ fn mining__get_block_template__modelled() { let json: GetBlockTemplate = node1.client.get_block_template(&options) .expect("get_block_template RPC failed"); - let _: Result = json.into_model(); + let model: Result = json.into_model(); + model.unwrap(); } #[test] @@ -61,7 +62,6 @@ fn mining__get_network_hash_ps() { } #[test] -// Core version 26 onwards. #[cfg(not(feature = "v25_and_below"))] fn mining__get_prioritised_transactions() { let node = Node::with_wallet(Wallet::Default, &[]); @@ -77,8 +77,8 @@ fn mining__prioritise_transaction() { let (_addr, txid) = node.create_mempool_transaction(); let fee_delta = SignedAmount::from_sat(10_000); - let res = node.client.prioritise_transaction(&txid, fee_delta).expect("prioritisetransaction"); - assert!(res) // According to docs always returns true. + let json = node.client.prioritise_transaction(&txid, fee_delta).expect("prioritisetransaction"); + assert!(json) // According to docs always returns true. } #[test] @@ -93,8 +93,8 @@ fn mining__submit_block() { node3.mine_a_block(); let options = TemplateRequest { rules: vec![TemplateRules::Segwit] }; - let json = node1.client.get_block_template(&options).expect("getblocktemplate"); - let template = json.into_model().expect("GetBlockTemplate into model"); + let json: GetBlockTemplate = node1.client.get_block_template(&options).expect("getblocktemplate"); + let template: mtype::GetBlockTemplate = json.into_model().unwrap(); submit_empty_block(&node1, &template); // submit_block_with_dummy_coinbase(&node1, &template); @@ -211,8 +211,8 @@ fn mining__submit_block_with_dummy_coinbase(node: &Node, bt: &mtype::GetBlockTem let _: () = node.client.submit_block(&block).expect("submitblock"); } -#[cfg(not(feature = "v17"))] #[test] +#[cfg(not(feature = "v17"))] fn mining__submit_header() { let node = Node::with_wallet(Wallet::Default, &[]); node.fund_wallet(); diff --git a/integration_test/tests/raw_transactions.rs b/integration_test/tests/raw_transactions.rs index 99b69678..f8e21556 100644 --- a/integration_test/tests/raw_transactions.rs +++ b/integration_test/tests/raw_transactions.rs @@ -5,9 +5,12 @@ #![allow(non_snake_case)] // Test names intentionally use double underscore. #![allow(unused_imports)] // Because of feature gated tests. +use bitcoin::consensus::encode; use bitcoin::hex::FromHex as _; use bitcoin::opcodes::all::*; -use bitcoin::{absolute, transaction, consensus, script, Amount, TxOut, Transaction, ScriptBuf}; +use bitcoin::{ + absolute, consensus, hex, psbt, script, transaction, Amount, TxOut, Transaction, ScriptBuf, +}; use integration_test::{Node, NodeExt as _, Wallet}; use node::{mtype, Input, Output}; use node::vtype::*; // All the version specific types. @@ -20,7 +23,7 @@ fn raw_transactions__analyze_psbt__modelled() { let psbt = create_a_psbt(&node); let json: AnalyzePsbt = node.client.analyze_psbt(&psbt).expect("analyzepsbt"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); model.unwrap(); } @@ -63,16 +66,16 @@ fn raw_transactions__combine_psbt__modelled() { outputs.push(Output::new(change_address, change_amount)); let json: CreatePsbt = node.client.create_psbt(&inputs, &outputs).expect("createpsbt"); - let res: Result = json.clone().into_model(); - let psbt = res.expect("CreatePsbt into model"); + let psbt: Result = json.clone().into_model(); + let psbt = psbt.unwrap(); let psbt = psbt.0; // Quick and dirty test, just combine the same PSBT with itself. let psbts = vec![psbt.clone(), psbt.clone()]; let json: CombinePsbt = node.client.combine_psbt(&psbts).expect("combinepsbt"); - let model: Result = json.into_model(); - let combined = model.expect("CombinePsbt into model"); + let model: Result = json.into_model(); + let combined = model.unwrap(); // Just for giggles. assert_eq!(combined.0, psbt) } @@ -88,15 +91,15 @@ fn raw_transactions__combine_raw_transaction__modelled() { .get_raw_transaction(txid) .expect("getrawtransaction") .transaction() - .expect("GetRawTransaction into model"); + .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 model: Result = json.into_model(); + let model: Result = json.into_model(); - let combined = model.expect("CombineRawTransaction into model"); + let combined = model.unwrap(); // Just for giggles. assert_eq!(combined.0, tx) } @@ -109,8 +112,8 @@ fn raw_transactions__convert_to_psbt__modelled() { let tx = create_a_raw_transaction(&node); let json: ConvertToPsbt = node.client.convert_to_psbt(&tx).expect("converttopsbt"); - let model: Result = json.into_model(); - let _ = model.expect("ConvertToPsbt into model"); + let model: Result = json.into_model(); + model.unwrap(); } #[test] @@ -163,10 +166,10 @@ fn raw_transactions__decode_psbt__modelled() { let encoded = psbt.to_string(); let json: DecodePsbt = node.client.decode_psbt(&encoded).expect("decodepsbt"); - let res: Result = json.into_model(); + let model: Result = json.into_model(); #[allow(unused_variables)] - let decoded = res.expect("DecodePsbt into model"); + let decoded = model.unwrap(); // Before Core v23 global xpubs was not a known keypair. #[cfg(feature = "v22_and_below")] @@ -190,10 +193,10 @@ fn raw_transactions__decode_raw_transaction__modelled() { .get_raw_transaction(txid) .expect("getrawtransaction") .transaction() - .expect("GetRawTransaction into model"); - let json = node.client.decode_raw_transaction(&tx).expect("decoderawtransaction"); + .unwrap(); + let json: DecodeRawTransaction = node.client.decode_raw_transaction(&tx).expect("decoderawtransaction"); let model: Result = json.into_model(); - model.expect("DecodeRawTransaction into model"); + model.unwrap(); } #[test] @@ -210,7 +213,7 @@ fn raw_transactions__decode_script__modelled() { let json: DecodeScript = node.client.decode_script(&hex).expect("decodescript"); let model: Result = json.into_model(); - let _ = model.expect("DecodeScript into model"); + model.unwrap(); } } @@ -285,18 +288,18 @@ fn raw_transactions__get_raw_transaction__modelled() { let (_, tx) = node.create_mined_transaction(); let json: GetRawTransaction = node.client.get_raw_transaction(tx.compute_txid()).expect("getrawtransaction"); - let model: Result = json.into_model(); - model.expect("GetRawTransaction into model"); + let model: Result = json.into_model(); + model.unwrap(); // Get raw transaction using a mined transaction and verbose = true. let (_, tx) = node.create_mined_transaction(); - let json = node + let json: GetRawTransactionVerbose = node .client .get_raw_transaction_verbose(tx.compute_txid()) .expect("getrawtransaction verbose"); let model: Result = json.into_model(); - model.expect("GetRawTransactionVerbose into model"); + model.unwrap(); // Get raw transaction using an un-mined transaction. let (_, txid) = node.create_mempool_transaction(); @@ -305,7 +308,7 @@ fn raw_transactions__get_raw_transaction__modelled() { .get_raw_transaction_verbose(txid) .expect("getrawtransaction verbose") .into_model() - .expect("GetRawTransactionVerbose into model"); + .unwrap(); } @@ -322,9 +325,10 @@ fn raw_transactions__join_psbts__modelled() { .client .join_psbts(&[psbt1.clone(), psbt2.clone()]) .expect("joinpsbts"); - let model: mtype::JoinPsbts = json.into_model().expect("JoinPsbts into model"); + let model: Result = json.into_model(); + let join_psbts = model.unwrap(); - assert_eq!(model.0.inputs.len(), psbt1.inputs.len() + psbt2.inputs.len()); + assert_eq!(join_psbts.0.inputs.len(), psbt1.inputs.len() + psbt2.inputs.len()); } #[test] @@ -359,16 +363,16 @@ fn raw_transactions__submit_package__modelled() { // The call for submitting this package should succeed, but yield an 'already known' // error for all transactions. - let res = node + let json: SubmitPackage = node .client .submit_package(&[tx_0, tx_1]) - .expect("failed to submit package") - .into_model() .expect("failed to submit package"); - for tx_result in res.tx_results.values() { + let model: Result = json.into_model(); + let submit_package = model.unwrap(); + for tx_result in submit_package.tx_results.values() { assert!(tx_result.error.is_some()); } - assert!(res.replaced_transactions.is_empty()); + assert!(submit_package.replaced_transactions.is_empty()); } // In Core v28 submitpackage has additional optional features. @@ -387,16 +391,16 @@ fn raw_transactions__submit_package__modelled() { // The call for submitting this package should succeed, but yield an 'already known' // error for all transactions. - let res = node + let json: SubmitPackage = node .client .submit_package(&[tx_0, tx_1], None, None) - .expect("failed to submit package") - .into_model() .expect("failed to submit package"); - for tx_result in res.tx_results.values() { + let model: Result = json.into_model(); + let submit_package = model.unwrap(); + for tx_result in submit_package.tx_results.values() { assert!(tx_result.error.is_some()); } - assert!(res.replaced_transactions.is_empty()); + assert!(submit_package.replaced_transactions.is_empty()); } #[test] @@ -420,11 +424,13 @@ fn raw_transactions__test_mempool_accept__modelled() { .client .test_mempool_accept(&[signed_tx.clone()]) .expect("testmempoolaccept"); - let model: mtype::TestMempoolAccept = json - .into_model() - .expect("TestMempoolAccept into model"); - assert_eq!(model.results.len(), 1); - let res = &model.results[0]; + #[cfg(feature = "v20_and_below")] + type TestMempoolAcceptError = hex::HexToArrayError; + let model: Result = json.into_model(); + let test_mempool = model.unwrap(); + + assert_eq!(test_mempool.results.len(), 1); + let res = &test_mempool.results[0]; assert_eq!(res.txid, signed_tx.compute_txid()); assert!(res.allowed, "fresh signed tx should be allowed"); } @@ -440,9 +446,10 @@ fn raw_transactions__utxo_update_psbt__modelled() { .client .utxo_update_psbt(&psbt) .expect("utxoupdatepsbt"); - let model: mtype::UtxoUpdatePsbt = json.into_model().expect("UtxoUpdatePsbt into model"); + let model: Result = json.into_model(); + let update_psbts = model.unwrap(); - assert!(model.0.inputs.len() >= psbt.inputs.len()); + assert!(update_psbts.0.inputs.len() >= psbt.inputs.len()); } // Manipulates raw transactions. @@ -479,8 +486,8 @@ fn create_sign_send(node: &Node) { let json: CreateRawTransaction = node.client.create_raw_transaction(&inputs, &outputs).expect("createrawtransaction"); - let res: Result = json.clone().into_model(); - let _ = res.expect("CreateRawTransaction into model"); + let model: Result = json.clone().into_model(); + model.unwrap(); let tx = json.transaction().unwrap(); // wallet.rs expects this call to exist, if you change it then you'll need to update the test @@ -488,14 +495,14 @@ fn create_sign_send(node: &Node) { let json: SignRawTransaction = node.client.sign_raw_transaction_with_wallet(&tx).expect("signrawtransactionwithwallet"); - let res: Result = json.into_model(); - let model = res.expect("SignRawTransactionWithWallet into model"); + let model: Result = json.into_model(); + let sign_raw_transaction = model.unwrap(); // The proves we did everything correctly. let json: SendRawTransaction = - node.client.send_raw_transaction(&model.tx).expect("sendrawtransaction"); - let res: Result = json.into_model(); - let _ = res.expect("SendRawTransaction into model"); + node.client.send_raw_transaction(&sign_raw_transaction.tx).expect("sendrawtransaction"); + let model: Result = json.into_model(); + model.unwrap(); } // Manipulates raw transactions. @@ -535,8 +542,8 @@ fn create_sign_with_key_send(node: &Node) { let json: CreateRawTransaction = node.client.create_raw_transaction(&inputs, &outputs).expect("createrawtransaction"); - let res: Result = json.clone().into_model(); - let _ = res.expect("CreateRawTransaction into model"); + let model: Result = json.clone().into_model(); + model.unwrap(); let tx = json.transaction().unwrap(); let json: DumpPrivKey = node.client.dump_priv_key(&addr).expect("dumpprivkey"); @@ -545,14 +552,14 @@ fn create_sign_with_key_send(node: &Node) { let json: SignRawTransaction = node.client.sign_raw_transaction_with_key(&tx, &[key]).expect("signrawtransactionwithkey"); - let res: Result = json.into_model(); - let model = res.expect("SignRawTransaction into model"); + let model: Result = json.into_model(); + let sign_raw_transaction = model.unwrap(); // The proves we did everything correctly. let json: SendRawTransaction = - node.client.send_raw_transaction(&model.tx).expect("sendrawtransaction"); - let res: Result = json.into_model(); - let _ = res.expect("SendRawTransaction into model"); + node.client.send_raw_transaction(&sign_raw_transaction.tx).expect("sendrawtransaction"); + let model: Result = json.into_model(); + model.unwrap(); } // Manipulates raw transactions. @@ -577,22 +584,25 @@ fn create_fund_sign_send(node: &Node) { let json: CreateRawTransaction = node.client.create_raw_transaction(&inputs, &outputs).expect("createrawtransaction"); - let res: Result = json.clone().into_model(); - let _ = res.expect("CreateRawTransaction 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 res: Result = json.clone().into_model(); - let _ = res.expect("FundRawTransaction into model"); + let model: Result = json.clone().into_model(); + model.unwrap(); let funded = json.transaction().unwrap(); // This method is from the wallet section. - let json = node.client.sign_raw_transaction_with_wallet(&funded).expect("signrawtransactionwithwallet"); - - // The proves we did everything correctly. - let model = json.into_model().expect("SignRawTransactionWithWallet into model"); - let _ = node.client.send_raw_transaction(&model.tx).expect("createrawtransaction"); + let json: SignRawTransaction = node + .client + .sign_raw_transaction_with_wallet(&funded) + .expect("signrawtransactionwithwallet"); + // 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"); } // Creates a transaction using client to do RPC call `create_raw_transaction`. @@ -624,8 +634,8 @@ fn create_a_raw_transaction(node: &Node) -> Transaction { let json: CreateRawTransaction = node.client.create_raw_transaction(&inputs, &outputs).expect("createrawtransaction"); - let res: Result = json.clone().into_model(); - let _ = res.expect("CreateRawTransaction into model"); + let model: Result = json.clone().into_model(); + model.unwrap(); json.transaction().unwrap() } @@ -692,7 +702,7 @@ fn create_a_psbt(node: &Node) -> bitcoin::Psbt { outputs.push(Output::new(change_address, change_amount)); let json: CreatePsbt = node.client.create_psbt(&inputs, &outputs).expect("createpsbt"); - let res: Result = json.clone().into_model(); - let psbt = res.expect("CreatePsbt into model"); + let model: Result = json.clone().into_model(); + let psbt = model.unwrap(); psbt.0 } diff --git a/integration_test/tests/util.rs b/integration_test/tests/util.rs index 2a6b09f4..6566c717 100644 --- a/integration_test/tests/util.rs +++ b/integration_test/tests/util.rs @@ -3,8 +3,9 @@ //! Tests for methods found under the `== Util ==` section of the API docs. #![allow(non_snake_case)] // Test names intentionally use double underscore. +#![allow(unused_imports)] // Because of feature gated tests. -use bitcoin::{PublicKey, PrivateKey}; +use bitcoin::{address, amount, sign_message, PublicKey, PrivateKey}; use integration_test::{Node, NodeExt as _, Wallet}; use node::vtype::*; use node::mtype; @@ -26,12 +27,12 @@ fn util__create_multisig__modelled() { .client .create_multisig(nrequired, vec![pubkey1, pubkey2]) .expect("createmultisig"); - let res: Result = json.into_model(); - let _ = res.expect("CreateMultisig into model"); + let model: Result = json.into_model(); + model.unwrap(); } -#[cfg(not(feature = "v17"))] #[test] +#[cfg(not(feature = "v17"))] fn util__derive_addresses__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); @@ -39,8 +40,8 @@ fn util__derive_addresses__modelled() { let descriptor = "pkh(02ff12471208c14bd580709cb2358d98975247d8765f92bc25eab3b2763ed605f8)#sf4k0g3u"; let json: DeriveAddresses = node.client.derive_addresses(descriptor).expect("deriveaddresses"); - let res: Result = json.into_model(); - let _ = res.expect("DeriveAddresses into model"); + let model: Result = json.into_model(); + model.unwrap(); // For v29 and above test a multipath descriptor. #[cfg(not(feature = "v28_and_below"))] @@ -51,8 +52,8 @@ fn util__derive_addresses__modelled() { let range = (0, 3); let json: DeriveAddressesMultipath = node.client.derive_addresses_multipath(multipath_descriptor, range) .expect("deriveaddresses"); - let res: Result = json.into_model(); - let derived = res.expect("DeriveAddressesMultipath into model"); + let model: Result = json.into_model(); + let derived = model.unwrap(); // Should return 2 `DeriveAddresses`, one for each derivation path (0 and 1). assert_eq!(derived.addresses.len(), 2); @@ -67,12 +68,12 @@ fn util__estimate_smart_fee__modelled() { node.fund_wallet(); let json: EstimateSmartFee = node.client.estimate_smart_fee(6).expect("estimatesmartfee"); - let res: Result = json.into_model(); - let _ = res.expect("EstimateSmartFee into model"); + let model: Result = json.into_model(); + model.unwrap(); } -#[cfg(not(feature = "v17"))] #[test] +#[cfg(not(feature = "v17"))] fn util__get_descriptor_info() { let node = Node::with_wallet(Wallet::Default, &[]); @@ -81,8 +82,8 @@ fn util__get_descriptor_info() { let _: GetDescriptorInfo = node.client.get_descriptor_info(descriptor).expect("getdescriptorinfo"); } -#[cfg(not(feature = "v20_and_below"))] #[test] +#[cfg(not(feature = "v20_and_below"))] fn util__get_index_info() { let node = Node::with_wallet(Wallet::Default, &["-txindex"]); let index_info: GetIndexInfo = node.client.get_index_info().expect("getindexinfo"); @@ -110,8 +111,9 @@ fn util__sign_message_with_priv_key__modelled() { .client .sign_message_with_privkey(&privkey, message) .expect("signmessagewithprivkey"); - let res: Result = json.into_model(); - let sig = res.expect("SignMessageWithPrivKey into model"); + let model: Result = + json.into_model(); + let sig = model.unwrap(); // Verify the message using the returned signature let verified: VerifyMessage = node @@ -128,8 +130,8 @@ fn util__validate_address__modelled() { let addr = node.client.new_address().expect("new_address"); let json: ValidateAddress = node.client.validate_address(&addr).expect("validateaddress"); - let res: Result = json.into_model(); - let _ = res.expect("ValidateAddress into model"); + let model: Result = json.into_model(); + model.unwrap(); } // This is tested in util__sign_message_with_priv_key__modelled() diff --git a/integration_test/tests/wallet.rs b/integration_test/tests/wallet.rs index 6e90f529..f52fd298 100644 --- a/integration_test/tests/wallet.rs +++ b/integration_test/tests/wallet.rs @@ -5,9 +5,9 @@ #![allow(non_snake_case)] // Test names intentionally use double underscore. #![allow(unused_imports)] // Some imports are only used in specific versions. -use bitcoin::address::{Address, KnownHrp, NetworkChecked}; +use bitcoin::address::{self, Address, KnownHrp, NetworkChecked}; use bitcoin::bip32::{Xpriv, Xpub}; -use bitcoin::{secp256k1, Amount, CompressedPublicKey, FeeRate, Network, PrivateKey, PublicKey}; +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 @@ -26,7 +26,7 @@ fn wallet__abandon_transaction() { let node = Node::with_wallet(Wallet::Default, &[]); let mining_addr = node.client.new_address().expect("newaddress"); - let json = 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]; @@ -156,7 +156,7 @@ fn wallet__create_wallet_descriptor() { let import_req = ImportDescriptorsRequest::new(descriptor, 0); node.client.import_descriptors(&[import_req]).expect("importdescriptors"); - let json = node.client.create_wallet_descriptor("bech32", &hdkey) + let json: CreateWalletDescriptor = node.client.create_wallet_descriptor("bech32", &hdkey) .expect("createwalletdescriptor"); // Check that a SigWit descriptor was created. @@ -174,10 +174,11 @@ fn wallet__dump_priv_key__modelled() { 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 = address.into_model().unwrap().0.assume_checked(); + let model: Result = address.into_model(); + let address = model.unwrap().0.assume_checked(); let json: DumpPrivKey = node.client.dump_priv_key(&address).expect("dumpprivkey"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); model.unwrap(); } @@ -187,7 +188,7 @@ fn wallet__dump_priv_key__modelled() { let address = node.client.new_address().expect("failed to get new address"); let json: DumpPrivKey = node.client.dump_priv_key(&address).expect("dumpprivkey"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); model.unwrap(); } } @@ -229,7 +230,7 @@ fn wallet__get_addresses_by_label__modelled() { 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 model: Result = json.into_model(); + let model: Result = json.into_model(); let map = model.unwrap(); // sanity checks. @@ -246,26 +247,26 @@ fn wallet__get_address_info__modelled() { let addr = node.client.new_address_with_label(label_name).unwrap().assume_checked(); let json: GetAddressInfo = node.client.get_address_info(&addr).expect("getaddressinfo legacy"); let model: Result = json.into_model(); - let model = model.unwrap(); - assert_eq!(model.address.assume_checked(), addr); - assert_eq!(model.labels[0], label_name); + let address_info = model.unwrap(); + assert_eq!(address_info.address.assume_checked(), addr); + assert_eq!(address_info.labels[0], label_name); // 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 model: Result = json.into_model(); - let model = model.unwrap(); - let embedded = model.embedded.unwrap(); - assert_eq!(model.address.assume_checked(), addr_p2sh); - assert_eq!(model.script.unwrap(), mtype::ScriptType::WitnessV0KeyHash); + let address_info = model.unwrap(); + let embedded = address_info.embedded.unwrap(); + assert_eq!(address_info.address.assume_checked(), addr_p2sh); + assert_eq!(address_info.script.unwrap(), mtype::ScriptType::WitnessV0KeyHash); assert!(embedded.address.is_valid_for_network(Network::Regtest)); // 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 model: Result = json.into_model(); - let model = model.unwrap(); - assert_eq!(model.address.assume_checked(), addr_bech32); + let address_info = model.unwrap(); + assert_eq!(address_info.address.assume_checked(), addr_bech32); } #[test] @@ -273,13 +274,14 @@ fn wallet__get_balance__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); let json: GetBalance = node.client.get_balance().expect("getbalance"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); model.unwrap(); // Check non-zero balance just for giggles. node.fund_wallet(); - let json = node.client.get_balance().expect("getbalance"); - json.into_model().unwrap(); + let json: GetBalance = node.client.get_balance().expect("getbalance"); + let model: Result = json.into_model(); + model.unwrap(); } #[test] @@ -289,7 +291,7 @@ fn wallet__get_balances() { node.fund_wallet(); let json: GetBalances = node.client.get_balances().expect("getbalances"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); model.unwrap(); } @@ -299,7 +301,7 @@ fn wallet__get_hd_keys__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); let json: GetHdKeys = node.client.get_hd_keys().expect("gethdkeys"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); let hdkey = model.unwrap().0; let descriptor_type = hdkey[0].descriptors[0].descriptor[..3].to_string(); @@ -323,7 +325,7 @@ fn wallet__get_new_address__modelled() { 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 model: Result = json.into_model(); + let model: Result = json.into_model(); model.unwrap(); } @@ -340,14 +342,14 @@ fn wallet__get_received_by_address__modelled() { node.mine_a_block(); let json: GetReceivedByAddress = node.client.get_received_by_address(&address).expect("getreceivedbyaddress"); - let model: Result = json.into_model(); - let model = model.unwrap(); + let model: Result = json.into_model(); + let received_by_address = model.unwrap(); - assert_eq!(model.0, amount); + assert_eq!(received_by_address.0, amount); } -#[cfg(not(feature = "v17"))] #[test] +#[cfg(not(feature = "v17"))] fn wallet__get_received_by_label__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); node.fund_wallet(); @@ -360,8 +362,9 @@ fn wallet__get_received_by_label__modelled() { node.mine_a_block(); let json: GetReceivedByLabel = node.client.get_received_by_label(label).expect("getreceivedbylabel"); - let model: Result = json.into_model(); - assert_eq!(model.unwrap().0, amount); + let model: Result = json.into_model(); + let received = model.unwrap(); + assert_eq!(received.0, amount); } #[test] @@ -386,7 +389,7 @@ fn wallet__get_transaction__modelled() { fn wallet__get_unconfirmed_balance__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); let json: GetUnconfirmedBalance = node.client.get_unconfirmed_balance().expect("getunconfirmedbalance"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); model.unwrap(); } @@ -540,7 +543,7 @@ fn wallet__list_address_groupings__modelled() { let json: ListAddressGroupings = node.client.list_address_groupings().expect("listaddressgroupings"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); let groupings = model.unwrap(); assert!(!groupings.0.is_empty()); @@ -557,8 +560,8 @@ fn wallet__list_labels__modelled() { assert!(json.0.iter().any(|s| s == label)); } -#[cfg(not(feature = "v17"))] #[test] +#[cfg(not(feature = "v17"))] fn wallet__list_received_by_label__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); node.fund_wallet(); @@ -572,8 +575,8 @@ fn wallet__list_received_by_label__modelled() { let json: ListReceivedByLabel = node.client.list_received_by_label().expect("listreceivedbylabel"); let model: Result = json.into_model(); - let model = model.unwrap(); - assert!(model.0.iter().any(|item| item.label == label)); + let received_by_label = model.unwrap(); + assert!(received_by_label.0.iter().any(|item| item.label == label)); } #[test] @@ -586,11 +589,11 @@ fn wallet__list_received_by_address__modelled() { node.mine_a_block(); let json: ListReceivedByAddress = node.client.list_received_by_address().expect("listreceivedbyaddress"); - let model: Result = json.into_model(); - let model = model.unwrap(); + let model: Result = json.into_model(); + let received_by_address = model.unwrap(); let unchecked_addr = address.as_unchecked(); - assert!(model.0.iter().any(|item| &item.address == unchecked_addr)); + assert!(received_by_address.0.iter().any(|item| &item.address == unchecked_addr)); } #[test] @@ -604,9 +607,9 @@ fn wallet__list_since_block__modelled() { let json: ListSinceBlock = node.client.list_since_block().expect("listsinceblock"); let model: Result = json.into_model(); - let model = model.unwrap(); + let list_since_block = model.unwrap(); - let first_tx: mtype::TransactionItem = model.transactions[0].clone(); + let first_tx: mtype::TransactionItem = list_since_block.transactions[0].clone(); assert_eq!(first_tx.txid.unwrap().to_string().len(), 64); } @@ -622,9 +625,9 @@ fn wallet__list_transactions__modelled() { let json: ListTransactions = node.client.list_transactions().expect("listtransactions"); let model: Result = json.into_model(); - let model = model.unwrap(); + let list_transactions = model.unwrap(); - let first_tx: mtype::TransactionItem = model.0[0].clone(); + let first_tx: mtype::TransactionItem = list_transactions.0[0].clone(); assert_eq!(first_tx.txid.unwrap().to_string().len(), 64); } @@ -756,16 +759,16 @@ fn wallet__list_lock_unspent__modelled() { node.fund_wallet(); let json: ListUnspent = node.client.list_unspent().expect("listunspent"); - let utxos = json.into_model().expect("listunspent into model"); + let utxos: mtype::ListUnspent = json.into_model().unwrap(); let txid = utxos.0[0].txid; let vout = utxos.0[0].vout; node.client.lock_unspent(&[(txid, vout)]).expect("lockunspent"); let json: ListLockUnspent = node.client.list_lock_unspent().expect("listlockunspent"); let model: Result = json.into_model(); - let model = model.unwrap(); + let lock_unspent = model.unwrap(); - assert!(model.0.iter().any(|o| o.txid == txid && o.vout == vout)); + assert!(lock_unspent.0.iter().any(|o| o.txid == txid && o.vout == vout)); } #[test] @@ -784,8 +787,8 @@ fn wallet__list_unspent__modelled() { model.unwrap(); } -#[cfg(not(feature = "v17"))] #[test] +#[cfg(not(feature = "v17"))] fn wallet__list_wallet_dir() { let wallet_name = "test-wallet"; let node = Node::with_wallet(Wallet::None, &[]); @@ -823,7 +826,7 @@ fn wallet__lock_unspent() { node.fund_wallet(); let json: ListUnspent = node.client.list_unspent().expect("listunspent"); - let utxos = json.into_model().expect("listunspent into model"); + let utxos: mtype::ListUnspent = json.into_model().unwrap(); let txid = utxos.0[0].txid; let vout = utxos.0[0].vout; @@ -834,8 +837,8 @@ fn wallet__lock_unspent() { assert!(unlocked.0, "unlock_unspent"); } -#[cfg(not(feature = "v23_and_below"))] #[test] +#[cfg(not(feature = "v23_and_below"))] fn wallet__migrate_wallet() { let node = Node::with_wallet(Wallet::None, &["-deprecatedrpc=create_bdb"]); let wallet_name = "legacy_wallet"; @@ -846,16 +849,16 @@ fn wallet__migrate_wallet() { assert_eq!(json.wallet_name, wallet_name); } -#[cfg(not(feature = "v22_and_below"))] #[test] +#[cfg(not(feature = "v22_and_below"))] fn wallet__new_keypool() { let node = Node::with_wallet(Wallet::None, &["-deprecatedrpc=create_bdb"]); node.client.create_legacy_wallet("legacy_wallet").expect("createlegacywallet"); let _: () = node.client.new_keypool().expect("newkeypool"); } -#[cfg(not(feature = "v20_and_below"))] #[test] +#[cfg(not(feature = "v20_and_below"))] fn wallet__psbt_bump_fee__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); let address = node.client.new_address().expect("failed to create new address"); @@ -897,15 +900,15 @@ fn wallet__rescan_blockchain__modelled() { let _ = node.client.generate_to_address(3, &mining_addr).expect("generatetoaddress"); let json: RescanBlockchain = node.client.rescan_blockchain().expect("rescanblockchain"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); let rescan = model.unwrap(); assert!(rescan.stop_height >= rescan.start_height); } // This is tested in `backup_and_restore_wallet()`, called by wallet__backup_wallet() -#[cfg(not(feature = "v22_and_below"))] #[test] +#[cfg(not(feature = "v22_and_below"))] fn wallet__restore_wallet() {} // This is tested in raw_transactions.rs `create_sign_send()`. @@ -930,7 +933,7 @@ fn wallet__send_many__modelled() { amounts.insert(addr2, Amount::from_sat(100_000)); let json: SendMany = node.client.send_many(amounts.clone()).expect("sendmany"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); model.unwrap(); #[cfg(not(feature = "v20_and_below"))] @@ -939,13 +942,14 @@ fn wallet__send_many__modelled() { .client .send_many_verbose(amounts) .expect("sendmany verbose"); - let model_verbose: Result = json_verbose.into_model(); + let model_verbose: Result = + json_verbose.into_model(); model_verbose.unwrap(); } } -#[cfg(not(feature = "v20_and_below"))] #[test] +#[cfg(not(feature = "v20_and_below"))] fn wallet__send__modelled() { use std::collections::BTreeMap; @@ -961,8 +965,8 @@ fn wallet__send__modelled() { model.unwrap(); } -#[cfg(not(feature = "v23_and_below"))] #[test] +#[cfg(not(feature = "v23_and_below"))] fn wallet__send_all__modelled() { let node = Node::with_wallet(Wallet::Default, &[]); node.fund_wallet(); @@ -981,7 +985,7 @@ fn wallet__send_to_address__modelled() { let json: SendToAddress = node.client.send_to_address(&address, Amount::from_sat(10_000)).expect("sendtddress"); - let model: Result = json.into_model(); + let model: Result = json.into_model(); model.unwrap(); } @@ -994,8 +998,8 @@ fn wallet__set_tx_fee() { assert!(json.0); } -#[cfg(not(feature = "v18_and_below"))] #[test] +#[cfg(not(feature = "v18_and_below"))] fn wallet__set_wallet_flag() { let node = Node::with_wallet(Wallet::Default, &[]); @@ -1035,12 +1039,12 @@ fn wallet__sign_message__modelled() { .client .sign_message(&address, message) .expect("signmessage"); - let res: Result = json.into_model(); - let _ = res.expect("SignMessage into model"); + let model: Result = json.into_model(); + model.unwrap(); } -#[cfg(not(feature = "v23_and_below"))] #[test] +#[cfg(not(feature = "v23_and_below"))] fn wallet__simulate_raw_transaction() { let node = Node::with_wallet(Wallet::Default, &[]); node.fund_wallet(); @@ -1071,11 +1075,11 @@ fn wallet__simulate_raw_transaction() { .simulate_raw_transaction(&rawtxs) .expect("simulaterawtransaction"); - let model: Result = json.into_model(); - let model = model.unwrap(); + let model: Result = json.into_model(); + let raw_transaction = model.unwrap(); // Should show a negative balance change since we're sending money - assert!(model.balance_change.is_negative()); + assert!(raw_transaction.balance_change.is_negative()); } #[test] @@ -1107,13 +1111,18 @@ fn wallet__wallet_process_psbt__modelled() { .client .wallet_create_funded_psbt(vec![], vec![outputs]) .expect("walletcreatefundedpsbt"); - let funded_psbt_model: mtype::WalletCreateFundedPsbt = funded_psbt.into_model().unwrap(); + let model: Result = + 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 model: Result = json.into_model(); + #[cfg(feature = "v25_and_below")] + type WalletProcessPsbtError = psbt::PsbtParseError; + + let model: Result = json.into_model(); let processed = model.unwrap(); assert_eq!(processed.psbt.inputs.len(), funded_psbt_model.psbt.inputs.len()); @@ -1171,8 +1180,8 @@ fn create_load_unload_wallet() { let _: LoadWallet = node.client.load_wallet(&wallet).expect("loadwallet"); } -#[cfg(not(feature = "v20_and_below"))] #[test] +#[cfg(not(feature = "v20_and_below"))] fn wallet__upgrade_wallet() { let node = Node::with_wallet(Wallet::Default, &[]); diff --git a/types/src/v17/mod.rs b/types/src/v17/mod.rs index cc1462b6..3381c020 100644 --- a/types/src/v17/mod.rs +++ b/types/src/v17/mod.rs @@ -294,3 +294,5 @@ pub use crate::psbt::{ RawTransaction, RawTransactionError, RawTransactionInput, RawTransactionInputError, RawTransactionOutput, RawTransactionOutputError, WitnessUtxo, WitnessUtxoError, }; +#[doc(inline)] +pub use crate::NumericError; diff --git a/types/src/v18/mod.rs b/types/src/v18/mod.rs index edffdfda..4f9f5673 100644 --- a/types/src/v18/mod.rs +++ b/types/src/v18/mod.rs @@ -277,8 +277,8 @@ pub use crate::v17::{ ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListTransactions, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, Logging, MapMempoolEntryError, MempoolAcceptance, MempoolEntryError, - MempoolEntryFees, MempoolEntryFeesError, PruneBlockchain, PsbtInput, PsbtOutput, PsbtScript, - RawTransaction, RawTransactionError, RawTransactionInput, RawTransactionOutput, + MempoolEntryFees, MempoolEntryFeesError, NumericError, PruneBlockchain, PsbtInput, PsbtOutput, + PsbtScript, RawTransaction, RawTransactionError, RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, Softfork, SoftforkReject, TestMempoolAccept, TransactionCategory, diff --git a/types/src/v19/mod.rs b/types/src/v19/mod.rs index b7a018a4..632bf087 100644 --- a/types/src/v19/mod.rs +++ b/types/src/v19/mod.rs @@ -272,13 +272,13 @@ pub use crate::v17::{ ListAddressGroupingsError, ListAddressGroupingsItem, ListBanned, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListTransactions, ListUnspentItemError, ListWallets, LoadWallet, - LockUnspent, Locked, Logging, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, SendRawTransaction, - SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SoftforkReject, TestMempoolAccept, - TransactionCategory, TransactionItem, TransactionItemError, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + LockUnspent, Locked, Logging, NumericError, PruneBlockchain, RawTransactionError, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TestMempoolAccept, TransactionCategory, TransactionItem, TransactionItemError, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }; #[doc(inline)] pub use crate::v18::{ diff --git a/types/src/v20/mod.rs b/types/src/v20/mod.rs index debec268..cd97f26e 100644 --- a/types/src/v20/mod.rs +++ b/types/src/v20/mod.rs @@ -266,13 +266,14 @@ pub use crate::{ GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, - ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, - RawTransactionError, RawTransactionInput, RawTransactionOutput, RescanBlockchain, - ScriptType, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, - SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, NumericError, + PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, + RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, + UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, + VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, + WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v21/mod.rs b/types/src/v21/mod.rs index 0b13a32e..397ea7a6 100644 --- a/types/src/v21/mod.rs +++ b/types/src/v21/mod.rs @@ -282,13 +282,13 @@ pub use crate::{ GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, - ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, - RawTransactionError, RawTransactionInput, RawTransactionOutput, RescanBlockchain, - ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, - SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, - TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, - VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, + ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, NumericError, + PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, + RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, + SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, + SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, + VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v22/mod.rs b/types/src/v22/mod.rs index 1e8fc424..303bc3d2 100644 --- a/types/src/v22/mod.rs +++ b/types/src/v22/mod.rs @@ -284,12 +284,13 @@ pub use crate::{ GetUnconfirmedBalance, GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, - LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + LoadWallet, LockUnspent, Locked, NumericError, PruneBlockchain, RawTransactionError, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v23/mod.rs b/types/src/v23/mod.rs index f6a090a8..57446d92 100644 --- a/types/src/v23/mod.rs +++ b/types/src/v23/mod.rs @@ -286,12 +286,13 @@ pub use crate::{ GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, - LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + LoadWallet, LockUnspent, Locked, NumericError, PruneBlockchain, RawTransactionError, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v24/mod.rs b/types/src/v24/mod.rs index 7557ecbc..cd73d6cb 100644 --- a/types/src/v24/mod.rs +++ b/types/src/v24/mod.rs @@ -285,12 +285,13 @@ pub use crate::{ GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, - LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + LoadWallet, LockUnspent, Locked, NumericError, PruneBlockchain, RawTransactionError, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v25/mod.rs b/types/src/v25/mod.rs index 6536f930..d515adc5 100644 --- a/types/src/v25/mod.rs +++ b/types/src/v25/mod.rs @@ -280,12 +280,13 @@ pub use crate::{ GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, - LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + LockUnspent, Locked, NumericError, PruneBlockchain, RawTransactionError, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v26/mod.rs b/types/src/v26/mod.rs index 4a9dddb7..87ddd437 100644 --- a/types/src/v26/mod.rs +++ b/types/src/v26/mod.rs @@ -273,6 +273,7 @@ pub use self::{ CreateWallet, GetBalances, GetBalancesError, GetTransaction, GetTransactionError, GetWalletInfo, GetWalletInfoError, GetWalletInfoScanning, LastProcessedBlock, LastProcessedBlockError, LoadWallet, UnloadWallet, WalletProcessPsbt, + WalletProcessPsbtError, }, }; #[doc(inline)] @@ -296,12 +297,13 @@ pub use crate::{ GetTxOutError, GetUnconfirmedBalance, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, - LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, + LockUnspent, Locked, NumericError, PruneBlockchain, RawTransactionError, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v27/mod.rs b/types/src/v27/mod.rs index 0adaaba9..5f19beb6 100644 --- a/types/src/v27/mod.rs +++ b/types/src/v27/mod.rs @@ -273,12 +273,13 @@ pub use crate::{ GetTxOutError, GetUnconfirmedBalance, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, - LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, + LockUnspent, Locked, NumericError, PruneBlockchain, RawTransactionError, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -331,5 +332,6 @@ pub use crate::{ LoadTxOutSet, LoadTxOutSetError, LoadWallet, Logging, PeerInfo, SubmitPackage, SubmitPackageError, SubmitPackageTxResult, SubmitPackageTxResultError, SubmitPackageTxResultFees, SubmitPackageTxResultFeesError, UnloadWallet, WalletProcessPsbt, + WalletProcessPsbtError, }, }; diff --git a/types/src/v28/mod.rs b/types/src/v28/mod.rs index 4c74f6e7..ece379ba 100644 --- a/types/src/v28/mod.rs +++ b/types/src/v28/mod.rs @@ -294,12 +294,13 @@ pub use crate::{ GetTxOutError, GetUnconfirmedBalance, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, - LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, + LockUnspent, Locked, NumericError, PruneBlockchain, RawTransactionError, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -348,6 +349,7 @@ pub use crate::{ GetTxOutSetInfo, GetTxOutSetInfoError, GetWalletInfo, GetWalletInfoError, GetWalletInfoScanning, LastProcessedBlock, LastProcessedBlockError, LoadTxOutSet, LoadTxOutSetError, LoadWallet, PeerInfo, UnloadWallet, WalletProcessPsbt, + WalletProcessPsbtError, }, v27::{GetPrioritisedTransactions, PrioritisedTransaction}, }; diff --git a/types/src/v29/mod.rs b/types/src/v29/mod.rs index 60524f1a..80cf7beb 100644 --- a/types/src/v29/mod.rs +++ b/types/src/v29/mod.rs @@ -290,12 +290,12 @@ pub use crate::{ GetTxOutError, GetUnconfirmedBalance, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, - LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WitnessUtxo, + LockUnspent, Locked, NumericError, PruneBlockchain, RawTransactionError, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, TransactionCategory, + UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, + VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -343,6 +343,7 @@ pub use crate::{ GetPeerInfo, GetTransactionError, GetTxOutSetInfo, GetTxOutSetInfoError, GetWalletInfo, GetWalletInfoError, GetWalletInfoScanning, LastProcessedBlock, LastProcessedBlockError, LoadTxOutSet, LoadTxOutSetError, LoadWallet, PeerInfo, UnloadWallet, WalletProcessPsbt, + WalletProcessPsbtError, }, v27::{GetPrioritisedTransactions, PrioritisedTransaction}, v28::{