From de771f3478ba169018aaf5cca5d98ff283c8d65f Mon Sep 17 00:00:00 2001 From: GideonBature Date: Tue, 13 May 2025 00:17:49 +0100 Subject: [PATCH 1/2] 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 | 23 ++ 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 | 22 ++ types/src/model/blockchain.rs | 39 ++ types/src/model/mod.rs | 3 +- 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 | 52 ++- types/src/v18/blockchain/mod.rs | 35 +- types/src/v18/mod.rs | 21 +- types/src/v19/blockchain/into.rs | 50 ++- types/src/v19/blockchain/mod.rs | 44 ++- types/src/v19/mod.rs | 17 +- types/src/v20/mod.rs | 16 +- types/src/v21/mod.rs | 15 +- types/src/v22/mod.rs | 16 +- types/src/v23/mod.rs | 18 +- types/src/v24/mod.rs | 18 +- types/src/v25/blockchain/into.rs | 54 ++- types/src/v25/blockchain/mod.rs | 374 +++++++++++++++++- types/src/v25/mod.rs | 15 +- types/src/v26/mod.rs | 17 +- types/src/v27/mod.rs | 17 +- types/src/v28/blockchain/into.rs | 53 +++ .../v28/{blockchain.rs => blockchain/mod.rs} | 53 ++- types/src/v28/mod.rs | 17 +- types/src/v29/mod.rs | 13 +- 41 files changed, 1071 insertions(+), 103 deletions(-) create mode 100644 types/src/v28/blockchain/into.rs rename types/src/v28/{blockchain.rs => blockchain/mod.rs} (70%) diff --git a/client/src/client_sync/v17/blockchain.rs b/client/src/client_sync/v17/blockchain.rs index 280db179..5ba2bdd9 100644 --- a/client/src/client_sync/v17/blockchain.rs +++ b/client/src/client_sync/v17/blockchain.rs @@ -318,6 +318,29 @@ macro_rules! impl_client_v17__save_mempool { }; } +/// 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 717bf7e8..28f7a802 100644 --- a/client/src/client_sync/v17/mod.rs +++ b/client/src/client_sync/v17/mod.rs @@ -48,6 +48,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 b5ad837f..15bff3c3 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 153ea3f8..fd5e247c 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 1e2bd38e..bf7d3acd 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 a4dce4fe..ed037106 100644 --- a/client/src/client_sync/v21/mod.rs +++ b/client/src/client_sync/v21/mod.rs @@ -52,6 +52,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 f58586de..2479b67a 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 66f4b07c..0208918f 100644 --- a/client/src/client_sync/v23/mod.rs +++ b/client/src/client_sync/v23/mod.rs @@ -52,6 +52,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 62663262..f7c1f9aa 100644 --- a/client/src/client_sync/v24/mod.rs +++ b/client/src/client_sync/v24/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_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 0c5f280f..9635f86c 100644 --- a/client/src/client_sync/v25/mod.rs +++ b/client/src/client_sync/v25/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_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/v26/mod.rs b/client/src/client_sync/v26/mod.rs index e4eefd55..8d113b31 100644 --- a/client/src/client_sync/v26/mod.rs +++ b/client/src/client_sync/v26/mod.rs @@ -53,6 +53,7 @@ crate::impl_client_v26__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/v27/mod.rs b/client/src/client_sync/v27/mod.rs index 3644deee..5792dbd5 100644 --- a/client/src/client_sync/v27/mod.rs +++ b/client/src/client_sync/v27/mod.rs @@ -49,6 +49,7 @@ crate::impl_client_v26__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/v28/mod.rs b/client/src/client_sync/v28/mod.rs index 0f89523f..8b3eecd0 100644 --- a/client/src/client_sync/v28/mod.rs +++ b/client/src/client_sync/v28/mod.rs @@ -51,9 +51,11 @@ crate::impl_client_v26__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!(); + // == 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 39e9055d..d77028ee 100644 --- a/client/src/client_sync/v29/mod.rs +++ b/client/src/client_sync/v29/mod.rs @@ -19,7 +19,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, }; @@ -51,6 +52,7 @@ crate::impl_client_v26__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/integration_test/tests/blockchain.rs b/integration_test/tests/blockchain.rs index 1ecbeb27..28ed5850 100644 --- a/integration_test/tests/blockchain.rs +++ b/integration_test/tests/blockchain.rs @@ -302,6 +302,28 @@ fn blockchain__savemempool() { } } +#[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, &[]); diff --git a/types/src/model/blockchain.rs b/types/src/model/blockchain.rs index 203521f0..b19d6fdb 100644 --- a/types/src/model/blockchain.rs +++ b/types/src/model/blockchain.rs @@ -621,3 +621,42 @@ pub struct ReceiveActivity { /// The ScriptPubKey, converted to `model::ScriptPubkey`. pub output_spk: ScriptPubkey, } + +/// 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 27d85b66..c3b14bf6 100644 --- a/types/src/model/mod.rs +++ b/types/src/model/mod.rs @@ -28,7 +28,8 @@ pub use self::{ GetDescriptorActivity, GetDifficulty, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, GetRawMempool, GetRawMempoolVerbose, GetTxOut, GetTxOutSetInfo, MempoolEntry, - MempoolEntryFees, ReceiveActivity, Softfork, SoftforkType, SpendActivity, VerifyTxOutProof, + MempoolEntryFees, ReceiveActivity, ScanTxOutSetStart, + ScanTxOutSetUnspent, Softfork, SoftforkType, SpendActivity, VerifyTxOutProof, }, generating::{Generate, GenerateBlock, GenerateToAddress, GenerateToDescriptor}, mining::{ diff --git a/types/src/v17/blockchain/error.rs b/types/src/v17/blockchain/error.rs index f32b8692..4216e387 100644 --- a/types/src/v17/blockchain/error.rs +++ b/types/src/v17/blockchain/error.rs @@ -564,3 +564,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 d3fcdd1d..6e2ff99a 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::*; @@ -550,6 +550,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 3d2bd419..69bea04e 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)] #[serde(deny_unknown_fields)] diff --git a/types/src/v17/mod.rs b/types/src/v17/mod.rs index 7dd2293b..78bc2212 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 | | //! //! @@ -243,7 +243,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 8ccf6f86..0e51b898 100644 --- a/types/src/v18/blockchain/into.rs +++ b/types/src/v18/blockchain/into.rs @@ -1,8 +1,11 @@ // SPDX-License-Identifier: CC0-1.0 -use bitcoin::{Txid, Wtxid}; +use bitcoin::{Amount, ScriptBuf, Txid, Wtxid}; -use super::{GetMempoolEntry, MempoolEntry, MempoolEntryError}; +use super::{ + GetMempoolEntry, MempoolEntry, MempoolEntryError, ScanTxOutSetError, + ScanTxOutSetStart, ScanTxOutSetUnspent, +}; use crate::model; impl GetMempoolEntry { @@ -59,3 +62,48 @@ impl MempoolEntry { }) } } + +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: 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 c5573274..d3f9df7e 100644 --- a/types/src/v18/blockchain/mod.rs +++ b/types/src/v18/blockchain/mod.rs @@ -8,7 +8,7 @@ mod into; use serde::{Deserialize, Serialize}; -use super::{MempoolEntryError, MempoolEntryFees}; +use super::{MempoolEntryError, MempoolEntryFees, ScanTxOutSetError}; /// Result of JSON-RPC method `getmempoolentry`. /// @@ -70,3 +70,36 @@ pub struct MempoolEntry { #[serde(rename = "bip125-replaceable")] pub bip125_replaceable: bool, } + +/// 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 441ffac0..755d00a6 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 | | //! //! @@ -232,7 +233,10 @@ mod wallet; #[doc(inline)] pub use self::{ - blockchain::{GetMempoolEntry, MempoolEntry}, + blockchain::{ + GetMempoolEntry, MempoolEntry, ScanTxOutSetStart, + ScanTxOutSetUnspent, + }, control::{ActiveCommand, GetRpcInfo}, network::{GetNodeAddresses, GetPeerInfo, NodeAddress, PeerInfo}, raw_transactions::{ @@ -276,10 +280,11 @@ pub use crate::v17::{ ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, Logging, MapMempoolEntryError, MempoolAcceptance, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PruneBlockchain, PsbtInput, PsbtOutput, PsbtScript, RawTransaction, - RawTransactionError, RawTransactionInput, RawTransactionOutput, RescanBlockchain, SendMany, - SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignFail, SignFailError, - SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, Softfork, - SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + RawTransactionError, RawTransactionInput, RawTransactionOutput, RescanBlockchain, + ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, + SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, Softfork, SoftforkReject, TestMempoolAccept, TransactionCategory, + UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, + VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, + WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, }; diff --git a/types/src/v19/blockchain/into.rs b/types/src/v19/blockchain/into.rs index d90b6b97..4fded683 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,6 +13,7 @@ use super::{ GetBlockFilter, GetBlockchainInfo, GetChainTxStats, GetChainTxStatsError, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, GetMempoolInfoError, MempoolEntry, MempoolEntryFees, + ScanTxOutSetError, ScanTxOutSetStart, ScanTxOutSetUnspent, }; use crate::model; @@ -236,3 +237,50 @@ impl GetMempoolInfo { }) } } + +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)?; + + 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 09fe4931..994db25d 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`. /// @@ -341,3 +341,45 @@ pub struct GetMempoolInfo { #[serde(rename = "minrelaytxfee")] pub min_relay_tx_fee: f64, } + +/// 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 376ced98..38099523 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 | | //! @@ -238,8 +238,8 @@ pub use self::{ GetBlockFilterError, GetBlockchainInfo, GetBlockchainInfoError, GetChainTxStats, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, MapMempoolEntryError, - MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, Softfork, - SoftforkType, + MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, + ScanTxOutSetStart, ScanTxOutSetUnspent, Softfork, SoftforkType, }, control::GetRpcInfo, network::{GetNetworkInfo, GetPeerInfo, PeerInfo}, @@ -276,11 +276,12 @@ pub use crate::v17::{ ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, Logging, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + RawTransactionOutput, RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, + SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, + SignRawTransaction, SignRawTransactionError, SoftforkReject, TestMempoolAccept, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WalletProcessPsbt, WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, }; #[doc(inline)] pub use crate::v18::{ diff --git a/types/src/v20/mod.rs b/types/src/v20/mod.rs index 878c8b3b..e6231592 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 | | //! @@ -268,12 +268,12 @@ pub use crate::{ ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, + RawTransactionOutput, RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, + SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, + SignRawTransaction, SignRawTransactionError, SoftforkReject, TestMempoolAccept, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WalletProcessPsbt, WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -289,6 +289,6 @@ pub use crate::{ GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, GetNetworkInfo, GetPeerInfo, GetRpcInfo, MapMempoolEntryError, MempoolEntry, MempoolEntryError, MempoolEntryFees, - MempoolEntryFeesError, PeerInfo, SetWalletFlag, Softfork, SoftforkType, + MempoolEntryFeesError, PeerInfo, ScanTxOutSetStart, ScanTxOutSetUnspent, SetWalletFlag, Softfork, SoftforkType, }, }; diff --git a/types/src/v21/mod.rs b/types/src/v21/mod.rs index 7844fe31..07ae3326 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 | | //! @@ -280,11 +280,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, - SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, + UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, + VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, + WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -299,7 +300,7 @@ pub use crate::{ GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError, MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo, - SetWalletFlag, + ScanTxOutSetStart, ScanTxOutSetUnspent, SetWalletFlag, }, v20::{ Banned, CreateMultisig, GenerateToDescriptor, GetTransaction, GetTransactionDetail, diff --git a/types/src/v22/mod.rs b/types/src/v22/mod.rs index 5bf1ca1f..bb8cf824 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 | | //! @@ -286,12 +286,12 @@ pub use crate::{ ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, + RawTransactionOutput, RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, + SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, + SignRawTransaction, SignRawTransactionError, SoftforkReject, TestMempoolAccept, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WalletProcessPsbt, WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -306,7 +306,7 @@ pub use crate::{ GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError, MempoolEntry, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo, - SetWalletFlag, + ScanTxOutSetStart, ScanTxOutSetUnspent, SetWalletFlag, }, v20::{CreateMultisig, GenerateToDescriptor, GetTransaction, GetTransactionDetail}, v21::{ diff --git a/types/src/v23/mod.rs b/types/src/v23/mod.rs index b20413d7..0afc3b45 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 | | //! @@ -282,11 +282,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, - SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, + UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, + VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, + WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -301,8 +302,9 @@ pub use crate::{ GetBlockFilterError, GetBlockchainInfoError, GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError, MempoolEntry, - MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo, SetWalletFlag, - Softfork, SoftforkType, + MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo, + ScanTxOutSetStart, ScanTxOutSetUnspent, SetWalletFlag, Softfork, + SoftforkType, }, v20::{GenerateToDescriptor, GetTransactionDetail}, v21::{ diff --git a/types/src/v24/mod.rs b/types/src/v24/mod.rs index d0f50b69..2a526fdc 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 | | //! @@ -284,11 +284,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, - SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, + UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, + VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, + WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -302,8 +303,9 @@ pub use crate::{ GetBlockFilterError, GetBlockchainInfoError, GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError, MempoolEntry, - MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo, SetWalletFlag, - Softfork, SoftforkType, + MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo, + 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 b00e37c3..6038707a 100644 --- a/types/src/v25/blockchain/into.rs +++ b/types/src/v25/blockchain/into.rs @@ -1,8 +1,11 @@ // SPDX-License-Identifier: CC0-1.0 -use bitcoin::{Amount, BlockHash, FeeRate, Weight}; +use bitcoin::{Amount, BlockHash, FeeRate, ScriptBuf, Txid, Weight}; -use super::{GetBlockStats, GetBlockStatsError}; +use super::{ + GetBlockStats, GetBlockStatsError, ScanTxOutSetError, ScanTxOutSetStart, + ScanTxOutSetUnspent, +}; use crate::model; impl GetBlockStats { @@ -60,3 +63,50 @@ impl GetBlockStats { }) } } + +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)?; + + 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 2f659588..1d521eaf 100644 --- a/types/src/v25/blockchain/mod.rs +++ b/types/src/v25/blockchain/mod.rs @@ -6,9 +6,10 @@ mod into; +use alloc::collections::BTreeMap; use serde::{Deserialize, Serialize}; -pub use super::GetBlockStatsError; +pub use super::{GetBlockStatsError, ScanTxOutSetError}; /// Result of JSON-RPC method `getblockstats`. /// @@ -115,3 +116,374 @@ pub struct GetBlockStats { #[serde(rename = "utxo_size_inc_actual")] pub utxo_size_increase_actual: Option, } + +/// Result of JSON-RPC method `getblockchaininfo`. +/// +/// > getblockchaininfo +/// > +/// > Returns an object containing various state info regarding blockchain processing. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetBlockchainInfo { + /// Current network name as defined in BIP70 (main, test, signet, regtest). + pub chain: String, + /// The current number of blocks processed in the server. + pub blocks: i64, + /// The current number of headers we have validated. + pub headers: i64, + /// The hash of the currently best block. + #[serde(rename = "bestblockhash")] + pub best_block_hash: String, + /// The current difficulty. + pub difficulty: f64, + /// Median time for the current best block. + #[serde(rename = "mediantime")] + pub median_time: i64, + /// Estimate of verification progress (between 0 and 1). + #[serde(rename = "verificationprogress")] + pub verification_progress: f64, + /// Estimate of whether this node is in Initial Block Download (IBD) mode. + #[serde(rename = "initialblockdownload")] + pub initial_block_download: bool, + /// Total amount of work in active chain, in hexadecimal. + #[serde(rename = "chainwork")] + pub chain_work: String, + /// The estimated size of the block and undo files on disk. + pub size_on_disk: u64, + /// If the blocks are subject to pruning. + pub pruned: bool, + /// Lowest-height complete block stored (only present if pruning is enabled). + #[serde(rename = "pruneheight")] + pub prune_height: Option, + /// Whether automatic pruning is enabled (only present if pruning is enabled). + pub automatic_pruning: Option, + /// The target size used by pruning (only present if automatic pruning is enabled). + pub prune_target_size: Option, + /// Status of softforks in progress, maps softfork name -> [`Softfork`]. + #[serde(default)] + pub softforks: BTreeMap, + /// Any network and blockchain warnings. + pub warnings: String, +} + +/// Status of softfork. +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct Softfork { + /// The [`SoftforkType`]: one of "buried", "bip9". + #[serde(rename = "type")] + pub type_: SoftforkType, + /// The status of bip9 softforks (only for "bip9" type). + pub bip9: Option, + /// Height of the first block which the rules are or will be enforced (only for "buried" type, or "bip9" type with "active" status). + pub height: Option, + /// `true` if the rules are enforced for the mempool and the next block. + pub active: bool, +} + +/// The softfork type: one of "buried", "bip9". +#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] +#[serde(rename_all = "lowercase")] +pub enum SoftforkType { + /// Softfork is "buried" (as defined in [BIP-90]). + /// + /// [BIP-90] + Buried, + /// Softfork is "bip9" (see [BIP-9]). + /// + /// [BIP-9] + Bip9, +} + +/// Status of BIP-9 softforks. +#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct Bip9SoftforkInfo { + /// One of "defined", "started", "locked_in", "active", "failed". + pub status: Bip9SoftforkStatus, + /// The bit (0-28) in the block version field used to signal this softfork (only for "started" status). + pub bit: Option, + /// The minimum median time past of a block at which the bit gains its meaning. + pub start_time: i64, + /// The median time past of a block at which the deployment is considered failed if not yet locked in. + pub timeout: i64, + /// Height of the first block to which the status applies. + pub since: i64, + /// Numeric statistics about BIP-9 signalling for a softfork (only for "started" status). + pub statistics: Option, +} + +/// BIP-9 softfork status: one of "defined", "started", "locked_in", "active", "failed". +#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] +#[serde(rename_all = "snake_case")] +pub enum Bip9SoftforkStatus { + /// BIP-9 softfork status "defined". + Defined, + /// BIP-9 softfork status "started". + Started, + /// BIP-9 softfork status "locked_in". + LockedIn, + /// BIP-9 softfork status "active". + Active, + /// BIP-9 softfork status "failed". + Failed, +} + +/// Statistics for a BIP-9 softfork. +#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct Bip9SoftforkStatistics { + /// The length in blocks of the BIP9 signalling period. + pub period: i64, + /// The number of blocks with the version bit set required to activate the feature. + pub threshold: Option, + /// The number of blocks elapsed since the beginning of the current period. + pub elapsed: i64, + /// The number of blocks with the version bit set in the current period. + pub count: i64, + /// `false` if there are not enough blocks left in this period to pass activation threshold. + pub possible: Option, +} + +/// Result of JSON-RPC method `getblockfilter`. +/// +/// > getblockfilter "blockhash" ( "filtertype" ) +/// > +/// > Retrieve a BIP 157 content filter for a particular block. +/// > +/// > Arguments: +/// > 1. blockhash (string, required) The hash of the block +/// > 2. filtertype (string, optional, default=basic) The type name of the filter +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetBlockFilter { + /// The hex-encoded filter data. + pub filter: String, + /// The hex-encoded filter header. + pub header: String, +} + +/// Result of JSON-RPC method `getchaintxstats`. +/// +/// > getchaintxstats ( nblocks blockhash ) +/// > +/// > Compute statistics about the total number and rate of transactions in the chain. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetChainTxStats { + /// The timestamp for the final block in the window in UNIX format. + pub time: i64, + /// The total number of transactions in the chain up to that point. + #[serde(rename = "txcount")] + pub tx_count: i64, + /// The hash of the final block in the window. + pub window_final_block_hash: String, + /// The height of the final block in the window. + pub window_final_block_height: i64, + /// Size of the window in number of blocks. + pub window_block_count: i64, + /// The number of transactions in the window. Only returned if "window_block_count" is > 0. + pub window_tx_count: Option, + /// The elapsed time in the window in seconds. Only returned if "window_block_count" is > 0. + pub window_interval: Option, + /// The average rate of transactions per second in the window. Only returned if "window_interval" is > 0. + #[serde(rename = "txrate")] + pub tx_rate: Option, +} + +/// Result of JSON-RPC method `getmempoolancestors` with verbose set to `false`. +/// +/// > getmempoolancestors txid (verbose) +/// > +/// > If txid is in the mempool, returns all in-mempool ancestors. +/// > +/// > Arguments: +/// > 1. "txid" (string, required) The transaction id (must be in mempool) +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetMempoolAncestors(pub Vec); + +/// Result of JSON-RPC method `getmempoolancestors` with verbose set to true. +/// +/// Map of txid to `MempoolEntry` i.e., an ancestor. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetMempoolAncestorsVerbose(pub BTreeMap); + +/// Result of JSON-RPC method `getmempooldescendants` with verbose set to `false`. +/// +/// > getmempooldescendants txid (verbose) +/// > +/// > If txid is in the mempool, returns all in-mempool descendants. +/// > +/// > Arguments: +/// > 1. "txid" (string, required) The transaction id (must be in mempool) +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetMempoolDescendants(pub Vec); + +/// Result of JSON-RPC method `getmempooldescendants` with verbose set to true. +/// +/// Map of txid to [`MempoolEntry`] i.e., a descendant. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetMempoolDescendantsVerbose(pub BTreeMap); + +/// Result of JSON-RPC method `getmempoolentry`. +/// +/// > getmempoolentry txid +/// > +/// > Returns mempool data for given transaction +/// > +/// > Arguments: +/// > 1. "txid" (string, required) The transaction id (must be in mempool) +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetMempoolEntry(pub MempoolEntry); + +/// A relative (ancestor or descendant) transaction of a transaction in the mempool. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct MempoolEntry { + /// Virtual transaction size as defined in BIP 141. + /// + /// This is different from actual serialized size for witness transactions as witness data is discounted. v0.19 and later only. + pub vsize: i64, + /// DEPRECATED: same as vsize. Only returned if bitcoind is started with -deprecatedrpc=size + /// size will be completely removed in v0.20. + pub size: Option, + /// Transaction weight as defined in BIP 141. + pub weight: i64, + /// DEPRECATED: Transaction fee in BTC. + pub fee: f64, + /// DEPRECATED: Transaction fee with fee deltas used for mining priority. + #[serde(rename = "modifiedfee")] + pub modified_fee: f64, + /// Local time transaction entered pool in seconds since 1 Jan 1970 GMT. + pub time: i64, + /// Block height when transaction entered pool. + pub height: i64, + /// Number of in-mempool descendant transactions (including this one). + #[serde(rename = "descendantcount")] + pub descendant_count: i64, + /// Virtual transaction size of in-mempool descendants (including this one). + #[serde(rename = "descendantsize")] + pub descendant_size: i64, + /// DEPRECATED: Modified fees (see above) of in-mempool descendants (including this one). + #[serde(rename = "descendantfees")] + pub descendant_fees: f64, + /// Number of in-mempool ancestor transactions (including this one). + #[serde(rename = "ancestorcount")] + pub ancestor_count: i64, + /// Virtual transaction size of in-mempool ancestors (including this one). + #[serde(rename = "ancestorsize")] + pub ancestor_size: i64, + /// DEPRECATED: Modified fees (see above) of in-mempool ancestors (including this one). + #[serde(rename = "ancestorfees")] + pub ancestor_fees: f64, + /// Hash of serialized transaction, including witness data. + pub wtxid: String, + /// Fee object which contains the base fee, modified fee (with fee deltas), and + /// ancestor/descendant fee totals all in BTC. + pub fees: MempoolEntryFees, + /// Unconfirmed transactions used as inputs for this transaction (parent transaction id). + pub depends: Vec, + /// Unconfirmed transactions spending outputs from this transaction (child transaction id). + #[serde(rename = "spentby")] + pub spent_by: Vec, + /// Whether this transaction could be replaced due to BIP125 (replace-by-fee) + #[serde(rename = "bip125-replaceable")] + pub bip125_replaceable: bool, +} + +/// The `fees` field from the result of JSON-RPC method `getmempoolentry`. +/// +/// Contains the base fee, modified fee (with fee deltas), and ancestor/descendant fee totals, +/// all in BTC. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct MempoolEntryFees { + /// Transaction fee in BTC. + pub base: f64, + /// Transaction fee with fee deltas used for mining priority in BTC. + pub modified: f64, + /// Modified fees (see above) of in-mempool ancestors (including this one) in BTC + pub ancestor: f64, + /// Modified fees (see above) of in-mempool descendants (including this one) in BTC. + pub descendant: f64, +} + +/// Result of JSON-RPC method `getmempoolinfo` with verbose set to `true`. +/// +/// > getmempoolinfo +/// > +/// > Returns details on the active state of the TX memory pool. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetMempoolInfo { + /// True if the mempool is fully loaded. v0.19 and later only. + pub loaded: bool, + /// Current transaction count. + pub size: i64, + /// Sum of all virtual transaction sizes as defined in BIP 141. + /// + /// Differs from actual serialized size because witness data is discounted. + pub bytes: i64, + /// Total memory usage for the mempool. + pub usage: i64, + /// Maximum memory usage for the mempool. + #[serde(rename = "maxmempool")] + pub max_mempool: i64, + /// Minimum fee rate in BTC/kB for a transaction to be accepted. + /// + /// This is the maximum of `minrelaytxfee` and the minimum mempool fee. + #[serde(rename = "mempoolminfee")] + pub mempool_min_fee: f64, + /// Current minimum relay fee for transactions. + #[serde(rename = "minrelaytxfee")] + pub min_relay_tx_fee: f64, +} + +/// 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, +} diff --git a/types/src/v25/mod.rs b/types/src/v25/mod.rs index 0f027ca5..6f84862b 100644 --- a/types/src/v25/mod.rs +++ b/types/src/v25/mod.rs @@ -52,7 +52,7 @@ //! | pruneblockchain | version | | //! | savemempool | version | | //! | scanblocks | version + model | TODO | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! @@ -247,7 +247,7 @@ mod wallet; #[doc(inline)] pub use self::{ - blockchain::GetBlockStats, + blockchain::{GetBlockStats, ScanTxOutSetStart, ScanTxOutSetUnspent}, control::Logging, generating::{GenerateBlock, GenerateBlockError}, wallet::{CreateWallet, ListDescriptors, LoadWallet, UnloadWallet}, @@ -279,11 +279,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, - SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, + UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, + VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, + WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v26/mod.rs b/types/src/v26/mod.rs index 2704f883..1ba69376 100644 --- a/types/src/v26/mod.rs +++ b/types/src/v26/mod.rs @@ -56,7 +56,7 @@ //! | pruneblockchain | version | | //! | savemempool | version | | //! | scanblocks | version + model | TODO | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! @@ -298,11 +298,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, - SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, + UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, + VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, + WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -330,5 +331,7 @@ pub use crate::{ GlobalXpub, ListUnspent, ListUnspentItem, Proprietary, PsbtInput, PsbtOutput, TaprootBip32Deriv, TaprootLeaf, TaprootScript, TaprootScriptPathSig, }, - v25::{GenerateBlock, GenerateBlockError, GetBlockStats, ListDescriptors}, + v25::{ + GenerateBlock, GenerateBlockError, GetBlockStats, ListDescriptors, ScanTxOutSetStart, ScanTxOutSetUnspent + }, }; diff --git a/types/src/v27/mod.rs b/types/src/v27/mod.rs index f2b55928..e5687c53 100644 --- a/types/src/v27/mod.rs +++ b/types/src/v27/mod.rs @@ -56,7 +56,7 @@ //! | pruneblockchain | version | | //! | savemempool | version | | //! | scanblocks | version + model | TODO | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! @@ -275,11 +275,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, - SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, + UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, + VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, + WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -307,7 +308,9 @@ pub use crate::{ GlobalXpub, ListUnspent, ListUnspentItem, Proprietary, PsbtInput, PsbtOutput, TaprootBip32Deriv, TaprootLeaf, TaprootScript, TaprootScriptPathSig, }, - v25::{GenerateBlock, GenerateBlockError, GetBlockStats, ListDescriptors}, + v25::{ + GenerateBlock, GenerateBlockError, GetBlockStats, ListDescriptors, ScanTxOutSetStart, ScanTxOutSetUnspent + }, v26::{ CreateWallet, DescriptorProcessPsbt, DescriptorProcessPsbtError, GetBalances, GetBalancesError, GetPeerInfo, GetPrioritisedTransactions, GetTransaction, 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 70% rename from types/src/v28/blockchain.rs rename to types/src/v28/blockchain/mod.rs index db98fa7a..c5510902 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 be855ac5..edb0a001 100644 --- a/types/src/v28/mod.rs +++ b/types/src/v28/mod.rs @@ -56,7 +56,7 @@ //! | pruneblockchain | version | | //! | savemempool | version | | //! | scanblocks | version + model | TODO | -//! | scantxoutset | omitted | API marked as experimental | +//! | scantxoutset | version + model | API marked as experimental | //! | verifychain | version | | //! | verifytxoutproof | version + model | | //! @@ -259,7 +259,9 @@ mod wallet; #[doc(inline)] pub use self::{ - blockchain::GetBlockchainInfo, + blockchain::{ + GetBlockchainInfo, ScanTxOutSetStart, ScanTxOutSetUnspent, + }, control::Logging, mining::GetMiningInfo, network::GetNetworkInfo, @@ -296,11 +298,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, - SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, + UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, + VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, + WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v29/mod.rs b/types/src/v29/mod.rs index e6a52f0c..a34edd7f 100644 --- a/types/src/v29/mod.rs +++ b/types/src/v29/mod.rs @@ -294,11 +294,11 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, - SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, TestMempoolAccept, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -334,7 +334,8 @@ pub use crate::{ PrioritisedTransaction, UnloadWallet, }, v28::{ - GetNetworkInfo, GetPeerInfo, GetTransaction, Logging, SubmitPackage, SubmitPackageError, + GetNetworkInfo, GetPeerInfo, GetTransaction, Logging, ScanTxOutSetStart, + ScanTxOutSetUnspent, SubmitPackage, SubmitPackageError, SubmitPackageTxResult, SubmitPackageTxResultError, SubmitPackageTxResultFees, SubmitPackageTxResultFeesError, }, From 52d9d1c07dd6d44b178e49725c0bac4159b3d7da Mon Sep 17 00:00:00 2001 From: GideonBature Date: Tue, 15 Jul 2025 15:48:24 +0100 Subject: [PATCH 2/2] Format code Format code --- client/src/client_sync/v17/blockchain.rs | 5 ++++- client/src/client_sync/v28/mod.rs | 1 - types/src/model/mod.rs | 4 ++-- 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 | 11 ++++------- types/src/v18/mod.rs | 17 +++++++---------- types/src/v19/blockchain/into.rs | 7 ++----- types/src/v19/mod.rs | 12 ++++++------ types/src/v20/mod.rs | 15 ++++++++------- types/src/v21/mod.rs | 12 ++++++------ types/src/v22/mod.rs | 12 ++++++------ types/src/v23/mod.rs | 17 ++++++++--------- types/src/v24/mod.rs | 17 ++++++++--------- types/src/v25/blockchain/into.rs | 10 +++------- types/src/v25/blockchain/mod.rs | 1 + types/src/v25/mod.rs | 12 ++++++------ types/src/v26/mod.rs | 15 ++++++++------- types/src/v27/mod.rs | 15 ++++++++------- types/src/v28/blockchain/into.rs | 4 +--- types/src/v28/mod.rs | 16 +++++++--------- types/src/v29/mod.rs | 16 ++++++++-------- 23 files changed, 116 insertions(+), 139 deletions(-) diff --git a/client/src/client_sync/v17/blockchain.rs b/client/src/client_sync/v17/blockchain.rs index 5ba2bdd9..629c0601 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 8b3eecd0..e30eefcb 100644 --- a/client/src/client_sync/v28/mod.rs +++ b/client/src/client_sync/v28/mod.rs @@ -55,7 +55,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/model/mod.rs b/types/src/model/mod.rs index c3b14bf6..672f5d93 100644 --- a/types/src/model/mod.rs +++ b/types/src/model/mod.rs @@ -28,8 +28,8 @@ pub use self::{ GetDescriptorActivity, GetDifficulty, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, GetRawMempool, GetRawMempoolVerbose, GetTxOut, GetTxOutSetInfo, MempoolEntry, - MempoolEntryFees, ReceiveActivity, ScanTxOutSetStart, - ScanTxOutSetUnspent, Softfork, SoftforkType, SpendActivity, VerifyTxOutProof, + MempoolEntryFees, ReceiveActivity, ScanTxOutSetStart, ScanTxOutSetUnspent, Softfork, + SoftforkType, SpendActivity, VerifyTxOutProof, }, generating::{Generate, GenerateBlock, GenerateToAddress, GenerateToDescriptor}, mining::{ diff --git a/types/src/v17/blockchain/error.rs b/types/src/v17/blockchain/error.rs index 4216e387..6aa4ec3e 100644 --- a/types/src/v17/blockchain/error.rs +++ b/types/src/v17/blockchain/error.rs @@ -590,20 +590,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 6e2ff99a..698c6e8f 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::*; @@ -554,11 +554,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 78bc2212..e43d7b8b 100644 --- a/types/src/v17/mod.rs +++ b/types/src/v17/mod.rs @@ -243,9 +243,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 0e51b898..9645c1dd 100644 --- a/types/src/v18/blockchain/into.rs +++ b/types/src/v18/blockchain/into.rs @@ -3,8 +3,8 @@ use bitcoin::{Amount, ScriptBuf, Txid, Wtxid}; use super::{ - GetMempoolEntry, MempoolEntry, MempoolEntryError, ScanTxOutSetError, - ScanTxOutSetStart, ScanTxOutSetUnspent, + GetMempoolEntry, MempoolEntry, MempoolEntryError, ScanTxOutSetError, ScanTxOutSetStart, + ScanTxOutSetUnspent, }; use crate::model; @@ -67,11 +67,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/v18/mod.rs b/types/src/v18/mod.rs index 755d00a6..87469a42 100644 --- a/types/src/v18/mod.rs +++ b/types/src/v18/mod.rs @@ -233,10 +233,7 @@ mod wallet; #[doc(inline)] pub use self::{ - blockchain::{ - GetMempoolEntry, MempoolEntry, ScanTxOutSetStart, - ScanTxOutSetUnspent, - }, + blockchain::{GetMempoolEntry, MempoolEntry, ScanTxOutSetStart, ScanTxOutSetUnspent}, control::{ActiveCommand, GetRpcInfo}, network::{GetNodeAddresses, GetPeerInfo, NodeAddress, PeerInfo}, raw_transactions::{ @@ -281,10 +278,10 @@ pub use crate::v17::{ Logging, MapMempoolEntryError, MempoolAcceptance, MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PruneBlockchain, PsbtInput, PsbtOutput, PsbtScript, RawTransaction, RawTransactionError, RawTransactionInput, RawTransactionOutput, RescanBlockchain, - ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, - SignFail, SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, Softfork, SoftforkReject, TestMempoolAccept, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, + ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, SendMany, SendRawTransaction, + SendToAddress, SetNetworkActive, SetTxFee, SignFail, SignFailError, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, Softfork, SoftforkReject, + TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, + VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }; diff --git a/types/src/v19/blockchain/into.rs b/types/src/v19/blockchain/into.rs index 4fded683..b69dae78 100644 --- a/types/src/v19/blockchain/into.rs +++ b/types/src/v19/blockchain/into.rs @@ -244,11 +244,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/v19/mod.rs b/types/src/v19/mod.rs index 38099523..040e61e9 100644 --- a/types/src/v19/mod.rs +++ b/types/src/v19/mod.rs @@ -276,12 +276,12 @@ pub use crate::v17::{ ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, Logging, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, - SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SoftforkReject, TestMempoolAccept, - TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, - VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, + RawTransactionOutput, RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, + ScanTxOutSetStatus, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, + SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, + SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, + ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }; #[doc(inline)] pub use crate::v18::{ diff --git a/types/src/v20/mod.rs b/types/src/v20/mod.rs index e6231592..81f66124 100644 --- a/types/src/v20/mod.rs +++ b/types/src/v20/mod.rs @@ -268,12 +268,12 @@ pub use crate::{ ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, - SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SoftforkReject, TestMempoolAccept, - TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, - VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, + RawTransactionOutput, RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, + ScanTxOutSetStatus, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, + SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, + SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, + ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -289,6 +289,7 @@ pub use crate::{ GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, GetNetworkInfo, GetPeerInfo, GetRpcInfo, MapMempoolEntryError, MempoolEntry, MempoolEntryError, MempoolEntryFees, - MempoolEntryFeesError, PeerInfo, ScanTxOutSetStart, ScanTxOutSetUnspent, SetWalletFlag, Softfork, SoftforkType, + MempoolEntryFeesError, PeerInfo, ScanTxOutSetStart, ScanTxOutSetUnspent, SetWalletFlag, + Softfork, SoftforkType, }, }; diff --git a/types/src/v21/mod.rs b/types/src/v21/mod.rs index 07ae3326..8c0b501b 100644 --- a/types/src/v21/mod.rs +++ b/types/src/v21/mod.rs @@ -280,12 +280,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, + RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, SendMany, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, + ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v22/mod.rs b/types/src/v22/mod.rs index bb8cf824..b3f85c60 100644 --- a/types/src/v22/mod.rs +++ b/types/src/v22/mod.rs @@ -286,12 +286,12 @@ pub use crate::{ ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, - SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SoftforkReject, TestMempoolAccept, - TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, - VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, + RawTransactionOutput, RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, + ScanTxOutSetStatus, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, + SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, + SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, + ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v23/mod.rs b/types/src/v23/mod.rs index 0afc3b45..193b4960 100644 --- a/types/src/v23/mod.rs +++ b/types/src/v23/mod.rs @@ -282,12 +282,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, + RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, SendMany, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, + ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -302,9 +302,8 @@ pub use crate::{ GetBlockFilterError, GetBlockchainInfoError, GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError, MempoolEntry, - MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo, - ScanTxOutSetStart, ScanTxOutSetUnspent, SetWalletFlag, Softfork, - SoftforkType, + MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo, ScanTxOutSetStart, + ScanTxOutSetUnspent, SetWalletFlag, Softfork, SoftforkType, }, v20::{GenerateToDescriptor, GetTransactionDetail}, v21::{ diff --git a/types/src/v24/mod.rs b/types/src/v24/mod.rs index 2a526fdc..e99f3adf 100644 --- a/types/src/v24/mod.rs +++ b/types/src/v24/mod.rs @@ -284,12 +284,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, + RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, SendMany, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, + ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -303,9 +303,8 @@ pub use crate::{ GetBlockFilterError, GetBlockchainInfoError, GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetRpcInfo, MapMempoolEntryError, MempoolEntry, - MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo, - ScanTxOutSetStart, ScanTxOutSetUnspent, SetWalletFlag, Softfork, - SoftforkType, + MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo, 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 6038707a..2eaba403 100644 --- a/types/src/v25/blockchain/into.rs +++ b/types/src/v25/blockchain/into.rs @@ -3,8 +3,7 @@ use bitcoin::{Amount, BlockHash, FeeRate, ScriptBuf, Txid, Weight}; use super::{ - GetBlockStats, GetBlockStatsError, ScanTxOutSetError, ScanTxOutSetStart, - ScanTxOutSetUnspent, + GetBlockStats, GetBlockStatsError, ScanTxOutSetError, ScanTxOutSetStart, ScanTxOutSetUnspent, }; use crate::model; @@ -70,11 +69,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/mod.rs b/types/src/v25/blockchain/mod.rs index 1d521eaf..1a993148 100644 --- a/types/src/v25/blockchain/mod.rs +++ b/types/src/v25/blockchain/mod.rs @@ -7,6 +7,7 @@ mod into; use alloc::collections::BTreeMap; + use serde::{Deserialize, Serialize}; pub use super::{GetBlockStatsError, ScanTxOutSetError}; diff --git a/types/src/v25/mod.rs b/types/src/v25/mod.rs index 6f84862b..edb79bd2 100644 --- a/types/src/v25/mod.rs +++ b/types/src/v25/mod.rs @@ -279,12 +279,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, + RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, SendMany, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, + ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v26/mod.rs b/types/src/v26/mod.rs index 1ba69376..4327498c 100644 --- a/types/src/v26/mod.rs +++ b/types/src/v26/mod.rs @@ -298,12 +298,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, + RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, SendMany, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, + ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -332,6 +332,7 @@ pub use crate::{ TaprootBip32Deriv, TaprootLeaf, TaprootScript, TaprootScriptPathSig, }, v25::{ - GenerateBlock, GenerateBlockError, GetBlockStats, ListDescriptors, ScanTxOutSetStart, ScanTxOutSetUnspent + GenerateBlock, GenerateBlockError, GetBlockStats, ListDescriptors, ScanTxOutSetStart, + ScanTxOutSetUnspent, }, }; diff --git a/types/src/v27/mod.rs b/types/src/v27/mod.rs index e5687c53..121d0c14 100644 --- a/types/src/v27/mod.rs +++ b/types/src/v27/mod.rs @@ -275,12 +275,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, + RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, SendMany, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, + ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -309,7 +309,8 @@ pub use crate::{ TaprootBip32Deriv, TaprootLeaf, TaprootScript, TaprootScriptPathSig, }, v25::{ - GenerateBlock, GenerateBlockError, GetBlockStats, ListDescriptors, ScanTxOutSetStart, ScanTxOutSetUnspent + GenerateBlock, GenerateBlockError, GetBlockStats, ListDescriptors, ScanTxOutSetStart, + ScanTxOutSetUnspent, }, v26::{ CreateWallet, DescriptorProcessPsbt, DescriptorProcessPsbtError, GetBalances, 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 edb0a001..04018292 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, @@ -298,12 +296,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, + RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, SendMany, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, + ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v29/mod.rs b/types/src/v29/mod.rs index a34edd7f..2a67d8c7 100644 --- a/types/src/v29/mod.rs +++ b/types/src/v29/mod.rs @@ -294,11 +294,12 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScanTxOutSetError, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, TestMempoolAccept, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, ScanTxOutSetAbort, ScanTxOutSetStatus, + RescanBlockchain, ScanTxOutSetAbort, ScanTxOutSetError, ScanTxOutSetStatus, SendMany, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, TestMempoolAccept, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -335,8 +336,7 @@ pub use crate::{ }, v28::{ GetNetworkInfo, GetPeerInfo, GetTransaction, Logging, ScanTxOutSetStart, - ScanTxOutSetUnspent, SubmitPackage, SubmitPackageError, - SubmitPackageTxResult, SubmitPackageTxResultError, SubmitPackageTxResultFees, - SubmitPackageTxResultFeesError, + ScanTxOutSetUnspent, SubmitPackage, SubmitPackageError, SubmitPackageTxResult, + SubmitPackageTxResultError, SubmitPackageTxResultFees, SubmitPackageTxResultFeesError, }, };