Skip to content

Add missing return fields in v22 to v29 #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ pub fn compact_size_decode(slice: &mut &[u8]) -> u64 {
pub struct ScriptPubkey {
/// Script assembly.
pub asm: String,
/// Inferred descriptor for the output. v23 and later only.
#[serde(rename = "desc")]
pub descriptor: Option<String>,
/// Script hex.
pub hex: String,
/// Number of required signatures - deprecated in Core v22.
Expand Down
9 changes: 9 additions & 0 deletions types/src/model/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,12 @@ pub struct GetBlockStats {
pub utxo_increase: i32,
/// The increase/decrease in size for the utxo index (not discounting op_return and similar).
pub utxo_size_increase: i32,
/// The increase/decrease in the number of unspent outputs, not counting unspendables.
/// v25 and later only.
pub utxo_increase_actual: Option<i32>,
/// The increase/decrease in size for the utxo index, not counting unspendables.
/// v25 and later only.
pub utxo_size_increase_actual: Option<i32>,
}

/// Models the result of JSON-RPC method `getchaintips`.
Expand Down Expand Up @@ -516,6 +522,9 @@ pub struct GetTxOutSetInfo {
///
/// This was removed in Bitcoin Core v26, and hence will be `None` for v26 and later.
pub hash_serialized_2: Option<String>, // FIXME: What sort of hash is this?
/// The serialized hash (only present if 'hash_serialized_3' hash_type is chosen).
/// v26 and later only.
pub hash_serialized_3: Option<String>,
/// The estimated size of the chainstate on disk.
pub disk_size: u32,
/// The total amount.
Expand Down
12 changes: 6 additions & 6 deletions types/src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ pub use self::{
GetAddressesByLabel, GetBalance, GetBalances, GetBalancesMine, GetBalancesWatchOnly,
GetNewAddress, GetRawChangeAddress, GetReceivedByAddress, GetReceivedByLabel,
GetTransaction, GetTransactionDetail, GetUnconfirmedBalance, GetWalletInfo,
ListAddressGroupings, ListAddressGroupingsItem, ListLabels, ListLockUnspent,
ListLockUnspentItem, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel,
ListReceivedByLabelItem, ListSinceBlock, ListSinceBlockTransaction, ListTransactions,
ListTransactionsItem, ListUnspent, ListUnspentItem, ListWallets, LoadWallet,
RescanBlockchain, ScriptType, SendMany, SendToAddress, SignMessage, TransactionCategory,
UnloadWallet, WalletCreateFundedPsbt, WalletProcessPsbt,
LastProcessedBlock, ListAddressGroupings, ListAddressGroupingsItem, ListLabels,
ListLockUnspent, ListLockUnspentItem, ListReceivedByAddress, ListReceivedByAddressItem,
ListReceivedByLabel, ListReceivedByLabelItem, ListSinceBlock, ListSinceBlockTransaction,
ListTransactions, ListTransactionsItem, ListUnspent, ListUnspentItem, ListWallets,
LoadWallet, RescanBlockchain, ScriptType, SendMany, SendToAddress, SignMessage,
TransactionCategory, UnloadWallet, WalletCreateFundedPsbt, WalletProcessPsbt,
},
};
6 changes: 5 additions & 1 deletion types/src/model/raw_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ pub struct DecodeRawTransaction(pub Transaction);
pub struct DecodeScript {
/// The `scriptPubkey`.
pub script_pubkey: Option<ScriptBuf>,
/// Inferred descriptor for the script. v23 and later only.
pub descriptor: Option<String>,
/// The output type.
pub type_: Option<String>,
pub type_: String,
/// Bitcoin address (only if a well-defined address exists). v22 and later only.
pub address: Option<Address<NetworkUnchecked>>,
/// The required signatures.
pub required_signatures: Option<u64>,
/// List of bitcoin addresses.
Expand Down
45 changes: 45 additions & 0 deletions types/src/model/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,11 @@ pub struct GetBalance(pub Amount);
pub struct GetBalances {
/// Balances from outputs that the wallet can sign.
pub mine: GetBalancesMine,
/// Watchonly balances (not present if wallet does not watch anything).
pub watch_only: Option<GetBalancesWatchOnly>,
/// Hash and height of the block this information was generated on. v26 and later only.
#[serde(rename = "lastprocessedblock")]
pub last_processed_block: Option<LastProcessedBlock>,
}

/// Balances from outputs that the wallet can sign.
Expand Down Expand Up @@ -290,34 +294,60 @@ pub struct GetTransaction {
pub fee: Option<SignedAmount>,
/// The number of confirmations.
pub confirmations: i64, // Docs do not indicate what negative value means?
/// Only present if the transaction's only input is a coinbase one. v20 and later only.
pub generated: Option<bool>,
/// Whether we consider the outputs of this unconfirmed transaction safe to spend.
pub trusted: Option<bool>,
/// The block hash.
pub block_hash: Option<BlockHash>,
/// The block height containing the transaction. v20 and later only.
pub block_height: Option<u32>,
/// The index of the transaction in the block that includes it.
pub block_index: Option<u32>,
/// The time in seconds since epoch (1 Jan 1970 GMT).
pub block_time: Option<u32>,
/// The transaction id.
pub txid: Txid,
/// The hash of serialized transaction, including witness data. v24 and later only.
pub wtxid: Option<Txid>,
/// Confirmed transactions that have been detected by the wallet to conflict with this transaction.
pub wallet_conflicts: Vec<Txid>,
/// Only if 'category' is 'send'. The txid if this tx was replaced. v23 and later only.
pub replaced_by_txid: Option<Txid>,
/// Only if 'category' is 'send'. The txid if this tx replaces another. v23 and later only.
pub replaces_txid: Option<Txid>,
/// Transactions in the mempool that directly conflict with either this transaction or an ancestor transaction. v28 and later only.
pub mempool_conflicts: Option<Vec<Txid>>,
/// If a comment to is associated with the transaction. v23 and later only.
pub to: Option<String>,
/// The transaction time in seconds since epoch (1 Jan 1970 GMT).
pub time: u32,
/// The time received in seconds since epoch (1 Jan 1970 GMT).
pub time_received: u32,
/// If a comment is associated with the transaction, only present if not empty. v20 to v24 only.
pub comment: Option<String>,
/// Whether this transaction could be replaced due to BIP125 (replace-by-fee);
/// may be unknown for unconfirmed transactions not in the mempool
pub bip125_replaceable: Bip125Replaceable,
/// Only if 'category' is 'received'. List of parent descriptors for the output script of this coin. v24 and later only.
pub parent_descriptors: Option<Vec<String>>,
/// Transaction details.
pub details: Vec<GetTransactionDetail>,
/// The decoded transaction (only present when `verbose` is passed). v19 and later only.
pub decoded: Option<Transaction>,
/// Hash and height of the block this information was generated on. v26 and later only.
pub last_processed_block: Option<LastProcessedBlock>,
/// The transaction, parsed from hex string.
pub tx: Transaction,
}

/// Part of the `GetTransaction`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub struct GetTransactionDetail {
/// Only returns true if imported addresses were involved in transaction. v20 and later only.
pub involves_watchonly: Option<bool>,
/// DEPRECATED. The account name involved in the transaction, can be "" for the default account.
pub account: Option<String>, // Docs are wrong, this is not documented as optional.
/// The bitcoin address involved in the transaction.
pub address: Address<NetworkUnchecked>,
/// The category, either 'send' or 'receive'.
Expand All @@ -338,6 +368,18 @@ pub struct GetTransactionDetail {
///
/// Only available for the 'send' category of transactions.
pub abandoned: Option<bool>,
/// Only if 'category' is 'received'. List of parent descriptors for the output script of this
/// coin. v24 and later only.
pub parent_descriptors: Option<Vec<String>>,
}

/// Part of the `GetTransaction`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub struct LastProcessedBlock {
/// Hash of the block this information was generated on.
pub hash: BlockHash,
/// Height of the block this information was generated on.
pub height: u32,
}

/// Models the result of JSON-RPC method `getunconfirmedbalance`.
Expand Down Expand Up @@ -616,6 +658,9 @@ pub struct ListUnspentItem {
/// and unconfirmed replacement transactions are considered unsafe and are not eligible for
/// spending by fundrawtransaction and sendtoaddress.
pub safe: bool,
/// List of parent descriptors for the scriptPubKey of this coin. v24 and later only.
#[serde(rename = "parent_descs")]
pub parent_descriptors: Option<Vec<String>>,
}

/// Models the result of JSON-RPC method `listwallets`.
Expand Down
3 changes: 3 additions & 0 deletions types/src/v17/blockchain/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ impl GetBlockStats {
txs: crate::to_u32(self.txs, "txs")?,
utxo_increase: self.utxo_increase,
utxo_size_increase: self.utxo_size_increase,
utxo_increase_actual: None, // v25 and later only.
utxo_size_increase_actual: None, // v25 and later only.
})
}
}
Expand Down Expand Up @@ -541,6 +543,7 @@ impl GetTxOutSetInfo {
tx_outs,
bogo_size,
hash_serialized_2,
hash_serialized_3: None, // v26 and later only.
disk_size,
total_amount,
})
Expand Down
30 changes: 15 additions & 15 deletions types/src/v17/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,25 @@ pub struct Locked {
/// > Gets and sets the logging configuration.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub struct Logging {
pub net: bool,
pub tor: bool,
pub mempool: bool,
pub http: bool,
pub addrman: bool,
pub bench: bool,
pub zmq: bool,
pub cmpctblock: bool,
pub coindb: bool,
pub db: bool,
pub rpc: bool,
pub estimatefee: bool,
pub addrman: bool,
pub selectcoins: bool,
pub reindex: bool,
pub cmpctblock: bool,
pub rand: bool,
pub http: bool,
pub leveldb: bool,
pub libevent: bool,
pub mempool: bool,
pub mempoolrej: bool,
pub net: bool,
pub prune: bool,
pub proxy: bool,
pub mempoolrej: bool,
pub libevent: bool,
pub coindb: bool,
pub qt: bool,
pub leveldb: bool,
pub rand: bool,
pub reindex: bool,
pub rpc: bool,
pub selectcoins: bool,
pub tor: bool,
pub zmq: bool,
}
28 changes: 14 additions & 14 deletions types/src/v17/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,20 +271,20 @@ pub use self::{
ValidateAddress, ValidateAddressError, VerifyMessage,
},
wallet::{
AbortRescan, AddMultisigAddress, AddMultisigAddressError, AddressInformation, BumpFee,
BumpFeeError, CreateWallet, DumpPrivKey, DumpWallet, EncryptWallet, GetAddressInfo,
GetAddressInfoEmbedded, GetAddressInfoEmbeddedError, GetAddressInfoError,
GetAddressInfoLabel, GetAddressesByLabel, GetBalance, GetNewAddress, GetRawChangeAddress,
GetReceivedByAddress, GetTransaction, GetTransactionDetail, GetTransactionDetailError,
GetTransactionError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError,
ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels,
ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddress,
ListReceivedByAddressError, ListReceivedByAddressItem, ListSinceBlock, ListSinceBlockError,
ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions,
ListTransactionsItem, ListTransactionsItemError, ListUnspent, ListUnspentItem,
ListUnspentItemError, ListWallets, LoadWallet, RescanBlockchain, SendMany, SendToAddress,
SignMessage, TransactionCategory, WalletCreateFundedPsbt, WalletCreateFundedPsbtError,
WalletProcessPsbt,
AbortRescan, AddMultisigAddress, AddMultisigAddressError, AddressInformation,
Bip125Replaceable, BumpFee, BumpFeeError, CreateWallet, DumpPrivKey, DumpWallet,
EncryptWallet, GetAddressInfo, GetAddressInfoEmbedded, GetAddressInfoEmbeddedError,
GetAddressInfoError, GetAddressInfoLabel, GetAddressesByLabel, GetBalance, GetNewAddress,
GetRawChangeAddress, GetReceivedByAddress, GetTransaction, GetTransactionDetail,
GetTransactionDetailError, GetTransactionError, GetUnconfirmedBalance, GetWalletInfo,
GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError,
ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem,
ListLockUnspentItemError, ListReceivedByAddress, ListReceivedByAddressError,
ListReceivedByAddressItem, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction,
ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem,
ListTransactionsItemError, ListUnspent, ListUnspentItem, ListUnspentItemError, ListWallets,
LoadWallet, RescanBlockchain, SendMany, SendToAddress, SignMessage, TransactionCategory,
WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt,
},
zmq::GetZmqNotifications,
};
Expand Down
2 changes: 2 additions & 0 deletions types/src/v17/raw_transactions/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ impl DecodeScript {
Ok(model::DecodeScript {
script_pubkey,
type_: self.type_,
descriptor: None,
address: None,
required_signatures: self.required_signatures,
addresses,
p2sh,
Expand Down
2 changes: 1 addition & 1 deletion types/src/v17/raw_transactions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ pub struct DecodeScript {
pub hex: Option<String>,
/// The output type.
#[serde(rename = "type")]
pub type_: Option<String>,
pub type_: String,
/// The required signatures.
#[serde(rename = "reqSigs")]
pub required_signatures: Option<u64>,
Expand Down
15 changes: 15 additions & 0 deletions types/src/v17/wallet/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,16 +354,27 @@ impl GetTransaction {
amount,
fee,
confirmations: self.confirmations,
generated: None, // v20 and later only.
trusted: self.trusted,
block_hash,
block_height: None, // v20 and later only.
block_index,
block_time: self.block_time,
txid,
wtxid: None, // v24 and later only.
wallet_conflicts,
replaced_by_txid: None, // v23 and later only.
replaces_txid: None, // v23 and later only.
mempool_conflicts: None, // v28 and later only.
to: None, // v23 and later only.
time: self.time,
time_received: self.time_received,
comment: None, // v20 to v24 only.
bip125_replaceable: self.bip125_replaceable.into_model(),
parent_descriptors: None, // v24 and later only.
details,
decoded: None, // v19 and later only.
last_processed_block: None, // v26 and later only.
tx,
})
}
Expand All @@ -379,13 +390,16 @@ impl GetTransactionDetail {
let fee = self.fee.map(|fee| SignedAmount::from_btc(fee).map_err(E::Fee)).transpose()?;

Ok(model::GetTransactionDetail {
involves_watchonly: None, // v20 and later only.
account: self.account,
address,
category: self.category.into_model(),
amount,
label: self.label,
vout: self.vout,
fee,
abandoned: self.abandoned,
parent_descriptors: None, // v24 and later only.
})
}
}
Expand Down Expand Up @@ -670,6 +684,7 @@ impl ListUnspentItem {
solvable: self.solvable,
descriptor: None,
safe: self.safe,
parent_descriptors: None, // v24 and later only.
})
}
}
Expand Down
1 change: 1 addition & 0 deletions types/src/v18/wallet/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ impl ListUnspentItem {
solvable: self.solvable,
descriptor: self.descriptor,
safe: self.safe,
parent_descriptors: None, // v24 and later only.
})
}
}
Loading