From 371d4eca910b97101f00546bd87de9a501bce192 Mon Sep 17 00:00:00 2001 From: GideonBature Date: Tue, 13 May 2025 00:17:49 +0100 Subject: [PATCH 1/6] Implement scantxoutset method and test Split single return type to three types Rename some fields for readability Rename some fields for readability --- client/src/client_sync/v17/blockchain.rs | 25 +++++++- client/src/client_sync/v17/mod.rs | 1 + client/src/client_sync/v18/mod.rs | 1 + client/src/client_sync/v19/mod.rs | 1 + client/src/client_sync/v20/mod.rs | 1 + client/src/client_sync/v21/mod.rs | 1 + client/src/client_sync/v22/mod.rs | 1 + client/src/client_sync/v23/mod.rs | 1 + client/src/client_sync/v24/mod.rs | 1 + client/src/client_sync/v25/mod.rs | 1 + client/src/client_sync/v26/mod.rs | 1 + client/src/client_sync/v27/mod.rs | 1 + client/src/client_sync/v28/mod.rs | 2 + client/src/client_sync/v29/mod.rs | 4 +- integration_test/tests/blockchain.rs | 30 ++++++++- types/src/model/blockchain.rs | 39 +++++++++++ types/src/model/mod.rs | 4 +- types/src/v17/blockchain/error.rs | 64 +++++++++++++++++++ types/src/v17/blockchain/into.rs | 47 +++++++++++++- types/src/v17/blockchain/mod.rs | 39 +++++++++++ types/src/v17/mod.rs | 5 +- types/src/v18/blockchain/into.rs | 53 ++++++++++++++- types/src/v18/blockchain/mod.rs | 35 +++++++++- types/src/v18/mod.rs | 7 +- types/src/v19/blockchain/into.rs | 53 ++++++++++++++- types/src/v19/blockchain/mod.rs | 44 ++++++++++++- types/src/v19/mod.rs | 6 +- types/src/v20/mod.rs | 6 +- types/src/v21/mod.rs | 6 +- types/src/v22/mod.rs | 6 +- types/src/v23/mod.rs | 6 +- types/src/v24/mod.rs | 6 +- types/src/v25/blockchain/into.rs | 54 +++++++++++++++- types/src/v25/blockchain/mod.rs | 46 ++++++++++++- types/src/v25/mod.rs | 4 +- types/src/v26/mod.rs | 4 +- types/src/v27/mod.rs | 4 +- types/src/v28/blockchain/into.rs | 53 +++++++++++++++ .../v28/{blockchain.rs => blockchain/mod.rs} | 53 ++++++++++++++- types/src/v28/mod.rs | 6 +- types/src/v29/mod.rs | 5 +- 41 files changed, 678 insertions(+), 49 deletions(-) create mode 100644 types/src/v28/blockchain/into.rs rename types/src/v28/{blockchain.rs => blockchain/mod.rs} (71%) diff --git a/client/src/client_sync/v17/blockchain.rs b/client/src/client_sync/v17/blockchain.rs index 810fa19b..413930a0 100644 --- a/client/src/client_sync/v17/blockchain.rs +++ b/client/src/client_sync/v17/blockchain.rs @@ -318,7 +318,30 @@ macro_rules! impl_client_v17__save_mempool { }; } -/// Implements Bitcoin Core JSON-RPC API method `verifychain`. +/// Implements Bitcoin Core JSON-RPC API method `scantxoutset` +#[macro_export] +macro_rules! impl_client_v17__scan_tx_out_set { + () => { + impl Client { + /// Aborts an ongoing `scantxoutset` scan. + pub fn scan_tx_out_set_abort(&self) -> Result { + self.call("scantxoutset", &[into_json("abort")?]) + } + + /// Starts a scan of the UTXO set for specified descriptors. + pub fn scan_tx_out_set_start(&self, scan_objects: &[&str]) -> Result { + self.call("scantxoutset", &[into_json("start")?, into_json(scan_objects)?]) + } + + /// Checks the status of an ongoing `scantxoutset` scan. + pub fn scan_tx_out_set_status(&self) -> Result> { + self.call("scantxoutset", &[into_json("status")?]) + } + } + }; +} + +/// Implements Bitcoin Core JSON-RPC API method `verifychain` #[macro_export] macro_rules! impl_client_v17__verify_chain { () => { diff --git a/client/src/client_sync/v17/mod.rs b/client/src/client_sync/v17/mod.rs index 7921840d..a88a39fc 100644 --- a/client/src/client_sync/v17/mod.rs +++ b/client/src/client_sync/v17/mod.rs @@ -50,6 +50,7 @@ crate::impl_client_v17__get_tx_out_set_info!(); crate::impl_client_v17__precious_block!(); crate::impl_client_v17__prune_blockchain!(); crate::impl_client_v17__save_mempool!(); +crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); diff --git a/client/src/client_sync/v18/mod.rs b/client/src/client_sync/v18/mod.rs index 73a4f048..da52e102 100644 --- a/client/src/client_sync/v18/mod.rs +++ b/client/src/client_sync/v18/mod.rs @@ -54,6 +54,7 @@ crate::impl_client_v17__get_tx_out_set_info!(); crate::impl_client_v17__precious_block!(); crate::impl_client_v17__prune_blockchain!(); crate::impl_client_v17__save_mempool!(); +crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); diff --git a/client/src/client_sync/v19/mod.rs b/client/src/client_sync/v19/mod.rs index 8bed0e35..bd157996 100644 --- a/client/src/client_sync/v19/mod.rs +++ b/client/src/client_sync/v19/mod.rs @@ -50,6 +50,7 @@ crate::impl_client_v17__get_tx_out_set_info!(); crate::impl_client_v17__precious_block!(); crate::impl_client_v17__prune_blockchain!(); crate::impl_client_v17__save_mempool!(); +crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); diff --git a/client/src/client_sync/v20/mod.rs b/client/src/client_sync/v20/mod.rs index 067caf4c..85c2823a 100644 --- a/client/src/client_sync/v20/mod.rs +++ b/client/src/client_sync/v20/mod.rs @@ -49,6 +49,7 @@ crate::impl_client_v17__get_tx_out_set_info!(); crate::impl_client_v17__precious_block!(); crate::impl_client_v17__prune_blockchain!(); crate::impl_client_v17__save_mempool!(); +crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); diff --git a/client/src/client_sync/v21/mod.rs b/client/src/client_sync/v21/mod.rs index 029a1c94..b42c1a0c 100644 --- a/client/src/client_sync/v21/mod.rs +++ b/client/src/client_sync/v21/mod.rs @@ -53,6 +53,7 @@ crate::impl_client_v17__get_tx_out_set_info!(); crate::impl_client_v17__precious_block!(); crate::impl_client_v17__prune_blockchain!(); crate::impl_client_v17__save_mempool!(); +crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); diff --git a/client/src/client_sync/v22/mod.rs b/client/src/client_sync/v22/mod.rs index 75658cb4..232c6020 100644 --- a/client/src/client_sync/v22/mod.rs +++ b/client/src/client_sync/v22/mod.rs @@ -51,6 +51,7 @@ crate::impl_client_v17__get_tx_out_set_info!(); crate::impl_client_v17__precious_block!(); crate::impl_client_v17__prune_blockchain!(); crate::impl_client_v17__save_mempool!(); +crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); diff --git a/client/src/client_sync/v23/mod.rs b/client/src/client_sync/v23/mod.rs index f6bed4b9..2c732756 100644 --- a/client/src/client_sync/v23/mod.rs +++ b/client/src/client_sync/v23/mod.rs @@ -54,6 +54,7 @@ crate::impl_client_v17__get_tx_out_set_info!(); crate::impl_client_v17__precious_block!(); crate::impl_client_v17__prune_blockchain!(); crate::impl_client_v23__save_mempool!(); +crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); diff --git a/client/src/client_sync/v24/mod.rs b/client/src/client_sync/v24/mod.rs index 427250df..3e3e162a 100644 --- a/client/src/client_sync/v24/mod.rs +++ b/client/src/client_sync/v24/mod.rs @@ -55,6 +55,7 @@ crate::impl_client_v24__get_tx_spending_prevout!(); crate::impl_client_v17__precious_block!(); crate::impl_client_v17__prune_blockchain!(); crate::impl_client_v23__save_mempool!(); +crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); diff --git a/client/src/client_sync/v25/mod.rs b/client/src/client_sync/v25/mod.rs index d4fa9aca..ed78e40d 100644 --- a/client/src/client_sync/v25/mod.rs +++ b/client/src/client_sync/v25/mod.rs @@ -56,6 +56,7 @@ crate::impl_client_v17__precious_block!(); crate::impl_client_v17__prune_blockchain!(); crate::impl_client_v23__save_mempool!(); crate::impl_client_v25__scan_blocks!(); +crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); diff --git a/client/src/client_sync/v26/mod.rs b/client/src/client_sync/v26/mod.rs index d06fefc7..45612d3d 100644 --- a/client/src/client_sync/v26/mod.rs +++ b/client/src/client_sync/v26/mod.rs @@ -62,6 +62,7 @@ crate::impl_client_v17__precious_block!(); crate::impl_client_v17__prune_blockchain!(); crate::impl_client_v23__save_mempool!(); crate::impl_client_v25__scan_blocks!(); +crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); diff --git a/client/src/client_sync/v27/mod.rs b/client/src/client_sync/v27/mod.rs index c924ab49..f5598365 100644 --- a/client/src/client_sync/v27/mod.rs +++ b/client/src/client_sync/v27/mod.rs @@ -56,6 +56,7 @@ crate::impl_client_v17__precious_block!(); crate::impl_client_v17__prune_blockchain!(); crate::impl_client_v23__save_mempool!(); crate::impl_client_v25__scan_blocks!(); +crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); diff --git a/client/src/client_sync/v28/mod.rs b/client/src/client_sync/v28/mod.rs index 881758d9..625b7166 100644 --- a/client/src/client_sync/v28/mod.rs +++ b/client/src/client_sync/v28/mod.rs @@ -59,9 +59,11 @@ crate::impl_client_v17__precious_block!(); crate::impl_client_v17__prune_blockchain!(); crate::impl_client_v23__save_mempool!(); crate::impl_client_v25__scan_blocks!(); +crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); + // == Control == crate::impl_client_v17__get_memory_info!(); crate::impl_client_v18__get_rpc_info!(); diff --git a/client/src/client_sync/v29/mod.rs b/client/src/client_sync/v29/mod.rs index 16160bbb..ebccaac0 100644 --- a/client/src/client_sync/v29/mod.rs +++ b/client/src/client_sync/v29/mod.rs @@ -20,7 +20,8 @@ use crate::types::v29::*; #[rustfmt::skip] // Keep public re-exports separate. pub use crate::client_sync::{ - v17::{AddNodeCommand, ImportMultiRequest, ImportMultiScriptPubKey, ImportMultiTimestamp, Input, Output, SetBanCommand, WalletCreateFundedPsbtInput,}, + v17::{AddNodeCommand, ImportMultiRequest, ImportMultiScriptPubKey, ImportMultiTimestamp, Input, Output, SetBanCommand, WalletCreateFundedPsbtInput + }, v21::ImportDescriptorsRequest, v23::AddressType, }; @@ -59,6 +60,7 @@ crate::impl_client_v17__precious_block!(); crate::impl_client_v17__prune_blockchain!(); crate::impl_client_v23__save_mempool!(); crate::impl_client_v25__scan_blocks!(); +crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); diff --git a/integration_test/tests/blockchain.rs b/integration_test/tests/blockchain.rs index cfe97f85..7ecb51e4 100644 --- a/integration_test/tests/blockchain.rs +++ b/integration_test/tests/blockchain.rs @@ -489,7 +489,6 @@ fn blockchain__savemempool() { #[cfg(not(feature = "v24_and_below"))] fn blockchain__scan_blocks_modelled() { let node = Node::with_wallet(Wallet::None, &["-blockfilterindex=1"]); - // Arbitrary scan descriptor let scan_desc = "pkh(022afc20bf379bc96a2f4e9e63ffceb8652b2b6a097f63fbee6ecec2a49a48010e)"; @@ -503,6 +502,35 @@ fn blockchain__scan_blocks_modelled() { let _: ScanBlocksAbort = node.client.scan_blocks_abort().expect("scanblocks abort"); } +#[test] +fn blockchain__scan_tx_out_set_modelled() { + let node = match () { + #[cfg(feature = "v21_and_below")] + () => Node::with_wallet(Wallet::None, &[]), + #[cfg(not(feature = "v21_and_below"))] + () => Node::with_wallet(Wallet::None, &["-coinstatsindex=1"]) + }; + + let dummy_pubkey_hex = "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"; + let scan_desc = format!("pkh({})", dummy_pubkey_hex); + + let json: ScanTxOutSetStart = node.client.scan_tx_out_set_start(&[&scan_desc]).expect("scantxoutset start"); + + let _: Option = node.client.scan_tx_out_set_status().expect("scantxoutset status"); + + let model: Result = json.into_model(); + model.unwrap(); + + let _: ScanTxOutSetAbort = node.client.scan_tx_out_set_abort().expect("scantxoutset abort"); +} + +#[test] +fn blockchain__verify_tx_out_proof__modelled() { + let node = Node::with_wallet(Wallet::Default, &[]); + node.fund_wallet(); + verify_tx_out_proof(&node).unwrap(); +} + #[test] fn blockchain__verify_chain() { let node = Node::with_wallet(Wallet::None, &[]); diff --git a/types/src/model/blockchain.rs b/types/src/model/blockchain.rs index 852dab49..27834c8f 100644 --- a/types/src/model/blockchain.rs +++ b/types/src/model/blockchain.rs @@ -770,3 +770,42 @@ pub struct WaitForNewBlock { /// Block height. pub height: u32, } + +/// Models the result of the JSON-RPC method `scantxoutset` start. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +pub struct ScanTxOutSetStart { + /// Whether the scan is completed. For v19 onwards. + pub success: Option, + /// The number of unspent transaction outputs scanned. For v19 onwards. + pub txouts: Option, + /// The current block height (index). For v19 onwards. + pub height: Option, + /// The hash of the block at the tip of the chain. For v19 onwards. + pub bestblock: Option, + /// The unspents + pub unspents: Vec, + /// The total amount of all found unspent outputs in BTC + pub total_amount: Amount, +} + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +pub struct ScanTxOutSetUnspent { + /// The transaction id + pub txid: Txid, + /// The vout value + pub vout: u32, + /// The script key + pub script_pubkey: ScriptBuf, + /// An output descriptor. For v18 onwards. + pub desc: Option, + /// The total amount in BTC of unspent output + pub amount: Amount, + /// Whether this is a coinbase output. For v25 onwards. + pub coinbase: Option, + /// Height of the unspent transaction output + pub height: u64, + /// Blockhash of the unspent transaction output. For v28 onwards. + pub blockhash: Option, + /// Number of confirmations of the unspent transaction output when the scan was done. For v28 onwards. + pub confirmations: Option, +} diff --git a/types/src/model/mod.rs b/types/src/model/mod.rs index 189b4ca2..d9cf9f9a 100644 --- a/types/src/model/mod.rs +++ b/types/src/model/mod.rs @@ -34,8 +34,8 @@ pub use self::{ GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, GetRawMempool, GetRawMempoolVerbose, GetTxOut, GetTxOutSetInfo, GetTxSpendingPrevout, GetTxSpendingPrevoutItem, LoadTxOutSet, MempoolEntry, MempoolEntryFees, ReceiveActivity, - ScanBlocksStart, Softfork, SoftforkType, SpendActivity, VerifyTxOutProof, WaitForBlock, - WaitForBlockHeight, WaitForNewBlock, + ScanBlocksStart, ScanTxOutSetStart, ScanTxOutSetUnspent, Softfork, SoftforkType, + SpendActivity, VerifyTxOutProof, WaitForBlock, WaitForBlockHeight, WaitForNewBlock, }, generating::{Generate, GenerateBlock, GenerateToAddress, GenerateToDescriptor}, mining::{ diff --git a/types/src/v17/blockchain/error.rs b/types/src/v17/blockchain/error.rs index 1edcd08d..8d371e59 100644 --- a/types/src/v17/blockchain/error.rs +++ b/types/src/v17/blockchain/error.rs @@ -522,3 +522,67 @@ impl std::error::Error for GetTxOutSetInfoError { impl From for GetTxOutSetInfoError { fn from(e: NumericError) -> Self { Self::Numeric(e) } } + +/// Error that can occur when converting the result of the `scantxoutset` +/// RPC method into the strongly typed `ScanTxOutSet` model. +#[derive(Debug)] +pub enum ScanTxOutSetError { + /// Failed to parse the `bestblock` field (a block hash) from a hex string. + BestBlockHash(hex::HexToArrayError), + /// Failed to parse the `blockhash` field (per unspent) from a hex string. + BlockHash(hex::HexToArrayError), + /// Failed to parse the `txid` field from a hex string. + Txid(hex::HexToArrayError), + /// Failed to parse the `scriptPubKey` field from hex string into script bytes. + ScriptPubKey(hex::HexToBytesError), + /// Failed to convert the `total_amount` field to a valid Bitcoin amount. + TotalAmount(amount::ParseAmountError), + /// Failed to convert an `amount` field in an unspent output to a valid Bitcoin amount. + Amount(amount::ParseAmountError), + /// A numeric field could not be converted to the expected Rust numeric type. + Numeric(NumericError), +} + +impl fmt::Display for ScanTxOutSetError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + use ScanTxOutSetError::*; + + match self { + BestBlockHash(e) => + write_err!(f, "conversion of the `bestblock` field failed"; e), + BlockHash(e) => + write_err!(f, "conversion of the `blockhash` field failed"; e), + Txid(e) => + write_err!(f, "conversion of the `txid` field failed"; e), + ScriptPubKey(e) => + write_err!(f, "conversion of the `scriptPubKey` field failed"; e), + TotalAmount(e) => + write_err!(f, "conversion of the `total_amount` field failed"; e), + Amount(e) => + write_err!(f, "conversion of the `amount` field failed"; e), + Numeric(e) => + write_err!(f, "numeric"; e), + } + } +} + +#[cfg(feature = "std")] +impl std::error::Error for ScanTxOutSetError { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + use ScanTxOutSetError::*; + + match self { + BestBlockHash(e) => Some(e), + BlockHash(e) => Some(e), + Txid(e) => Some(e), + ScriptPubKey(e) => Some(e), + TotalAmount(e) => Some(e), + Amount(e) => Some(e), + Numeric(e) => Some(e), + } + } +} + +impl From for ScanTxOutSetError { + fn from(e: NumericError) -> Self { Self::Numeric(e) } +} diff --git a/types/src/v17/blockchain/into.rs b/types/src/v17/blockchain/into.rs index c9bdf839..943598f3 100644 --- a/types/src/v17/blockchain/into.rs +++ b/types/src/v17/blockchain/into.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: CC0-1.0 use bitcoin::consensus::encode; -use bitcoin::{block, hex, Block, BlockHash, CompactTarget, Txid, Weight, Work}; +use bitcoin::{block, hex, Block, BlockHash, CompactTarget, Txid, Weight, Work, ScriptBuf}; // TODO: Use explicit imports? use super::*; @@ -552,6 +552,51 @@ impl GetTxOutSetInfo { } } +impl ScanTxOutSetStart { + pub fn into_model(self) -> Result { + use ScanTxOutSetError as E; + + let unspents = self + .unspents + .into_iter() + .map(|u| u.into_model()) + .collect::, _>>()?; + + let total_amount = Amount::from_btc(self.total_amount).map_err(E::TotalAmount)?; + + Ok(model::ScanTxOutSetStart { + success: None, + txouts: None, + height: None, + bestblock: None, + unspents, + total_amount, + }) + } +} + +impl ScanTxOutSetUnspent { + pub fn into_model(self) -> Result { + use ScanTxOutSetError as E; + + let txid = self.txid.parse::().map_err(E::Txid)?; + let amount = Amount::from_btc(self.amount).map_err(E::Amount)?; + let script_pubkey = ScriptBuf::from_hex(&self.script_pubkey).map_err(E::ScriptPubKey)?; + + Ok(model::ScanTxOutSetUnspent { + txid, + vout: self.vout, + script_pubkey, + desc: None, + amount, + coinbase: None, + height: self.height, + blockhash: None, + confirmations: None, + }) + } +} + impl VerifyTxOutProof { /// Converts version specific type to a version nonspecific, more strongly typed type. pub fn into_model(self) -> Result { diff --git a/types/src/v17/blockchain/mod.rs b/types/src/v17/blockchain/mod.rs index cdebb87d..6c561a58 100644 --- a/types/src/v17/blockchain/mod.rs +++ b/types/src/v17/blockchain/mod.rs @@ -679,6 +679,45 @@ pub struct PruneBlockchain( pub i64, ); +/// Result of JSON-RPC method `scantxoutset`. +/// +/// > scantxoutset "action" ( [scanobjects,...] ) +/// > +/// > Arguments: +/// > 1. "action" (string, required) The action to execute +/// > 2. "scanobjects" (array, required) Array of scan objects +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +pub struct ScanTxOutSetStart { + /// The unspents + pub unspents: Vec, + /// The total amount of all found unspent outputs in BTC + pub total_amount: f64, +} + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +pub struct ScanTxOutSetAbort(pub bool); + +#[derive(Deserialize, Debug, Clone, PartialEq)] +pub struct ScanTxOutSetStatus { + /// Approximate percent complete + pub progress: f64, +} + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +pub struct ScanTxOutSetUnspent { + /// The transaction id + pub txid: String, + /// The vout value + pub vout: u32, + /// The script key + #[serde(rename = "scriptPubKey")] + pub script_pubkey: String, + /// The total amount in BTC of unspent output + pub amount: f64, + /// Height of the unspent transaction output + pub height: u64, +} + /// Result of JSON-RPC method `verifychain`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] #[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] diff --git a/types/src/v17/mod.rs b/types/src/v17/mod.rs index bd6ab153..569d2e84 100644 --- a/types/src/v17/mod.rs +++ b/types/src/v17/mod.rs @@ -47,8 +47,8 @@ //! | preciousblock | returns nothing | | //! | pruneblockchain | version | | //! | savemempool | returns nothing | | -//! | scantxoutset | omitted | API marked as experimental | //! | verifychain | version | | +//! | scantxoutset | version + model | API marked as experimental | //! | verifytxoutproof | version + model | | //! //! @@ -244,7 +244,8 @@ pub use self::{ GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, GetMempoolInfoError, GetRawMempool, GetRawMempoolVerbose, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, MapMempoolEntryError, MempoolEntry, MempoolEntryError, - MempoolEntryFees, MempoolEntryFeesError, PruneBlockchain, Softfork, SoftforkReject, + MempoolEntryFees, MempoolEntryFeesError, PruneBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, + ScanTxOutSetStart, ScanTxOutSetStatus, ScanTxOutSetUnspent, Softfork, SoftforkReject, VerifyChain, VerifyTxOutProof, }, control::{GetMemoryInfoStats, Locked, Logging}, diff --git a/types/src/v18/blockchain/into.rs b/types/src/v18/blockchain/into.rs index 2fb6d06d..2148c795 100644 --- a/types/src/v18/blockchain/into.rs +++ b/types/src/v18/blockchain/into.rs @@ -2,13 +2,15 @@ use alloc::collections::BTreeMap; -use bitcoin::{hex, Txid, Wtxid}; +use bitcoin::{Amount, hex, ScriptBuf, Txid, Wtxid}; use super::{ GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetRawMempool, GetRawMempoolVerbose, - MapMempoolEntryError, MempoolEntry, MempoolEntryError, + MapMempoolEntryError, MempoolEntry, MempoolEntryError, ScanTxOutSetError, + ScanTxOutSetStart, ScanTxOutSetUnspent, }; + use crate::model; impl GetMempoolAncestors { @@ -134,3 +136,50 @@ impl GetRawMempoolVerbose { Ok(model::GetRawMempoolVerbose(map)) } } + +impl ScanTxOutSetStart { + /// Converts version specific type to a version nonspecific, more strongly typed type. + pub fn into_model(self) -> Result { + use ScanTxOutSetError as E; + + let unspents = self + .unspents + .into_iter() + .map(|u| u.into_model()) + .collect::, _>>()?; + + let total_amount = Amount::from_btc(self.total_amount).map_err(E::TotalAmount)?; + + Ok(model::ScanTxOutSetStart { + success: None, + txouts: None, + height: None, + bestblock: None, + unspents, + total_amount, + }) + } +} + +impl ScanTxOutSetUnspent { + /// Converts version specific type to a version nonspecific, more strongly typed type. + pub fn into_model(self) -> Result { + use ScanTxOutSetError as E; + + let txid = self.txid.parse::().map_err(E::Txid)?; + let amount = Amount::from_btc(self.amount).map_err(E::Amount)?; + let script_pubkey = ScriptBuf::from_hex(&self.script_pubkey).map_err(E::ScriptPubKey)?; + + Ok(model::ScanTxOutSetUnspent { + txid, + vout: self.vout, + script_pubkey, + desc: Some(self.descriptor), + amount, + coinbase: None, + height: self.height, + blockhash: None, + confirmations: None, + }) + } +} diff --git a/types/src/v18/blockchain/mod.rs b/types/src/v18/blockchain/mod.rs index f288164c..4c82eaf8 100644 --- a/types/src/v18/blockchain/mod.rs +++ b/types/src/v18/blockchain/mod.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; use serde::{Deserialize, Serialize}; -use super::{MapMempoolEntryError, MempoolEntryError, MempoolEntryFees}; +use super::{MapMempoolEntryError, MempoolEntryError, MempoolEntryFees, ScanTxOutSetError}; /// Result of JSON-RPC method `getmempoolancestors` with verbose set to `false`. /// @@ -127,3 +127,36 @@ pub struct GetRawMempool(pub Vec); #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] #[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetRawMempoolVerbose(pub BTreeMap); + +/// Result of JSON-RPC method `scantxoutset`. +/// +/// > scantxoutset "action" ( [scanobjects,...] ) +/// > +/// > Arguments: +/// > 1. "action" (string, required) The action to execute +/// > 2. "scanobjects" (array, required) Array of scan objects +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +pub struct ScanTxOutSetStart { + /// The unspents + pub unspents: Vec, + /// The total amount of all found unspent outputs in BTC + pub total_amount: f64, +} + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +pub struct ScanTxOutSetUnspent { + /// The transaction id + pub txid: String, + /// The vout value + pub vout: u32, + /// The script key + #[serde(rename = "scriptPubKey")] + pub script_pubkey: String, + /// A specialized descriptor for the matched scriptPubKey + #[serde(rename = "desc")] + pub descriptor: String, + /// The total amount in BTC of unspent output + pub amount: f64, + /// Height of the unspent transaction output + pub height: u64, +} diff --git a/types/src/v18/mod.rs b/types/src/v18/mod.rs index 45c60d87..46cbb384 100644 --- a/types/src/v18/mod.rs +++ b/types/src/v18/mod.rs @@ -47,8 +47,9 @@ //! | preciousblock | returns nothing | | //! | pruneblockchain | version | | //! | savemempool | returns nothing | | -//! | scantxoutset | omitted | API marked as experimental | //! | verifychain | version | | +//! | scantxoutset | version + model | API marked as experimental | +//! | verifychain | returns boolean | | //! | verifytxoutproof | version + model | | //! //! @@ -236,7 +237,7 @@ pub use self::{ blockchain::{ GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetRawMempool, GetRawMempoolVerbose, - MempoolEntry, + MempoolEntry, ScanTxOutSetStart, ScanTxOutSetUnspent, }, control::{ActiveCommand, GetRpcInfo}, network::{GetNodeAddresses, GetPeerInfo, NodeAddress, PeerInfo}, @@ -290,5 +291,5 @@ pub use crate::v17::{ ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, WitnessUtxoError, + WitnessUtxo, WitnessUtxoError, ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, }; diff --git a/types/src/v19/blockchain/into.rs b/types/src/v19/blockchain/into.rs index 6dca9877..0de28194 100644 --- a/types/src/v19/blockchain/into.rs +++ b/types/src/v19/blockchain/into.rs @@ -3,7 +3,7 @@ use std::collections::BTreeMap; use bitcoin::hex::{self, FromHex as _}; -use bitcoin::{bip158, Amount, BlockHash, Network, Txid, Work, Wtxid}; +use bitcoin::{bip158, Amount, BlockHash, Network, ScriptBuf, Txid, Work, Wtxid}; use super::error::{ GetBlockFilterError, GetBlockchainInfoError, MapMempoolEntryError, MempoolEntryError, @@ -13,7 +13,7 @@ use super::{ GetBlockFilter, GetBlockchainInfo, GetChainTxStats, GetChainTxStatsError, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, GetMempoolInfoError, GetRawMempool, GetRawMempoolVerbose, - MempoolEntry, MempoolEntryFees, + MempoolEntry, MempoolEntryFees, ScanTxOutSetError, ScanTxOutSetStart, ScanTxOutSetUnspent, }; use crate::model; @@ -262,3 +262,52 @@ impl GetRawMempoolVerbose { Ok(model::GetRawMempoolVerbose(map)) } } + +impl ScanTxOutSetStart { + /// Converts version specific type to a version nonspecific, more strongly typed type. + pub fn into_model(self) -> Result { + use ScanTxOutSetError as E; + + let bestblock = self.best_block.parse::().map_err(E::BestBlockHash)?; + + let unspents = self + .unspents + .into_iter() + .map(|u| u.into_model()) + .collect::, _>>()?; + + let total_amount = Amount::from_btc(self.total_amount).map_err(E::TotalAmount)?; + + Ok(model::ScanTxOutSetStart { + success: Some(self.success), + txouts: Some(self.txouts), + height: Some(self.height), + bestblock: Some(bestblock), + unspents, + total_amount, + }) + } +} + +impl ScanTxOutSetUnspent { + /// Converts version specific type to a version nonspecific, more strongly typed type. + pub fn into_model(self) -> Result { + use ScanTxOutSetError as E; + + let txid = self.txid.parse::().map_err(E::Txid)?; + let amount = Amount::from_btc(self.amount).map_err(E::Amount)?; + let script_pubkey = ScriptBuf::from_hex(&self.script_pubkey).map_err(E::ScriptPubKey)?; + + Ok(model::ScanTxOutSetUnspent { + txid, + vout: self.vout, + script_pubkey, + desc: Some(self.descriptor), + amount, + coinbase: None, + height: self.height, + blockhash: None, + confirmations: None, + }) + } +} diff --git a/types/src/v19/blockchain/mod.rs b/types/src/v19/blockchain/mod.rs index ac757941..971c0648 100644 --- a/types/src/v19/blockchain/mod.rs +++ b/types/src/v19/blockchain/mod.rs @@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize}; // TODO: Remove wildcard, use explicit types. pub use self::error::*; -use super::{GetChainTxStatsError, GetMempoolInfoError}; +use super::{GetChainTxStatsError, GetMempoolInfoError, ScanTxOutSetError}; /// Result of JSON-RPC method `getblockchaininfo`. /// @@ -358,3 +358,45 @@ pub struct GetRawMempool(pub Vec); #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] #[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetRawMempoolVerbose(pub BTreeMap); + +/// Result of JSON-RPC method `scantxoutset`. +/// +/// > scantxoutset "action" ( [scanobjects,...] ) +/// > +/// > Arguments: +/// > 1. action (string, required) The action to execute +/// 2. scanobjects (json array, required) Array of scan objects +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +pub struct ScanTxOutSetStart { + /// Whether the scan is completed + pub success: bool, + /// The number of unspent transaction outputs scanned + pub txouts: u64, + /// The current block height (index) + pub height: u64, + /// The hash of the block at the tip of the chain + #[serde(rename = "bestblock")] + pub best_block: String, + /// The unspents + pub unspents: Vec, + /// The total amount of all found unspent outputs in BTC + pub total_amount: f64, +} + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +pub struct ScanTxOutSetUnspent { + /// The transaction id + pub txid: String, + /// The vout value + pub vout: u32, + /// The script key + #[serde(rename = "scriptPubKey")] + pub script_pubkey: String, + /// An output descriptor + #[serde(rename = "desc")] + pub descriptor: String, + /// The total amount in BTC of unspent output + pub amount: f64, + /// Height of the unspent transaction output + pub height: u64, +} diff --git a/types/src/v19/mod.rs b/types/src/v19/mod.rs index e481cbf2..c1355ba6 100644 --- a/types/src/v19/mod.rs +++ b/types/src/v19/mod.rs @@ -48,7 +48,7 @@ //! | preciousblock | returns nothing | | //! | pruneblockchain | version | | //! | savemempool | returns nothing | | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! @@ -239,7 +239,7 @@ pub use self::{ GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, GetRawMempool, GetRawMempoolVerbose, MapMempoolEntryError, MempoolEntry, MempoolEntryError, - MempoolEntryFees, MempoolEntryFeesError, Softfork, SoftforkType, + MempoolEntryFees, MempoolEntryFeesError, Softfork, SoftforkType, ScanTxOutSetStart, ScanTxOutSetUnspent, }, control::GetRpcInfo, network::{GetNetworkInfo, GetPeerInfo, PeerInfo}, @@ -282,7 +282,7 @@ pub use crate::v17::{ UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, + WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, }; #[doc(inline)] pub use crate::v18::{ diff --git a/types/src/v20/mod.rs b/types/src/v20/mod.rs index 2d29314f..9fc81e20 100644 --- a/types/src/v20/mod.rs +++ b/types/src/v20/mod.rs @@ -48,7 +48,7 @@ //! | preciousblock | returns nothing | | //! | pruneblockchain | version | | //! | savemempool | returns nothing | | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! @@ -278,7 +278,7 @@ pub use crate::{ ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, + WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -296,6 +296,6 @@ pub use crate::{ GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, GetNetworkInfo, GetPeerInfo, GetRawMempool, GetRawMempoolVerbose, GetRpcInfo, GetWalletInfo, GetWalletInfoScanning, MapMempoolEntryError, MempoolEntry, MempoolEntryError, MempoolEntryFees, - MempoolEntryFeesError, PeerInfo, SetWalletFlag, Softfork, SoftforkType, + MempoolEntryFeesError, PeerInfo, SetWalletFlag, Softfork, SoftforkType, ScanTxOutSetStart, ScanTxOutSetUnspent, }, }; diff --git a/types/src/v21/mod.rs b/types/src/v21/mod.rs index fb83edc8..92ab1da4 100644 --- a/types/src/v21/mod.rs +++ b/types/src/v21/mod.rs @@ -48,7 +48,7 @@ //! | preciousblock | returns nothing | | //! | pruneblockchain | version | | //! | savemempool | returns nothing | | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! @@ -294,7 +294,7 @@ pub use crate::{ TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -308,7 +308,7 @@ pub use crate::{ Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, GetBalancesError, GetBalancesMine, GetBalancesWatchOnly, GetBlockFilter, GetBlockFilterError, GetBlockchainInfoError, GetChainTxStats, GetDescriptorInfo, GetRpcInfo, MapMempoolEntryError, MempoolEntryError, - MempoolEntryFees, MempoolEntryFeesError, SetWalletFlag, + MempoolEntryFees, MempoolEntryFeesError, SetWalletFlag, ScanTxOutSetStart, ScanTxOutSetUnspent, }, v20::{ AddMultisigAddress, Banned, CreateMultisig, GenerateToDescriptor, GetAddressInfo, diff --git a/types/src/v22/mod.rs b/types/src/v22/mod.rs index efe44a15..fd2e7ba4 100644 --- a/types/src/v22/mod.rs +++ b/types/src/v22/mod.rs @@ -48,7 +48,7 @@ //! | preciousblock | returns nothing | | //! | pruneblockchain | version | | //! | savemempool | returns nothing | | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! @@ -297,7 +297,7 @@ pub use crate::{ TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -316,7 +316,7 @@ pub use crate::{ v20::{ AddMultisigAddress, CreateMultisig, GenerateToDescriptor, GetTransaction, GetTransactionDetail, ListSinceBlock, ListSinceBlockError, ListTransactions, - TransactionItem, TransactionItemError, + TransactionItem, TransactionItemError, ScanTxOutSetStart, ScanTxOutSetUnspent, }, v21::{ AddPeerAddress, Bip9SoftforkInfo, GenerateBlock, GetBlockchainInfo, GetIndexInfo, diff --git a/types/src/v23/mod.rs b/types/src/v23/mod.rs index ff562eef..64d6d7aa 100644 --- a/types/src/v23/mod.rs +++ b/types/src/v23/mod.rs @@ -50,7 +50,7 @@ //! | preciousblock | returns nothing | | //! | pruneblockchain | version | | //! | savemempool | version | | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! @@ -296,7 +296,7 @@ pub use crate::{ ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, + WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -311,7 +311,7 @@ pub use crate::{ GetBalancesError, GetBalancesMine, GetBalancesWatchOnly, GetBlockFilter, GetBlockFilterError, GetBlockchainInfoError, GetChainTxStats, GetDescriptorInfo, GetRpcInfo, MapMempoolEntryError, MempoolEntryError, MempoolEntryFees, - MempoolEntryFeesError, SetWalletFlag, Softfork, SoftforkType, + MempoolEntryFeesError, SetWalletFlag, Softfork, SoftforkType, ScanTxOutSetStart, ScanTxOutSetUnspent, }, v20::{GenerateToDescriptor, GetTransactionDetail}, v21::{ diff --git a/types/src/v24/mod.rs b/types/src/v24/mod.rs index d9b9904a..8479ddd6 100644 --- a/types/src/v24/mod.rs +++ b/types/src/v24/mod.rs @@ -51,7 +51,7 @@ //! | preciousblock | returns nothing | | //! | pruneblockchain | version | | //! | savemempool | version | | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! @@ -296,7 +296,7 @@ pub use crate::{ ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, + WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -311,7 +311,7 @@ pub use crate::{ GetBalancesError, GetBalancesMine, GetBalancesWatchOnly, GetBlockFilter, GetBlockFilterError, GetBlockchainInfoError, GetChainTxStats, GetDescriptorInfo, GetRpcInfo, MapMempoolEntryError, MempoolEntryError, MempoolEntryFees, - MempoolEntryFeesError, SetWalletFlag, Softfork, SoftforkType, + MempoolEntryFeesError, SetWalletFlag, Softfork, SoftforkType, ScanTxOutSetStart, ScanTxOutSetUnspent, }, v20::GenerateToDescriptor, v21::{ diff --git a/types/src/v25/blockchain/into.rs b/types/src/v25/blockchain/into.rs index 595970eb..71911885 100644 --- a/types/src/v25/blockchain/into.rs +++ b/types/src/v25/blockchain/into.rs @@ -1,9 +1,10 @@ // SPDX-License-Identifier: CC0-1.0 -use bitcoin::{Amount, BlockHash, FeeRate, Weight}; +use bitcoin::{Amount, BlockHash, FeeRate, ScriptBuf, Txid, Weight}; use super::error::ScanBlocksStartError; -use super::{GetBlockStats, GetBlockStatsError, ScanBlocksStart}; +use super::{GetBlockStats, GetBlockStatsError, ScanBlocksStart, ScanTxOutSetError, ScanTxOutSetStart, + ScanTxOutSetUnspent}; use crate::model; impl GetBlockStats { @@ -78,3 +79,52 @@ impl ScanBlocksStart { }) } } + +impl ScanTxOutSetStart { + /// Converts version specific type to a version nonspecific, more strongly typed type. + pub fn into_model(self) -> Result { + use ScanTxOutSetError as E; + + let bestblock = self.best_block.parse::().map_err(E::BestBlockHash)?; + + let unspents = self + .unspents + .into_iter() + .map(|u| u.into_model()) + .collect::, _>>()?; + + let total_amount = Amount::from_btc(self.total_amount).map_err(E::TotalAmount)?; + + Ok(model::ScanTxOutSetStart { + success: Some(self.success), + txouts: Some(self.txouts), + height: Some(self.height), + bestblock: Some(bestblock), + unspents, + total_amount, + }) + } +} + +impl ScanTxOutSetUnspent { + /// Converts version specific type to a version nonspecific, more strongly typed type. + pub fn into_model(self) -> Result { + use ScanTxOutSetError as E; + + let txid = self.txid.parse::().map_err(E::Txid)?; + let amount = Amount::from_btc(self.amount).map_err(E::Amount)?; + let script_pubkey = ScriptBuf::from_hex(&self.script_pubkey).map_err(E::ScriptPubKey)?; + + Ok(model::ScanTxOutSetUnspent { + txid, + vout: self.vout, + script_pubkey, + desc: Some(self.descriptor), + amount, + coinbase: Some(self.coinbase), + height: self.height, + blockhash: None, + confirmations: None, + }) + } +} diff --git a/types/src/v25/blockchain/mod.rs b/types/src/v25/blockchain/mod.rs index 978842cb..ab726aa0 100644 --- a/types/src/v25/blockchain/mod.rs +++ b/types/src/v25/blockchain/mod.rs @@ -10,7 +10,7 @@ mod into; use serde::{Deserialize, Serialize}; pub use self::error::ScanBlocksStartError; -pub use super::GetBlockStatsError; +pub use super::{GetBlockStatsError, ScanTxOutSetError}; /// Result of JSON-RPC method `getblockstats`. /// @@ -154,3 +154,47 @@ pub struct ScanBlocksStatus { /// Height of the block currently being scanned pub current_height: i64, } + +/// Result of JSON-RPC method `scantxoutset`. +/// +/// > scantxoutset "action" ( [scanobjects,...] ) +/// > +/// > Arguments: +/// > 1. action (string, required) The action to execute +/// > 2. scanobjects (json array, required) Array of scan objects +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +pub struct ScanTxOutSetStart { + /// Whether the scan is completed + pub success: bool, + /// The number of unspent transaction outputs scanned + pub txouts: u64, + /// The current block height (index) + pub height: u64, + /// The hash of the block at the tip of the chain + #[serde(rename = "bestblock")] + pub best_block: String, + /// The unspents + pub unspents: Vec, + /// The total amount of all found unspent outputs in BTC + pub total_amount: f64, +} + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +pub struct ScanTxOutSetUnspent { + /// The transaction id + pub txid: String, + /// The vout value + pub vout: u32, + /// The script key + #[serde(rename = "scriptPubKey")] + pub script_pubkey: String, + /// An output descriptor + #[serde(rename = "desc")] + pub descriptor: String, + /// The total amount in BTC of unspent output + pub amount: f64, + /// Whether this is a coinbase output + pub coinbase: bool, + /// Height of the unspent transaction output + pub height: u64, +} \ No newline at end of file diff --git a/types/src/v25/mod.rs b/types/src/v25/mod.rs index 7a31ef90..cfbf6383 100644 --- a/types/src/v25/mod.rs +++ b/types/src/v25/mod.rs @@ -249,7 +249,7 @@ mod wallet; #[doc(inline)] pub use self::{ blockchain::{ - GetBlockStats, ScanBlocksAbort, ScanBlocksStart, ScanBlocksStartError, ScanBlocksStatus, + GetBlockStats, ScanBlocksAbort, ScanBlocksStart, ScanBlocksStartError, ScanBlocksStatus, ScanTxOutSetStart, ScanTxOutSetUnspent }, control::Logging, generating::{GenerateBlock, GenerateBlockError}, @@ -290,7 +290,7 @@ pub use crate::{ ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, + WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v26/mod.rs b/types/src/v26/mod.rs index 482fa991..2821f674 100644 --- a/types/src/v26/mod.rs +++ b/types/src/v26/mod.rs @@ -306,7 +306,7 @@ pub use crate::{ SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -353,6 +353,6 @@ pub use crate::{ DescriptorInfo, GenerateBlock, GenerateBlockError, GetBlockStats, ListDescriptors, MempoolAcceptance, MempoolAcceptanceError, MempoolAcceptanceFees, ScanBlocksAbort, ScanBlocksStart, ScanBlocksStartError, ScanBlocksStatus, TestMempoolAccept, - TestMempoolAcceptError, + TestMempoolAcceptError, ScanTxOutSetStart, ScanTxOutSetUnspent, }, }; diff --git a/types/src/v27/mod.rs b/types/src/v27/mod.rs index 63c4bf47..5fac1c3c 100644 --- a/types/src/v27/mod.rs +++ b/types/src/v27/mod.rs @@ -282,7 +282,7 @@ pub use crate::{ SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -329,7 +329,7 @@ pub use crate::{ DescriptorInfo, GenerateBlock, GenerateBlockError, GetBlockStats, ListDescriptors, MempoolAcceptance, MempoolAcceptanceError, MempoolAcceptanceFees, ScanBlocksAbort, ScanBlocksStart, ScanBlocksStartError, ScanBlocksStatus, TestMempoolAccept, - TestMempoolAcceptError, + TestMempoolAcceptError, ScanTxOutSetStart, ScanTxOutSetUnspent }, v26::{ AddrManInfoNetwork, ChainState, CreateWallet, DescriptorProcessPsbt, diff --git a/types/src/v28/blockchain/into.rs b/types/src/v28/blockchain/into.rs new file mode 100644 index 00000000..8d7ba132 --- /dev/null +++ b/types/src/v28/blockchain/into.rs @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: CC0-1.0 + +use bitcoin::{Amount, BlockHash, ScriptBuf, Txid}; + +use super::{ + ScanTxOutSetError, ScanTxOutSetStart, ScanTxOutSetUnspent, +}; +use crate::model; + +impl ScanTxOutSetStart { + pub fn into_model(self) -> Result { + use ScanTxOutSetError as E; + + let bestblock = self.best_block.parse::().map_err(E::BestBlockHash)?; + + let unspents = + self.unspents.into_iter().map(|u| u.into_model()).collect::, _>>()?; + + let total_amount = Amount::from_btc(self.total_amount).map_err(E::TotalAmount)?; + + Ok(model::ScanTxOutSetStart { + success: Some(self.success), + txouts: Some(self.txouts), + height: Some(self.height), + bestblock: Some(bestblock), + unspents, + total_amount, + }) + } +} + +impl ScanTxOutSetUnspent { + pub fn into_model(self) -> Result { + use ScanTxOutSetError as E; + + let txid = self.txid.parse::().map_err(E::Txid)?; + let amount = Amount::from_btc(self.amount).map_err(E::Amount)?; + let script_pubkey = ScriptBuf::from_hex(&self.script_pubkey).map_err(E::ScriptPubKey)?; + let blockhash = self.block_hash.parse::().map_err(E::BlockHash)?; + + Ok(model::ScanTxOutSetUnspent { + txid, + vout: self.vout, + script_pubkey, + desc: Some(self.descriptor), + amount, + coinbase: Some(self.coinbase), + height: self.height, + blockhash: Some(blockhash), + confirmations: Some(self.confirmations), + }) + } +} diff --git a/types/src/v28/blockchain.rs b/types/src/v28/blockchain/mod.rs similarity index 71% rename from types/src/v28/blockchain.rs rename to types/src/v28/blockchain/mod.rs index 31dff9a8..faa5fd54 100644 --- a/types/src/v28/blockchain.rs +++ b/types/src/v28/blockchain/mod.rs @@ -4,12 +4,14 @@ //! //! Types for methods found under the `== Blockchain ==` section of the API docs. +mod into; + use alloc::collections::BTreeMap; use bitcoin::{BlockHash, Network, Work}; use serde::{Deserialize, Serialize}; -use super::{GetBlockchainInfoError, Softfork}; +use super::{GetBlockchainInfoError, ScanTxOutSetError, Softfork}; use crate::model; /// Result of JSON-RPC method `getblockchaininfo`. @@ -103,3 +105,52 @@ impl GetBlockchainInfo { }) } } + +/// Result of JSON-RPC method `scantxoutset`. +/// +/// > scantxoutset "action" ( [scanobjects,...] ) +/// > +/// > Arguments: +/// > 1. action (string, required) The action to execute +/// 2. scanobjects (json array, required) Array of scan objects +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] // v28 +pub struct ScanTxOutSetStart { + /// Whether the scan is completed + pub success: bool, + /// The number of unspent transaction outputs scanned + pub txouts: u64, + /// The current block height (index) + pub height: u64, + /// The hash of the block at the tip of the chain + #[serde(rename = "bestblock")] + pub best_block: String, + /// The unspents + pub unspents: Vec, + /// The total amount of all found unspent outputs in BTC + pub total_amount: f64, +} + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +pub struct ScanTxOutSetUnspent { + /// The transaction id + pub txid: String, + /// The vout value + pub vout: u32, + /// The script key + #[serde(rename = "scriptPubKey")] + pub script_pubkey: String, + /// An output descriptor + #[serde(rename = "desc")] + pub descriptor: String, + /// The total amount in BTC of unspent output + pub amount: f64, + /// Whether this is a coinbase output + pub coinbase: bool, + /// Height of the unspent transaction output + pub height: u64, + /// Blockhash of the unspent transaction output + #[serde(rename = "blockhash")] + pub block_hash: String, + /// Number of confirmations of the unspent transaction output when the scan was done + pub confirmations: u64, +} diff --git a/types/src/v28/mod.rs b/types/src/v28/mod.rs index 66fbc130..faabc607 100644 --- a/types/src/v28/mod.rs +++ b/types/src/v28/mod.rs @@ -259,7 +259,9 @@ mod wallet; #[doc(inline)] pub use self::{ - blockchain::GetBlockchainInfo, + blockchain::{ + GetBlockchainInfo, ScanTxOutSetStart, ScanTxOutSetUnspent, + }, control::Logging, mining::GetMiningInfo, network::GetNetworkInfo, @@ -303,7 +305,7 @@ pub use crate::{ SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v29/mod.rs b/types/src/v29/mod.rs index bd683ca9..c454db41 100644 --- a/types/src/v29/mod.rs +++ b/types/src/v29/mod.rs @@ -296,7 +296,7 @@ pub use crate::{ TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, + WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -354,7 +354,8 @@ pub use crate::{ v28::{ CreateWalletDescriptor, GetAddressInfo, GetAddressInfoEmbedded, GetHdKeys, GetHdKeysError, GetNetworkInfo, GetTransaction, HdKey, HdKeyDescriptor, ListSinceBlock, - ListSinceBlockError, ListTransactions, Logging, SubmitPackage, SubmitPackageError, + ListSinceBlockError, ListTransactions, Logging, SubmitPackage, SubmitPackageError, ScanTxOutSetStart, + ScanTxOutSetUnspent, SubmitPackageTxResult, SubmitPackageTxResultError, SubmitPackageTxResultFees, SubmitPackageTxResultFeesError, TransactionItem, TransactionItemError, }, From 78fb9201f2ce50205359e56e155d546ec3a8c4d4 Mon Sep 17 00:00:00 2001 From: GideonBature Date: Tue, 15 Jul 2025 15:48:24 +0100 Subject: [PATCH 2/6] Format code Format code --- client/src/client_sync/v17/blockchain.rs | 5 ++++- client/src/client_sync/v28/mod.rs | 1 - types/src/v17/blockchain/error.rs | 21 +++++++-------------- types/src/v17/blockchain/into.rs | 9 +++------ types/src/v17/mod.rs | 6 +++--- types/src/v18/blockchain/into.rs | 7 ++----- types/src/v19/blockchain/into.rs | 7 ++----- types/src/v25/blockchain/into.rs | 7 ++----- types/src/v28/blockchain/into.rs | 4 +--- types/src/v28/mod.rs | 4 +--- 10 files changed, 25 insertions(+), 46 deletions(-) diff --git a/client/src/client_sync/v17/blockchain.rs b/client/src/client_sync/v17/blockchain.rs index 413930a0..5ab8c26b 100644 --- a/client/src/client_sync/v17/blockchain.rs +++ b/client/src/client_sync/v17/blockchain.rs @@ -329,7 +329,10 @@ macro_rules! impl_client_v17__scan_tx_out_set { } /// Starts a scan of the UTXO set for specified descriptors. - pub fn scan_tx_out_set_start(&self, scan_objects: &[&str]) -> Result { + pub fn scan_tx_out_set_start( + &self, + scan_objects: &[&str], + ) -> Result { self.call("scantxoutset", &[into_json("start")?, into_json(scan_objects)?]) } diff --git a/client/src/client_sync/v28/mod.rs b/client/src/client_sync/v28/mod.rs index 625b7166..9c9f3dfa 100644 --- a/client/src/client_sync/v28/mod.rs +++ b/client/src/client_sync/v28/mod.rs @@ -63,7 +63,6 @@ crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); - // == Control == crate::impl_client_v17__get_memory_info!(); crate::impl_client_v18__get_rpc_info!(); diff --git a/types/src/v17/blockchain/error.rs b/types/src/v17/blockchain/error.rs index 8d371e59..ef801719 100644 --- a/types/src/v17/blockchain/error.rs +++ b/types/src/v17/blockchain/error.rs @@ -548,20 +548,13 @@ impl fmt::Display for ScanTxOutSetError { use ScanTxOutSetError::*; match self { - BestBlockHash(e) => - write_err!(f, "conversion of the `bestblock` field failed"; e), - BlockHash(e) => - write_err!(f, "conversion of the `blockhash` field failed"; e), - Txid(e) => - write_err!(f, "conversion of the `txid` field failed"; e), - ScriptPubKey(e) => - write_err!(f, "conversion of the `scriptPubKey` field failed"; e), - TotalAmount(e) => - write_err!(f, "conversion of the `total_amount` field failed"; e), - Amount(e) => - write_err!(f, "conversion of the `amount` field failed"; e), - Numeric(e) => - write_err!(f, "numeric"; e), + BestBlockHash(e) => write_err!(f, "conversion of the `bestblock` field failed"; e), + BlockHash(e) => write_err!(f, "conversion of the `blockhash` field failed"; e), + Txid(e) => write_err!(f, "conversion of the `txid` field failed"; e), + ScriptPubKey(e) => write_err!(f, "conversion of the `scriptPubKey` field failed"; e), + TotalAmount(e) => write_err!(f, "conversion of the `total_amount` field failed"; e), + Amount(e) => write_err!(f, "conversion of the `amount` field failed"; e), + Numeric(e) => write_err!(f, "numeric"; e), } } } diff --git a/types/src/v17/blockchain/into.rs b/types/src/v17/blockchain/into.rs index 943598f3..f2179501 100644 --- a/types/src/v17/blockchain/into.rs +++ b/types/src/v17/blockchain/into.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: CC0-1.0 use bitcoin::consensus::encode; -use bitcoin::{block, hex, Block, BlockHash, CompactTarget, Txid, Weight, Work, ScriptBuf}; +use bitcoin::{block, hex, Block, BlockHash, CompactTarget, ScriptBuf, Txid, Weight, Work}; // TODO: Use explicit imports? use super::*; @@ -556,11 +556,8 @@ impl ScanTxOutSetStart { pub fn into_model(self) -> Result { use ScanTxOutSetError as E; - let unspents = self - .unspents - .into_iter() - .map(|u| u.into_model()) - .collect::, _>>()?; + let unspents = + self.unspents.into_iter().map(|u| u.into_model()).collect::, _>>()?; let total_amount = Amount::from_btc(self.total_amount).map_err(E::TotalAmount)?; diff --git a/types/src/v17/mod.rs b/types/src/v17/mod.rs index 569d2e84..903a852d 100644 --- a/types/src/v17/mod.rs +++ b/types/src/v17/mod.rs @@ -244,9 +244,9 @@ pub use self::{ GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, GetMempoolInfoError, GetRawMempool, GetRawMempoolVerbose, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, MapMempoolEntryError, MempoolEntry, MempoolEntryError, - MempoolEntryFees, MempoolEntryFeesError, PruneBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, - ScanTxOutSetStart, ScanTxOutSetStatus, ScanTxOutSetUnspent, Softfork, SoftforkReject, - VerifyChain, VerifyTxOutProof, + MempoolEntryFees, MempoolEntryFeesError, PruneBlockchain, ScanTxOutSetAbort, + ScanTxOutSetError, ScanTxOutSetStart, ScanTxOutSetStatus, ScanTxOutSetUnspent, Softfork, + SoftforkReject, VerifyChain, VerifyTxOutProof, }, control::{GetMemoryInfoStats, Locked, Logging}, generating::{Generate, GenerateToAddress}, diff --git a/types/src/v18/blockchain/into.rs b/types/src/v18/blockchain/into.rs index 2148c795..52fdcb6d 100644 --- a/types/src/v18/blockchain/into.rs +++ b/types/src/v18/blockchain/into.rs @@ -142,11 +142,8 @@ impl ScanTxOutSetStart { pub fn into_model(self) -> Result { use ScanTxOutSetError as E; - let unspents = self - .unspents - .into_iter() - .map(|u| u.into_model()) - .collect::, _>>()?; + let unspents = + self.unspents.into_iter().map(|u| u.into_model()).collect::, _>>()?; let total_amount = Amount::from_btc(self.total_amount).map_err(E::TotalAmount)?; diff --git a/types/src/v19/blockchain/into.rs b/types/src/v19/blockchain/into.rs index 0de28194..2cf8b556 100644 --- a/types/src/v19/blockchain/into.rs +++ b/types/src/v19/blockchain/into.rs @@ -270,11 +270,8 @@ impl ScanTxOutSetStart { let bestblock = self.best_block.parse::().map_err(E::BestBlockHash)?; - let unspents = self - .unspents - .into_iter() - .map(|u| u.into_model()) - .collect::, _>>()?; + let unspents = + self.unspents.into_iter().map(|u| u.into_model()).collect::, _>>()?; let total_amount = Amount::from_btc(self.total_amount).map_err(E::TotalAmount)?; diff --git a/types/src/v25/blockchain/into.rs b/types/src/v25/blockchain/into.rs index 71911885..896d6b3b 100644 --- a/types/src/v25/blockchain/into.rs +++ b/types/src/v25/blockchain/into.rs @@ -87,11 +87,8 @@ impl ScanTxOutSetStart { let bestblock = self.best_block.parse::().map_err(E::BestBlockHash)?; - let unspents = self - .unspents - .into_iter() - .map(|u| u.into_model()) - .collect::, _>>()?; + let unspents = + self.unspents.into_iter().map(|u| u.into_model()).collect::, _>>()?; let total_amount = Amount::from_btc(self.total_amount).map_err(E::TotalAmount)?; diff --git a/types/src/v28/blockchain/into.rs b/types/src/v28/blockchain/into.rs index 8d7ba132..f8678158 100644 --- a/types/src/v28/blockchain/into.rs +++ b/types/src/v28/blockchain/into.rs @@ -2,9 +2,7 @@ use bitcoin::{Amount, BlockHash, ScriptBuf, Txid}; -use super::{ - ScanTxOutSetError, ScanTxOutSetStart, ScanTxOutSetUnspent, -}; +use super::{ScanTxOutSetError, ScanTxOutSetStart, ScanTxOutSetUnspent}; use crate::model; impl ScanTxOutSetStart { diff --git a/types/src/v28/mod.rs b/types/src/v28/mod.rs index faabc607..14b87b9a 100644 --- a/types/src/v28/mod.rs +++ b/types/src/v28/mod.rs @@ -259,9 +259,7 @@ mod wallet; #[doc(inline)] pub use self::{ - blockchain::{ - GetBlockchainInfo, ScanTxOutSetStart, ScanTxOutSetUnspent, - }, + blockchain::{GetBlockchainInfo, ScanTxOutSetStart, ScanTxOutSetUnspent}, control::Logging, mining::GetMiningInfo, network::GetNetworkInfo, From 32231437c102e2abaa9f90a495e3b5a118cefeaa Mon Sep 17 00:00:00 2001 From: GideonBature Date: Thu, 4 Dec 2025 16:55:23 +0100 Subject: [PATCH 3/6] Resolve merge conflict --- integration_test/tests/blockchain.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/integration_test/tests/blockchain.rs b/integration_test/tests/blockchain.rs index 7ecb51e4..f2057665 100644 --- a/integration_test/tests/blockchain.rs +++ b/integration_test/tests/blockchain.rs @@ -524,13 +524,6 @@ fn blockchain__scan_tx_out_set_modelled() { let _: ScanTxOutSetAbort = node.client.scan_tx_out_set_abort().expect("scantxoutset abort"); } -#[test] -fn blockchain__verify_tx_out_proof__modelled() { - let node = Node::with_wallet(Wallet::Default, &[]); - node.fund_wallet(); - verify_tx_out_proof(&node).unwrap(); -} - #[test] fn blockchain__verify_chain() { let node = Node::with_wallet(Wallet::None, &[]); From 8d929b16a68bc2ad3347a29c29bd4976beb4032d Mon Sep 17 00:00:00 2001 From: GideonBature Date: Thu, 4 Dec 2025 17:00:28 +0100 Subject: [PATCH 4/6] Format code --- integration_test/tests/blockchain.rs | 8 +-- types/src/v18/blockchain/into.rs | 7 ++- types/src/v18/mod.rs | 19 ++++---- types/src/v19/mod.rs | 10 ++-- types/src/v20/mod.rs | 19 ++++---- types/src/v21/mod.rs | 20 ++++---- types/src/v22/mod.rs | 19 ++++---- types/src/v23/mod.rs | 20 ++++---- types/src/v24/mod.rs | 20 ++++---- types/src/v25/blockchain/into.rs | 6 ++- types/src/v25/blockchain/mod.rs | 2 +- types/src/v25/mod.rs | 20 ++++---- types/src/v26/mod.rs | 19 ++++---- types/src/v27/mod.rs | 19 ++++---- types/src/v28/mod.rs | 15 +++--- types/src/v29/mod.rs | 23 ++++----- verify/src/reexports.rs | 73 +++++++++++----------------- 17 files changed, 162 insertions(+), 157 deletions(-) diff --git a/integration_test/tests/blockchain.rs b/integration_test/tests/blockchain.rs index f2057665..66bca38a 100644 --- a/integration_test/tests/blockchain.rs +++ b/integration_test/tests/blockchain.rs @@ -508,15 +508,17 @@ fn blockchain__scan_tx_out_set_modelled() { #[cfg(feature = "v21_and_below")] () => Node::with_wallet(Wallet::None, &[]), #[cfg(not(feature = "v21_and_below"))] - () => Node::with_wallet(Wallet::None, &["-coinstatsindex=1"]) + () => Node::with_wallet(Wallet::None, &["-coinstatsindex=1"]), }; let dummy_pubkey_hex = "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"; let scan_desc = format!("pkh({})", dummy_pubkey_hex); - let json: ScanTxOutSetStart = node.client.scan_tx_out_set_start(&[&scan_desc]).expect("scantxoutset start"); + let json: ScanTxOutSetStart = + node.client.scan_tx_out_set_start(&[&scan_desc]).expect("scantxoutset start"); - let _: Option = node.client.scan_tx_out_set_status().expect("scantxoutset status"); + let _: Option = + node.client.scan_tx_out_set_status().expect("scantxoutset status"); let model: Result = json.into_model(); model.unwrap(); diff --git a/types/src/v18/blockchain/into.rs b/types/src/v18/blockchain/into.rs index 52fdcb6d..2a601c06 100644 --- a/types/src/v18/blockchain/into.rs +++ b/types/src/v18/blockchain/into.rs @@ -2,15 +2,14 @@ use alloc::collections::BTreeMap; -use bitcoin::{Amount, hex, ScriptBuf, Txid, Wtxid}; +use bitcoin::{hex, Amount, ScriptBuf, Txid, Wtxid}; use super::{ GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetRawMempool, GetRawMempoolVerbose, - MapMempoolEntryError, MempoolEntry, MempoolEntryError, ScanTxOutSetError, - ScanTxOutSetStart, ScanTxOutSetUnspent, + MapMempoolEntryError, MempoolEntry, MempoolEntryError, ScanTxOutSetError, ScanTxOutSetStart, + ScanTxOutSetUnspent, }; - use crate::model; impl GetMempoolAncestors { diff --git a/types/src/v18/mod.rs b/types/src/v18/mod.rs index 46cbb384..50342b1c 100644 --- a/types/src/v18/mod.rs +++ b/types/src/v18/mod.rs @@ -283,13 +283,14 @@ pub use crate::v17::{ MapMempoolEntryError, MempoolAcceptance, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, NumericError, PartialSignatureError, PruneBlockchain, PsbtInput, PsbtInputError, PsbtOutput, PsbtOutputError, PsbtScript, RawTransaction, RawTransactionError, - RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, - SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignFail, SignFailError, - SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SignRawTransactionWithKey, SignRawTransactionWithWallet, Softfork, SoftforkReject, - TestMempoolAccept, TransactionCategory, TransactionItem, TransactionItemError, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, - WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, WitnessUtxoError, ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScanTxOutSetAbort, + ScanTxOutSetError, ScanTxOutSetStatus, ScriptType, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, + SignRawTransaction, SignRawTransactionError, SignRawTransactionWithKey, + SignRawTransactionWithWallet, Softfork, SoftforkReject, TestMempoolAccept, TransactionCategory, + TransactionItem, TransactionItemError, UploadTarget, ValidateAddress, ValidateAddressError, + VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, + WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + WitnessUtxoError, }; diff --git a/types/src/v19/mod.rs b/types/src/v19/mod.rs index c1355ba6..8ae06b56 100644 --- a/types/src/v19/mod.rs +++ b/types/src/v19/mod.rs @@ -239,7 +239,8 @@ pub use self::{ GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, GetRawMempool, GetRawMempoolVerbose, MapMempoolEntryError, MempoolEntry, MempoolEntryError, - MempoolEntryFees, MempoolEntryFeesError, Softfork, SoftforkType, ScanTxOutSetStart, ScanTxOutSetUnspent, + MempoolEntryFees, MempoolEntryFeesError, ScanTxOutSetStart, ScanTxOutSetUnspent, Softfork, + SoftforkType, }, control::GetRpcInfo, network::{GetNetworkInfo, GetPeerInfo, PeerInfo}, @@ -275,14 +276,15 @@ pub use crate::v17::{ ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, Logging, MempoolAcceptance, NumericError, PartialSignatureError, PruneBlockchain, PsbtInput, PsbtInputError, PsbtOutput, PsbtOutputError, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, - SetTxFee, SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, ScriptType, + SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignFail, + SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SignRawTransactionWithKey, SignRawTransactionWithWallet, SoftforkReject, TestMempoolAccept, TransactionCategory, TransactionItem, TransactionItemError, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, + WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, }; #[doc(inline)] pub use crate::v18::{ diff --git a/types/src/v20/mod.rs b/types/src/v20/mod.rs index 9fc81e20..e91ea7db 100644 --- a/types/src/v20/mod.rs +++ b/types/src/v20/mod.rs @@ -271,14 +271,14 @@ pub use crate::{ LoadWallet, LockUnspent, Locked, MempoolAcceptance, NumericError, PartialSignatureError, PruneBlockchain, PsbtInput, PsbtInputError, PsbtOutput, PsbtOutputError, RawTransactionError, RawTransactionInput, RawTransactionOutput, RescanBlockchain, - ScriptType, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, - SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SignRawTransactionWithKey, SignRawTransactionWithWallet, - SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, - WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, - WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, + ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, ScriptType, SendMany, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignFail, SignFailError, + SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, + SignRawTransactionWithKey, SignRawTransactionWithWallet, SoftforkReject, TestMempoolAccept, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, + WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -296,6 +296,7 @@ pub use crate::{ GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, GetNetworkInfo, GetPeerInfo, GetRawMempool, GetRawMempoolVerbose, GetRpcInfo, GetWalletInfo, GetWalletInfoScanning, MapMempoolEntryError, MempoolEntry, MempoolEntryError, MempoolEntryFees, - MempoolEntryFeesError, PeerInfo, SetWalletFlag, Softfork, SoftforkType, ScanTxOutSetStart, ScanTxOutSetUnspent, + MempoolEntryFeesError, PeerInfo, ScanTxOutSetStart, ScanTxOutSetUnspent, SetWalletFlag, + Softfork, SoftforkType, }, }; diff --git a/types/src/v21/mod.rs b/types/src/v21/mod.rs index 92ab1da4..d3c631cf 100644 --- a/types/src/v21/mod.rs +++ b/types/src/v21/mod.rs @@ -287,14 +287,15 @@ pub use crate::{ ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, NumericError, PartialSignatureError, PruneBlockchain, PsbtInput, PsbtInputError, PsbtOutput, PsbtOutputError, RawTransactionError, - RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, - SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignFail, SignFailError, - SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SignRawTransactionWithKey, SignRawTransactionWithWallet, SoftforkReject, - TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, - VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, - WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScanTxOutSetAbort, + ScanTxOutSetError, ScanTxOutSetStatus, ScriptType, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, + SignRawTransaction, SignRawTransactionError, SignRawTransactionWithKey, + SignRawTransactionWithWallet, SoftforkReject, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, + WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -308,7 +309,8 @@ pub use crate::{ Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, GetBalancesError, GetBalancesMine, GetBalancesWatchOnly, GetBlockFilter, GetBlockFilterError, GetBlockchainInfoError, GetChainTxStats, GetDescriptorInfo, GetRpcInfo, MapMempoolEntryError, MempoolEntryError, - MempoolEntryFees, MempoolEntryFeesError, SetWalletFlag, ScanTxOutSetStart, ScanTxOutSetUnspent, + MempoolEntryFees, MempoolEntryFeesError, ScanTxOutSetStart, ScanTxOutSetUnspent, + SetWalletFlag, }, v20::{ AddMultisigAddress, Banned, CreateMultisig, GenerateToDescriptor, GetAddressInfo, diff --git a/types/src/v22/mod.rs b/types/src/v22/mod.rs index fd2e7ba4..dad45348 100644 --- a/types/src/v22/mod.rs +++ b/types/src/v22/mod.rs @@ -290,14 +290,15 @@ pub use crate::{ ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, NumericError, PartialSignatureError, PruneBlockchain, PsbtInput, PsbtInputError, PsbtOutput, PsbtOutputError, RawTransactionError, - RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, - SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignFail, SignFailError, - SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SignRawTransactionWithKey, SignRawTransactionWithWallet, SoftforkReject, - TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, - VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, - WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScanTxOutSetAbort, + ScanTxOutSetError, ScanTxOutSetStatus, ScriptType, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, + SignRawTransaction, SignRawTransactionError, SignRawTransactionWithKey, + SignRawTransactionWithWallet, SoftforkReject, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, + WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -316,7 +317,7 @@ pub use crate::{ v20::{ AddMultisigAddress, CreateMultisig, GenerateToDescriptor, GetTransaction, GetTransactionDetail, ListSinceBlock, ListSinceBlockError, ListTransactions, - TransactionItem, TransactionItemError, ScanTxOutSetStart, ScanTxOutSetUnspent, + ScanTxOutSetStart, ScanTxOutSetUnspent, TransactionItem, TransactionItemError, }, v21::{ AddPeerAddress, Bip9SoftforkInfo, GenerateBlock, GetBlockchainInfo, GetIndexInfo, diff --git a/types/src/v23/mod.rs b/types/src/v23/mod.rs index 64d6d7aa..75b49713 100644 --- a/types/src/v23/mod.rs +++ b/types/src/v23/mod.rs @@ -289,14 +289,15 @@ pub use crate::{ ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, NumericError, PartialSignatureError, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SignRawTransactionWithKey, - SignRawTransactionWithWallet, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, - WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, + RawTransactionOutput, RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, + ScanTxOutSetStatus, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, + SetTxFee, SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SignRawTransactionWithKey, SignRawTransactionWithWallet, + SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, + VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, + WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + WitnessUtxoError, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -311,7 +312,8 @@ pub use crate::{ GetBalancesError, GetBalancesMine, GetBalancesWatchOnly, GetBlockFilter, GetBlockFilterError, GetBlockchainInfoError, GetChainTxStats, GetDescriptorInfo, GetRpcInfo, MapMempoolEntryError, MempoolEntryError, MempoolEntryFees, - MempoolEntryFeesError, SetWalletFlag, Softfork, SoftforkType, ScanTxOutSetStart, ScanTxOutSetUnspent, + MempoolEntryFeesError, ScanTxOutSetStart, ScanTxOutSetUnspent, SetWalletFlag, Softfork, + SoftforkType, }, v20::{GenerateToDescriptor, GetTransactionDetail}, v21::{ diff --git a/types/src/v24/mod.rs b/types/src/v24/mod.rs index 8479ddd6..52f63bcc 100644 --- a/types/src/v24/mod.rs +++ b/types/src/v24/mod.rs @@ -289,14 +289,15 @@ pub use crate::{ ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, NumericError, PartialSignatureError, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SignRawTransactionWithKey, - SignRawTransactionWithWallet, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, - WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, + RawTransactionOutput, RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, + ScanTxOutSetStatus, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, + SetTxFee, SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SignRawTransactionWithKey, SignRawTransactionWithWallet, + SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, + VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, + WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + WitnessUtxoError, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -311,7 +312,8 @@ pub use crate::{ GetBalancesError, GetBalancesMine, GetBalancesWatchOnly, GetBlockFilter, GetBlockFilterError, GetBlockchainInfoError, GetChainTxStats, GetDescriptorInfo, GetRpcInfo, MapMempoolEntryError, MempoolEntryError, MempoolEntryFees, - MempoolEntryFeesError, SetWalletFlag, Softfork, SoftforkType, ScanTxOutSetStart, ScanTxOutSetUnspent, + MempoolEntryFeesError, ScanTxOutSetStart, ScanTxOutSetUnspent, SetWalletFlag, Softfork, + SoftforkType, }, v20::GenerateToDescriptor, v21::{ diff --git a/types/src/v25/blockchain/into.rs b/types/src/v25/blockchain/into.rs index 896d6b3b..bd27c73e 100644 --- a/types/src/v25/blockchain/into.rs +++ b/types/src/v25/blockchain/into.rs @@ -3,8 +3,10 @@ use bitcoin::{Amount, BlockHash, FeeRate, ScriptBuf, Txid, Weight}; use super::error::ScanBlocksStartError; -use super::{GetBlockStats, GetBlockStatsError, ScanBlocksStart, ScanTxOutSetError, ScanTxOutSetStart, - ScanTxOutSetUnspent}; +use super::{ + GetBlockStats, GetBlockStatsError, ScanBlocksStart, ScanTxOutSetError, ScanTxOutSetStart, + ScanTxOutSetUnspent, +}; use crate::model; impl GetBlockStats { diff --git a/types/src/v25/blockchain/mod.rs b/types/src/v25/blockchain/mod.rs index ab726aa0..185208e2 100644 --- a/types/src/v25/blockchain/mod.rs +++ b/types/src/v25/blockchain/mod.rs @@ -197,4 +197,4 @@ pub struct ScanTxOutSetUnspent { pub coinbase: bool, /// Height of the unspent transaction output pub height: u64, -} \ No newline at end of file +} diff --git a/types/src/v25/mod.rs b/types/src/v25/mod.rs index cfbf6383..ed04e500 100644 --- a/types/src/v25/mod.rs +++ b/types/src/v25/mod.rs @@ -249,7 +249,8 @@ mod wallet; #[doc(inline)] pub use self::{ blockchain::{ - GetBlockStats, ScanBlocksAbort, ScanBlocksStart, ScanBlocksStartError, ScanBlocksStatus, ScanTxOutSetStart, ScanTxOutSetUnspent + GetBlockStats, ScanBlocksAbort, ScanBlocksStart, ScanBlocksStartError, ScanBlocksStatus, + ScanTxOutSetStart, ScanTxOutSetUnspent, }, control::Logging, generating::{GenerateBlock, GenerateBlockError}, @@ -283,14 +284,15 @@ pub use crate::{ ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, LockUnspent, Locked, NumericError, PartialSignatureError, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SignRawTransactionWithKey, - SignRawTransactionWithWallet, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, - WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, + RawTransactionOutput, RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, + ScanTxOutSetStatus, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, + SetTxFee, SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SignRawTransactionWithKey, SignRawTransactionWithWallet, + SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, + VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, + WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + WitnessUtxoError, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v26/mod.rs b/types/src/v26/mod.rs index 2821f674..8d728ba4 100644 --- a/types/src/v26/mod.rs +++ b/types/src/v26/mod.rs @@ -300,13 +300,14 @@ pub use crate::{ ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, LockUnspent, Locked, NumericError, PartialSignatureError, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, RescanBlockchain, - ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignFail, - SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SignRawTransactionWithKey, SignRawTransactionWithWallet, - SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, - VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, - WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, + ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, ScriptType, SendRawTransaction, + SendToAddress, SetNetworkActive, SetTxFee, SignFail, SignFailError, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, + SignRawTransactionWithKey, SignRawTransactionWithWallet, SoftforkReject, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, + WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -352,7 +353,7 @@ pub use crate::{ v25::{ DescriptorInfo, GenerateBlock, GenerateBlockError, GetBlockStats, ListDescriptors, MempoolAcceptance, MempoolAcceptanceError, MempoolAcceptanceFees, ScanBlocksAbort, - ScanBlocksStart, ScanBlocksStartError, ScanBlocksStatus, TestMempoolAccept, - TestMempoolAcceptError, ScanTxOutSetStart, ScanTxOutSetUnspent, + ScanBlocksStart, ScanBlocksStartError, ScanBlocksStatus, ScanTxOutSetStart, + ScanTxOutSetUnspent, TestMempoolAccept, TestMempoolAcceptError, }, }; diff --git a/types/src/v27/mod.rs b/types/src/v27/mod.rs index 5fac1c3c..b05b3801 100644 --- a/types/src/v27/mod.rs +++ b/types/src/v27/mod.rs @@ -276,13 +276,14 @@ pub use crate::{ ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, LockUnspent, Locked, NumericError, PartialSignatureError, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, RescanBlockchain, - ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignFail, - SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SignRawTransactionWithKey, SignRawTransactionWithWallet, - SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, - VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, - WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, + ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, ScriptType, SendRawTransaction, + SendToAddress, SetNetworkActive, SetTxFee, SignFail, SignFailError, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, + SignRawTransactionWithKey, SignRawTransactionWithWallet, SoftforkReject, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, + WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -328,8 +329,8 @@ pub use crate::{ v25::{ DescriptorInfo, GenerateBlock, GenerateBlockError, GetBlockStats, ListDescriptors, MempoolAcceptance, MempoolAcceptanceError, MempoolAcceptanceFees, ScanBlocksAbort, - ScanBlocksStart, ScanBlocksStartError, ScanBlocksStatus, TestMempoolAccept, - TestMempoolAcceptError, ScanTxOutSetStart, ScanTxOutSetUnspent + ScanBlocksStart, ScanBlocksStartError, ScanBlocksStatus, ScanTxOutSetStart, + ScanTxOutSetUnspent, TestMempoolAccept, TestMempoolAcceptError, }, v26::{ AddrManInfoNetwork, ChainState, CreateWallet, DescriptorProcessPsbt, diff --git a/types/src/v28/mod.rs b/types/src/v28/mod.rs index 14b87b9a..7fc3be3f 100644 --- a/types/src/v28/mod.rs +++ b/types/src/v28/mod.rs @@ -297,13 +297,14 @@ pub use crate::{ ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, LockUnspent, Locked, NumericError, PartialSignatureError, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, RescanBlockchain, - ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignFail, - SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SignRawTransactionWithKey, SignRawTransactionWithWallet, - SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, - VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, - WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, + ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, ScriptType, SendRawTransaction, + SendToAddress, SetNetworkActive, SetTxFee, SignFail, SignFailError, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, + SignRawTransactionWithKey, SignRawTransactionWithWallet, SoftforkReject, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, + WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v29/mod.rs b/types/src/v29/mod.rs index c454db41..2ac4f920 100644 --- a/types/src/v29/mod.rs +++ b/types/src/v29/mod.rs @@ -290,13 +290,14 @@ pub use crate::{ ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, LockUnspent, Locked, NumericError, PartialSignatureError, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, RescanBlockchain, - ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignFail, - SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SignRawTransactionWithKey, SignRawTransactionWithWallet, - TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, - VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, - WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, ScanTxOutSetError, ScanTxOutSetAbort, ScanTxOutSetStatus, + ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, ScriptType, SendRawTransaction, + SendToAddress, SetNetworkActive, SetTxFee, SignFail, SignFailError, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, + SignRawTransactionWithKey, SignRawTransactionWithWallet, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WaitForBlock, WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, + WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WitnessUtxo, WitnessUtxoError, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -354,9 +355,9 @@ pub use crate::{ v28::{ CreateWalletDescriptor, GetAddressInfo, GetAddressInfoEmbedded, GetHdKeys, GetHdKeysError, GetNetworkInfo, GetTransaction, HdKey, HdKeyDescriptor, ListSinceBlock, - ListSinceBlockError, ListTransactions, Logging, SubmitPackage, SubmitPackageError, ScanTxOutSetStart, - ScanTxOutSetUnspent, - SubmitPackageTxResult, SubmitPackageTxResultError, SubmitPackageTxResultFees, - SubmitPackageTxResultFeesError, TransactionItem, TransactionItemError, + ListSinceBlockError, ListTransactions, Logging, ScanTxOutSetStart, ScanTxOutSetUnspent, + SubmitPackage, SubmitPackageError, SubmitPackageTxResult, SubmitPackageTxResultError, + SubmitPackageTxResultFees, SubmitPackageTxResultFeesError, TransactionItem, + TransactionItemError, }, }; diff --git a/verify/src/reexports.rs b/verify/src/reexports.rs index 1e346514..65f64ed5 100644 --- a/verify/src/reexports.rs +++ b/verify/src/reexports.rs @@ -52,22 +52,19 @@ pub fn check_type_reexports(version: Version) -> Result<()> { }; for type_name in version_defs.keys() { - let exported = export_map.values().any(|info| { - info.source_version == version_name && type_name == &info.source_ident - }); + let exported = export_map + .values() + .any(|info| info.source_version == version_name && type_name == &info.source_ident); if !exported { - missing.push(format!( - "{} defines {} but does not re-export it", - version_name, type_name - )); + missing + .push(format!("{} defines {} but does not re-export it", version_name, type_name)); } } // Checks all auxiliary types are re-exported. for (exported_name, export) in &export_map { - if let Some(deps) = definitions - .get(&export.source_version) - .and_then(|map| map.get(&export.source_ident)) + if let Some(deps) = + definitions.get(&export.source_version).and_then(|map| map.get(&export.source_ident)) { for dep in deps { if !export_map.contains_key(dep) { @@ -108,10 +105,7 @@ fn collect_version_dirs(src_dir: &Path) -> Result> { } /// Parses all versioned source files and records every public struct/enum name. -fn collect_type_files_and_names( - src_dir: &Path, - versions: &[String], -) -> Result { +fn collect_type_files_and_names(src_dir: &Path, versions: &[String]) -> Result { let mut files = Vec::new(); let mut names = HashSet::new(); @@ -162,14 +156,18 @@ fn collect_type_definitions( match item { Item::Struct(item_struct) if is_public(&item_struct.vis) => { let deps = collect_deps_from_fields(&item_struct.fields, known_names); - defs.entry(version.clone()).or_default().insert(item_struct.ident.to_string(), deps); + defs.entry(version.clone()) + .or_default() + .insert(item_struct.ident.to_string(), deps); } Item::Enum(item_enum) if is_public(&item_enum.vis) => { let mut deps = BTreeSet::new(); for variant in item_enum.variants { deps.extend(collect_deps_from_fields(&variant.fields, known_names)); } - defs.entry(version.clone()).or_default().insert(item_enum.ident.to_string(), deps); + defs.entry(version.clone()) + .or_default() + .insert(item_enum.ident.to_string(), deps); } _ => {} } @@ -180,15 +178,12 @@ fn collect_type_definitions( } /// Reads `mod.rs` for the chosen version and lists its public re-exports. -fn collect_exports( - src_dir: &Path, - version: &str, -) -> Result> { +fn collect_exports(src_dir: &Path, version: &str) -> Result> { let mod_path = src_dir.join(version).join("mod.rs"); - let content = fs::read_to_string(&mod_path) - .with_context(|| format!("reading {}", mod_path.display()))?; - let syntax = syn::parse_file(&content) - .with_context(|| format!("parsing {}", mod_path.display()))?; + let content = + fs::read_to_string(&mod_path).with_context(|| format!("reading {}", mod_path.display()))?; + let syntax = + syn::parse_file(&content).with_context(|| format!("parsing {}", mod_path.display()))?; let mut exports = HashMap::new(); for item in syntax.items { @@ -213,16 +208,14 @@ fn collect_exports( fn collect_deps_from_fields(fields: &Fields, known_names: &HashSet) -> BTreeSet { let mut deps = BTreeSet::new(); match fields { - Fields::Named(named) => { + Fields::Named(named) => for field in &named.named { collect_type_dependencies(&field.ty, known_names, &mut deps); - } - } - Fields::Unnamed(unnamed) => { + }, + Fields::Unnamed(unnamed) => for field in &unnamed.unnamed { collect_type_dependencies(&field.ty, known_names, &mut deps); - } - } + }, Fields::Unit => {} } deps @@ -255,11 +248,10 @@ fn collect_type_dependencies( Type::Reference(reference) => collect_type_dependencies(&reference.elem, known_names, deps), Type::Paren(paren) => collect_type_dependencies(&paren.elem, known_names, deps), Type::Group(group) => collect_type_dependencies(&group.elem, known_names, deps), - Type::Tuple(tuple) => { + Type::Tuple(tuple) => for elem in &tuple.elems { collect_type_dependencies(elem, known_names, deps); - } - } + }, Type::Array(array) => collect_type_dependencies(&array.elem, known_names, deps), Type::Slice(slice) => collect_type_dependencies(&slice.elem, known_names, deps), Type::Ptr(ptr) => collect_type_dependencies(&ptr.elem, known_names, deps), @@ -278,21 +270,17 @@ fn flatten_use_tree(prefix: Vec, tree: &UseTree, acc: &mut Vec UseTree::Rename(rename) => { let mut path = prefix; path.push(rename.ident.to_string()); - acc.push(UseEntry { - path, - rename: Some(rename.rename.to_string()), - }); + acc.push(UseEntry { path, rename: Some(rename.rename.to_string()) }); } UseTree::Path(path) => { let mut new_prefix = prefix; new_prefix.push(path.ident.to_string()); flatten_use_tree(new_prefix, &path.tree, acc); } - UseTree::Group(group) => { + UseTree::Group(group) => for item in &group.items { flatten_use_tree(prefix.clone(), item, acc); - } - } + }, UseTree::Glob(_) => {} } } @@ -303,10 +291,7 @@ fn interpret_flat_use(target_version: &str, entry: &UseEntry) -> Option Some(ExportInfo { From 2a6a4836c6f31907ff86f530e34d68ddefde4b15 Mon Sep 17 00:00:00 2001 From: GideonBature Date: Thu, 4 Dec 2025 17:34:15 +0100 Subject: [PATCH 5/6] Add scantxoutset for bitcoin v30 --- client/src/client_sync/v30/mod.rs | 1 + types/src/v30/mod.rs | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/client/src/client_sync/v30/mod.rs b/client/src/client_sync/v30/mod.rs index 3446ae0e..54e5c899 100644 --- a/client/src/client_sync/v30/mod.rs +++ b/client/src/client_sync/v30/mod.rs @@ -56,6 +56,7 @@ crate::impl_client_v17__precious_block!(); crate::impl_client_v17__prune_blockchain!(); crate::impl_client_v23__save_mempool!(); crate::impl_client_v25__scan_blocks!(); +crate::impl_client_v17__scan_tx_out_set!(); crate::impl_client_v17__verify_chain!(); crate::impl_client_v17__verify_tx_out_proof!(); crate::impl_client_v17__wait_for_block!(); diff --git a/types/src/v30/mod.rs b/types/src/v30/mod.rs index 9fd6453f..34e155c2 100644 --- a/types/src/v30/mod.rs +++ b/types/src/v30/mod.rs @@ -284,14 +284,14 @@ pub use crate::{ ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListUnspentItemError, ListWallets, LockUnspent, Locked, NumericError, PartialSignatureError, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SignRawTransactionWithKey, - SignRawTransactionWithWallet, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WaitForBlock, - WaitForBlockError, WaitForBlockHeight, WaitForBlockHeightError, WaitForNewBlock, - WaitForNewBlockError, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, - WitnessUtxoError, + RawTransactionOutput, RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, + ScanTxOutSetStatus, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, + SetTxFee, SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SignRawTransactionWithKey, SignRawTransactionWithWallet, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WaitForBlock, WaitForBlockError, WaitForBlockHeight, + WaitForBlockHeightError, WaitForNewBlock, WaitForNewBlockError, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WitnessUtxo, WitnessUtxoError, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -343,9 +343,10 @@ pub use crate::{ v28::{ CreateWalletDescriptor, GetAddressInfo, GetAddressInfoEmbedded, GetHdKeys, GetHdKeysError, GetNetworkInfo, GetTransaction, HdKey, HdKeyDescriptor, ListSinceBlock, - ListSinceBlockError, ListTransactions, Logging, SubmitPackage, SubmitPackageError, - SubmitPackageTxResult, SubmitPackageTxResultError, SubmitPackageTxResultFees, - SubmitPackageTxResultFeesError, TransactionItem, TransactionItemError, + ListSinceBlockError, ListTransactions, Logging, ScanTxOutSetStart, ScanTxOutSetUnspent, + SubmitPackage, SubmitPackageError, SubmitPackageTxResult, SubmitPackageTxResultError, + SubmitPackageTxResultFees, SubmitPackageTxResultFeesError, TransactionItem, + TransactionItemError, }, v29::{ ActivityEntry, ChainState, DeriveAddressesMultipath, GetBlockHeader, GetBlockHeaderError, From 7c9e3b55f9b83aadc2893424686c31c9e825cad9 Mon Sep 17 00:00:00 2001 From: GideonBature Date: Thu, 4 Dec 2025 18:30:50 +0100 Subject: [PATCH 6/6] Update the Returns for the scantxoutset method doc --- types/src/v25/mod.rs | 2 +- types/src/v26/mod.rs | 2 +- types/src/v27/mod.rs | 2 +- types/src/v28/mod.rs | 2 +- types/src/v29/mod.rs | 2 +- types/src/v30/mod.rs | 2 +- verify/src/method/v17.rs | 2 +- verify/src/method/v18.rs | 2 +- verify/src/method/v19.rs | 2 +- verify/src/method/v20.rs | 2 +- verify/src/method/v21.rs | 2 +- verify/src/method/v22.rs | 2 +- verify/src/method/v23.rs | 2 +- verify/src/method/v24.rs | 2 +- verify/src/method/v25.rs | 2 +- verify/src/method/v26.rs | 2 +- verify/src/method/v27.rs | 2 +- verify/src/method/v28.rs | 2 +- verify/src/method/v29.rs | 2 +- verify/src/method/v30.rs | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/types/src/v25/mod.rs b/types/src/v25/mod.rs index ed04e500..277bf8a3 100644 --- a/types/src/v25/mod.rs +++ b/types/src/v25/mod.rs @@ -52,7 +52,7 @@ //! | pruneblockchain | version | | //! | savemempool | version | | //! | scanblocks | version + model | | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! diff --git a/types/src/v26/mod.rs b/types/src/v26/mod.rs index 8d728ba4..ee760691 100644 --- a/types/src/v26/mod.rs +++ b/types/src/v26/mod.rs @@ -56,7 +56,7 @@ //! | pruneblockchain | version | | //! | savemempool | version | | //! | scanblocks | version + model | | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! diff --git a/types/src/v27/mod.rs b/types/src/v27/mod.rs index b05b3801..12293c13 100644 --- a/types/src/v27/mod.rs +++ b/types/src/v27/mod.rs @@ -56,7 +56,7 @@ //! | pruneblockchain | version | | //! | savemempool | version | | //! | scanblocks | version + model | | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! diff --git a/types/src/v28/mod.rs b/types/src/v28/mod.rs index 7fc3be3f..c1bead38 100644 --- a/types/src/v28/mod.rs +++ b/types/src/v28/mod.rs @@ -56,7 +56,7 @@ //! | pruneblockchain | version | | //! | savemempool | version | | //! | scanblocks | version + model | | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! diff --git a/types/src/v29/mod.rs b/types/src/v29/mod.rs index 2ac4f920..9ff225d6 100644 --- a/types/src/v29/mod.rs +++ b/types/src/v29/mod.rs @@ -57,7 +57,7 @@ //! | pruneblockchain | version | | //! | savemempool | version | | //! | scanblocks | version + model | | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! diff --git a/types/src/v30/mod.rs b/types/src/v30/mod.rs index 34e155c2..936a1a66 100644 --- a/types/src/v30/mod.rs +++ b/types/src/v30/mod.rs @@ -57,7 +57,7 @@ //! | pruneblockchain | version | | //! | savemempool | version | | //! | scanblocks | version + model | | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! | waitforblock | version + model | | diff --git a/verify/src/method/v17.rs b/verify/src/method/v17.rs index 794bbef1..e14f70e0 100644 --- a/verify/src/method/v17.rs +++ b/verify/src/method/v17.rs @@ -32,7 +32,7 @@ pub const METHODS: &[Method] = &[ Method::new_nothing("preciousblock", "precious_block"), Method::new_no_model("pruneblockchain", "PruneBlockchain", "prune_blockchain"), Method::new_nothing("savemempool", "save_mempool"), - Method::new_modelled("scantxoutset", "ScanTxOutSet", "scan_tx_out_set"), + Method::new_modelled("scantxoutset", "ScanTxOutSetStart", "scan_tx_out_set"), Method::new_no_model("verifychain", "VerifyChain", "verify_chain"), Method::new_modelled("verifytxoutproof", "VerifyTxOutProof", "verify_tx_out_proof"), // control diff --git a/verify/src/method/v18.rs b/verify/src/method/v18.rs index 0e58b075..c32df830 100644 --- a/verify/src/method/v18.rs +++ b/verify/src/method/v18.rs @@ -32,7 +32,7 @@ pub const METHODS: &[Method] = &[ Method::new_nothing("preciousblock", "precious_block"), Method::new_no_model("pruneblockchain", "PruneBlockchain", "prune_blockchain"), Method::new_nothing("savemempool", "save_mempool"), - Method::new_modelled("scantxoutset", "ScanTxOutSet", "scan_tx_out_set"), + Method::new_modelled("scantxoutset", "ScanTxOutSetStart", "scan_tx_out_set"), Method::new_no_model("verifychain", "VerifyChain", "verify_chain"), Method::new_modelled("verifytxoutproof", "VerifyTxOutProof", "verify_tx_out_proof"), // control diff --git a/verify/src/method/v19.rs b/verify/src/method/v19.rs index a2127ab4..f4f18693 100644 --- a/verify/src/method/v19.rs +++ b/verify/src/method/v19.rs @@ -33,7 +33,7 @@ pub const METHODS: &[Method] = &[ Method::new_nothing("preciousblock", "precious_block"), Method::new_no_model("pruneblockchain", "PruneBlockchain", "prune_blockchain"), Method::new_nothing("savemempool", "save_mempool"), - Method::new_modelled("scantxoutset", "ScanTxOutSet", "scan_tx_out_set"), + Method::new_modelled("scantxoutset", "ScanTxOutSetStart", "scan_tx_out_set"), Method::new_no_model("verifychain", "VerifyChain", "verify_chain"), Method::new_modelled("verifytxoutproof", "VerifyTxOutProof", "verify_tx_out_proof"), Method::new_no_model("getrpcinfo", "GetRpcInfo", "get_rpc_info"), diff --git a/verify/src/method/v20.rs b/verify/src/method/v20.rs index b6dd89aa..0bc05ae9 100644 --- a/verify/src/method/v20.rs +++ b/verify/src/method/v20.rs @@ -33,7 +33,7 @@ pub const METHODS: &[Method] = &[ Method::new_nothing("preciousblock", "precious_block"), Method::new_no_model("pruneblockchain", "PruneBlockchain", "prune_blockchain"), Method::new_nothing("savemempool", "save_mempool"), - Method::new_modelled("scantxoutset", "ScanTxOutSet", "scan_tx_out_set"), + Method::new_modelled("scantxoutset", "ScanTxOutSetStart", "scan_tx_out_set"), Method::new_no_model("verifychain", "VerifyChain", "verify_chain"), Method::new_modelled("verifytxoutproof", "VerifyTxOutProof", "verify_tx_out_proof"), Method::new_no_model("getrpcinfo", "GetRpcInfo", "get_rpc_info"), diff --git a/verify/src/method/v21.rs b/verify/src/method/v21.rs index 4bf08f1a..8f736608 100644 --- a/verify/src/method/v21.rs +++ b/verify/src/method/v21.rs @@ -33,7 +33,7 @@ pub const METHODS: &[Method] = &[ Method::new_nothing("preciousblock", "precious_block"), Method::new_no_model("pruneblockchain", "PruneBlockchain", "prune_blockchain"), Method::new_nothing("savemempool", "save_mempool"), - Method::new_modelled("scantxoutset", "ScanTxOutSet", "scan_tx_out_set"), + Method::new_modelled("scantxoutset", "ScanTxOutSetStart", "scan_tx_out_set"), Method::new_no_model("verifychain", "VerifyChain", "verify_chain"), Method::new_modelled("verifytxoutproof", "VerifyTxOutProof", "verify_tx_out_proof"), // control diff --git a/verify/src/method/v22.rs b/verify/src/method/v22.rs index 6b7ef498..7bd79055 100644 --- a/verify/src/method/v22.rs +++ b/verify/src/method/v22.rs @@ -33,7 +33,7 @@ pub const METHODS: &[Method] = &[ Method::new_nothing("preciousblock", "precious_block"), Method::new_no_model("pruneblockchain", "PruneBlockchain", "prune_blockchain"), Method::new_nothing("savemempool", "save_mempool"), - Method::new_modelled("scantxoutset", "ScanTxOutSet", "scan_tx_out_set"), + Method::new_modelled("scantxoutset", "ScanTxOutSetStart", "scan_tx_out_set"), Method::new_no_model("verifychain", "VerifyChain", "verify_chain"), Method::new_modelled("verifytxoutproof", "VerifyTxOutProof", "verify_tx_out_proof"), // control diff --git a/verify/src/method/v23.rs b/verify/src/method/v23.rs index 290d5daa..1f7ba624 100644 --- a/verify/src/method/v23.rs +++ b/verify/src/method/v23.rs @@ -35,7 +35,7 @@ pub const METHODS: &[Method] = &[ Method::new_nothing("preciousblock", "precious_block"), Method::new_no_model("pruneblockchain", "PruneBlockchain", "prune_blockchain"), Method::new_no_model("savemempool", "SaveMempool", "save_mempool"), - Method::new_modelled("scantxoutset", "ScanTxOutSet", "scan_tx_out_set"), + Method::new_modelled("scantxoutset", "ScanTxOutSetStart", "scan_tx_out_set"), Method::new_no_model("verifychain", "VerifyChain", "verify_chain"), Method::new_modelled("verifytxoutproof", "VerifyTxOutProof", "verify_tx_out_proof"), // control diff --git a/verify/src/method/v24.rs b/verify/src/method/v24.rs index 22bc17ef..66055981 100644 --- a/verify/src/method/v24.rs +++ b/verify/src/method/v24.rs @@ -36,7 +36,7 @@ pub const METHODS: &[Method] = &[ Method::new_nothing("preciousblock", "precious_block"), Method::new_no_model("pruneblockchain", "PruneBlockchain", "prune_blockchain"), Method::new_no_model("savemempool", "SaveMempool", "save_mempool"), - Method::new_modelled("scantxoutset", "ScanTxOutSet", "scan_tx_out_set"), + Method::new_modelled("scantxoutset", "ScanTxOutSetStart", "scan_tx_out_set"), Method::new_no_model("verifychain", "VerifyChain", "verify_chain"), Method::new_modelled("verifytxoutproof", "VerifyTxOutProof", "verify_tx_out_proof"), // control diff --git a/verify/src/method/v25.rs b/verify/src/method/v25.rs index 4a5603ee..2566594a 100644 --- a/verify/src/method/v25.rs +++ b/verify/src/method/v25.rs @@ -37,7 +37,7 @@ pub const METHODS: &[Method] = &[ Method::new_no_model("pruneblockchain", "PruneBlockchain", "prune_blockchain"), Method::new_no_model("savemempool", "SaveMempool", "save_mempool"), Method::new_modelled("scanblocks", "ScanBlocksStart", "scan_blocks"), - Method::new_modelled("scantxoutset", "ScanTxOutSet", "scan_tx_out_set"), + Method::new_modelled("scantxoutset", "ScanTxOutSetStart", "scan_tx_out_set"), Method::new_no_model("verifychain", "VerifyChain", "verify_chain"), Method::new_modelled("verifytxoutproof", "VerifyTxOutProof", "verify_tx_out_proof"), // control diff --git a/verify/src/method/v26.rs b/verify/src/method/v26.rs index a8329fe2..771c6972 100644 --- a/verify/src/method/v26.rs +++ b/verify/src/method/v26.rs @@ -41,7 +41,7 @@ pub const METHODS: &[Method] = &[ Method::new_no_model("pruneblockchain", "PruneBlockchain", "prune_blockchain"), Method::new_no_model("savemempool", "SaveMempool", "save_mempool"), Method::new_modelled("scanblocks", "ScanBlocksStart", "scan_blocks"), - Method::new_modelled("scantxoutset", "ScanTxOutSet", "scan_tx_out_set"), + Method::new_modelled("scantxoutset", "ScanTxOutSetStart", "scan_tx_out_set"), Method::new_no_model("verifychain", "VerifyChain", "verify_chain"), Method::new_modelled("verifytxoutproof", "VerifyTxOutProof", "verify_tx_out_proof"), // control diff --git a/verify/src/method/v27.rs b/verify/src/method/v27.rs index 6a05663c..5497566b 100644 --- a/verify/src/method/v27.rs +++ b/verify/src/method/v27.rs @@ -41,7 +41,7 @@ pub const METHODS: &[Method] = &[ Method::new_no_model("pruneblockchain", "PruneBlockchain", "prune_blockchain"), Method::new_no_model("savemempool", "SaveMempool", "save_mempool"), Method::new_modelled("scanblocks", "ScanBlocksStart", "scan_blocks"), - Method::new_modelled("scantxoutset", "ScanTxOutSet", "scan_tx_out_set"), + Method::new_modelled("scantxoutset", "ScanTxOutSetStart", "scan_tx_out_set"), Method::new_no_model("verifychain", "VerifyChain", "verify_chain"), Method::new_modelled("verifytxoutproof", "VerifyTxOutProof", "verify_tx_out_proof"), Method::new_no_model("getrpcinfo", "GetRpcInfo", "get_rpc_info"), diff --git a/verify/src/method/v28.rs b/verify/src/method/v28.rs index eebcb626..51174e1e 100644 --- a/verify/src/method/v28.rs +++ b/verify/src/method/v28.rs @@ -41,7 +41,7 @@ pub const METHODS: &[Method] = &[ Method::new_no_model("pruneblockchain", "PruneBlockchain", "prune_blockchain"), Method::new_no_model("savemempool", "SaveMempool", "save_mempool"), Method::new_modelled("scanblocks", "ScanBlocksStart", "scan_blocks"), - Method::new_modelled("scantxoutset", "ScanTxOutSet", "scan_tx_out_set"), + Method::new_modelled("scantxoutset", "ScanTxOutSetStart", "scan_tx_out_set"), Method::new_no_model("verifychain", "VerifyChain", "verify_chain"), Method::new_modelled("verifytxoutproof", "VerifyTxOutProof", "verify_tx_out_proof"), Method::new_no_model("getrpcinfo", "GetRpcInfo", "get_rpc_info"), diff --git a/verify/src/method/v29.rs b/verify/src/method/v29.rs index 926f641e..79343d99 100644 --- a/verify/src/method/v29.rs +++ b/verify/src/method/v29.rs @@ -46,7 +46,7 @@ pub const METHODS: &[Method] = &[ Method::new_no_model("pruneblockchain", "PruneBlockchain", "prune_blockchain"), Method::new_no_model("savemempool", "SaveMempool", "save_mempool"), Method::new_modelled("scanblocks", "ScanBlocksStart", "scan_blocks"), - Method::new_modelled("scantxoutset", "ScanTxOutSet", "scan_tx_out_set"), + Method::new_modelled("scantxoutset", "ScanTxOutSetStart", "scan_tx_out_set"), Method::new_no_model("verifychain", "VerifyChain", "verify_chain"), Method::new_modelled("verifytxoutproof", "VerifyTxOutProof", "verify_tx_out_proof"), // control diff --git a/verify/src/method/v30.rs b/verify/src/method/v30.rs index 74b9a0e1..92a36a7d 100644 --- a/verify/src/method/v30.rs +++ b/verify/src/method/v30.rs @@ -46,7 +46,7 @@ pub const METHODS: &[Method] = &[ Method::new_no_model("pruneblockchain", "PruneBlockchain", "prune_blockchain"), Method::new_no_model("savemempool", "SaveMempool", "save_mempool"), Method::new_modelled("scanblocks", "ScanBlocksStart", "scan_blocks"), - Method::new_modelled("scantxoutset", "ScanTxOutSet", "scan_tx_out_set"), + Method::new_modelled("scantxoutset", "ScanTxOutSetStart", "scan_tx_out_set"), Method::new_no_model("verifychain", "VerifyChain", "verify_chain"), Method::new_modelled("verifytxoutproof", "VerifyTxOutProof", "verify_tx_out_proof"), Method::new_modelled("waitforblock", "WaitForBlock", "wait_for_block"),