Skip to content

Commit 7e341c8

Browse files
committed
Merge #272: Add missing return fields in v22 to v29
33e63ad Run the formatter (Jamil Lambert, PhD) 4e70a4b Add missing fields to getbalances (Jamil Lambert, PhD) 99f6871 Add GetBalancesError (Jamil Lambert, PhD) 4687d2c Move getbalances into_model functions into module (Jamil Lambert, PhD) ff63089 Add missing fields to listunspent (Jamil Lambert, PhD) 0307e86 Add missing fields to getblockstats (Jamil Lambert, PhD) f097907 Add missing field to gettxoutsetinfo (Jamil Lambert, PhD) 8e01cfc Add missing fields to gettransaction (Jamil Lambert, PhD) 088fb1d Move into functions into sub module (Jamil Lambert, PhD) 7df07fc Move wallet module to subdirectory (Jamil Lambert, PhD) 12f8933 Add missing field to ScriptPubKey (Jamil Lambert, PhD) 44a62cd Add missing fields to logging (Jamil Lambert, PhD) 119888d Reorder fields in logging alphabetically (Jamil Lambert, PhD) fa4e6dc Add missing fields to decodescript (Jamil Lambert, PhD) e5ca6c9 Remove Option from type (Jamil Lambert, PhD) Pull request description: Some of the types in v22 to v29 had missing return fields. All missing fields that are shown by adding `#[serde(deny_unknown_fields)]` to the structs in all versions have now been added. Minor reorganisation of the code, in separate commits which describe what was done. Add all of the missing fields update the models, error, into function and reexports accordingly. Redefinitions of the types, error and into functions are modified copies of the most recent version of the RPC that had fields added. Run the formatter in a separate commit to make the changes to the reexports easier to review. ACKs for top commit: tcharding: ACK 33e63ad Tree-SHA512: 6547f1336d36fb93cf4d3ddcb27908cd247f2ee2b45d48172384942b558d3787b052ca61917b4ed3bf6759eb80da004e81612d4863bab24465ac85e5beefc722
2 parents 1d03f15 + 33e63ad commit 7e341c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2820
-529
lines changed

types/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ pub fn compact_size_decode(slice: &mut &[u8]) -> u64 {
183183
pub struct ScriptPubkey {
184184
/// Script assembly.
185185
pub asm: String,
186+
/// Inferred descriptor for the output. v23 and later only.
187+
#[serde(rename = "desc")]
188+
pub descriptor: Option<String>,
186189
/// Script hex.
187190
pub hex: String,
188191
/// Number of required signatures - deprecated in Core v22.

types/src/model/blockchain.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,12 @@ pub struct GetBlockStats {
306306
pub utxo_increase: i32,
307307
/// The increase/decrease in size for the utxo index (not discounting op_return and similar).
308308
pub utxo_size_increase: i32,
309+
/// The increase/decrease in the number of unspent outputs, not counting unspendables.
310+
/// v25 and later only.
311+
pub utxo_increase_actual: Option<i32>,
312+
/// The increase/decrease in size for the utxo index, not counting unspendables.
313+
/// v25 and later only.
314+
pub utxo_size_increase_actual: Option<i32>,
309315
}
310316

311317
/// Models the result of JSON-RPC method `getchaintips`.
@@ -516,6 +522,9 @@ pub struct GetTxOutSetInfo {
516522
///
517523
/// This was removed in Bitcoin Core v26, and hence will be `None` for v26 and later.
518524
pub hash_serialized_2: Option<String>, // FIXME: What sort of hash is this?
525+
/// The serialized hash (only present if 'hash_serialized_3' hash_type is chosen).
526+
/// v26 and later only.
527+
pub hash_serialized_3: Option<String>,
519528
/// The estimated size of the chainstate on disk.
520529
pub disk_size: u32,
521530
/// The total amount.

types/src/model/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ pub use self::{
5555
GetAddressesByLabel, GetBalance, GetBalances, GetBalancesMine, GetBalancesWatchOnly,
5656
GetNewAddress, GetRawChangeAddress, GetReceivedByAddress, GetReceivedByLabel,
5757
GetTransaction, GetTransactionDetail, GetUnconfirmedBalance, GetWalletInfo,
58-
ListAddressGroupings, ListAddressGroupingsItem, ListLabels, ListLockUnspent,
59-
ListLockUnspentItem, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel,
60-
ListReceivedByLabelItem, ListSinceBlock, ListSinceBlockTransaction, ListTransactions,
61-
ListTransactionsItem, ListUnspent, ListUnspentItem, ListWallets, LoadWallet,
62-
RescanBlockchain, ScriptType, SendMany, SendToAddress, SignMessage, TransactionCategory,
63-
UnloadWallet, WalletCreateFundedPsbt, WalletProcessPsbt,
58+
LastProcessedBlock, ListAddressGroupings, ListAddressGroupingsItem, ListLabels,
59+
ListLockUnspent, ListLockUnspentItem, ListReceivedByAddress, ListReceivedByAddressItem,
60+
ListReceivedByLabel, ListReceivedByLabelItem, ListSinceBlock, ListSinceBlockTransaction,
61+
ListTransactions, ListTransactionsItem, ListUnspent, ListUnspentItem, ListWallets,
62+
LoadWallet, RescanBlockchain, ScriptType, SendMany, SendToAddress, SignMessage,
63+
TransactionCategory, UnloadWallet, WalletCreateFundedPsbt, WalletProcessPsbt,
6464
},
6565
};

types/src/model/raw_transactions.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,12 @@ pub struct DecodeRawTransaction(pub Transaction);
9393
pub struct DecodeScript {
9494
/// The `scriptPubkey`.
9595
pub script_pubkey: Option<ScriptBuf>,
96+
/// Inferred descriptor for the script. v23 and later only.
97+
pub descriptor: Option<String>,
9698
/// The output type.
97-
pub type_: Option<String>,
99+
pub type_: String,
100+
/// Bitcoin address (only if a well-defined address exists). v22 and later only.
101+
pub address: Option<Address<NetworkUnchecked>>,
98102
/// The required signatures.
99103
pub required_signatures: Option<u64>,
100104
/// List of bitcoin addresses.

types/src/model/wallet.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,11 @@ pub struct GetBalance(pub Amount);
232232
pub struct GetBalances {
233233
/// Balances from outputs that the wallet can sign.
234234
pub mine: GetBalancesMine,
235+
/// Watchonly balances (not present if wallet does not watch anything).
235236
pub watch_only: Option<GetBalancesWatchOnly>,
237+
/// Hash and height of the block this information was generated on. v26 and later only.
238+
#[serde(rename = "lastprocessedblock")]
239+
pub last_processed_block: Option<LastProcessedBlock>,
236240
}
237241

238242
/// Balances from outputs that the wallet can sign.
@@ -290,34 +294,60 @@ pub struct GetTransaction {
290294
pub fee: Option<SignedAmount>,
291295
/// The number of confirmations.
292296
pub confirmations: i64, // Docs do not indicate what negative value means?
297+
/// Only present if the transaction's only input is a coinbase one. v20 and later only.
298+
pub generated: Option<bool>,
293299
/// Whether we consider the outputs of this unconfirmed transaction safe to spend.
294300
pub trusted: Option<bool>,
295301
/// The block hash.
296302
pub block_hash: Option<BlockHash>,
303+
/// The block height containing the transaction. v20 and later only.
304+
pub block_height: Option<u32>,
297305
/// The index of the transaction in the block that includes it.
298306
pub block_index: Option<u32>,
299307
/// The time in seconds since epoch (1 Jan 1970 GMT).
300308
pub block_time: Option<u32>,
301309
/// The transaction id.
302310
pub txid: Txid,
311+
/// The hash of serialized transaction, including witness data. v24 and later only.
312+
pub wtxid: Option<Txid>,
303313
/// Confirmed transactions that have been detected by the wallet to conflict with this transaction.
304314
pub wallet_conflicts: Vec<Txid>,
315+
/// Only if 'category' is 'send'. The txid if this tx was replaced. v23 and later only.
316+
pub replaced_by_txid: Option<Txid>,
317+
/// Only if 'category' is 'send'. The txid if this tx replaces another. v23 and later only.
318+
pub replaces_txid: Option<Txid>,
319+
/// Transactions in the mempool that directly conflict with either this transaction or an ancestor transaction. v28 and later only.
320+
pub mempool_conflicts: Option<Vec<Txid>>,
321+
/// If a comment to is associated with the transaction. v23 and later only.
322+
pub to: Option<String>,
305323
/// The transaction time in seconds since epoch (1 Jan 1970 GMT).
306324
pub time: u32,
307325
/// The time received in seconds since epoch (1 Jan 1970 GMT).
308326
pub time_received: u32,
327+
/// If a comment is associated with the transaction, only present if not empty. v20 to v24 only.
328+
pub comment: Option<String>,
309329
/// Whether this transaction could be replaced due to BIP125 (replace-by-fee);
310330
/// may be unknown for unconfirmed transactions not in the mempool
311331
pub bip125_replaceable: Bip125Replaceable,
332+
/// Only if 'category' is 'received'. List of parent descriptors for the output script of this coin. v24 and later only.
333+
pub parent_descriptors: Option<Vec<String>>,
312334
/// Transaction details.
313335
pub details: Vec<GetTransactionDetail>,
336+
/// The decoded transaction (only present when `verbose` is passed). v19 and later only.
337+
pub decoded: Option<Transaction>,
338+
/// Hash and height of the block this information was generated on. v26 and later only.
339+
pub last_processed_block: Option<LastProcessedBlock>,
314340
/// The transaction, parsed from hex string.
315341
pub tx: Transaction,
316342
}
317343

318344
/// Part of the `GetTransaction`.
319345
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
320346
pub struct GetTransactionDetail {
347+
/// Only returns true if imported addresses were involved in transaction. v20 and later only.
348+
pub involves_watchonly: Option<bool>,
349+
/// DEPRECATED. The account name involved in the transaction, can be "" for the default account.
350+
pub account: Option<String>, // Docs are wrong, this is not documented as optional.
321351
/// The bitcoin address involved in the transaction.
322352
pub address: Address<NetworkUnchecked>,
323353
/// The category, either 'send' or 'receive'.
@@ -338,6 +368,18 @@ pub struct GetTransactionDetail {
338368
///
339369
/// Only available for the 'send' category of transactions.
340370
pub abandoned: Option<bool>,
371+
/// Only if 'category' is 'received'. List of parent descriptors for the output script of this
372+
/// coin. v24 and later only.
373+
pub parent_descriptors: Option<Vec<String>>,
374+
}
375+
376+
/// Part of the `GetTransaction`.
377+
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
378+
pub struct LastProcessedBlock {
379+
/// Hash of the block this information was generated on.
380+
pub hash: BlockHash,
381+
/// Height of the block this information was generated on.
382+
pub height: u32,
341383
}
342384

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

621666
/// Models the result of JSON-RPC method `listwallets`.

types/src/v17/blockchain/into.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ impl GetBlockStats {
261261
txs: crate::to_u32(self.txs, "txs")?,
262262
utxo_increase: self.utxo_increase,
263263
utxo_size_increase: self.utxo_size_increase,
264+
utxo_increase_actual: None, // v25 and later only.
265+
utxo_size_increase_actual: None, // v25 and later only.
264266
})
265267
}
266268
}
@@ -541,6 +543,7 @@ impl GetTxOutSetInfo {
541543
tx_outs,
542544
bogo_size,
543545
hash_serialized_2,
546+
hash_serialized_3: None, // v26 and later only.
544547
disk_size,
545548
total_amount,
546549
})

types/src/v17/control.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,25 @@ pub struct Locked {
5252
/// > Gets and sets the logging configuration.
5353
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
5454
pub struct Logging {
55-
pub net: bool,
56-
pub tor: bool,
57-
pub mempool: bool,
58-
pub http: bool,
55+
pub addrman: bool,
5956
pub bench: bool,
60-
pub zmq: bool,
57+
pub cmpctblock: bool,
58+
pub coindb: bool,
6159
pub db: bool,
62-
pub rpc: bool,
6360
pub estimatefee: bool,
64-
pub addrman: bool,
65-
pub selectcoins: bool,
66-
pub reindex: bool,
67-
pub cmpctblock: bool,
68-
pub rand: bool,
61+
pub http: bool,
62+
pub leveldb: bool,
63+
pub libevent: bool,
64+
pub mempool: bool,
65+
pub mempoolrej: bool,
66+
pub net: bool,
6967
pub prune: bool,
7068
pub proxy: bool,
71-
pub mempoolrej: bool,
72-
pub libevent: bool,
73-
pub coindb: bool,
7469
pub qt: bool,
75-
pub leveldb: bool,
70+
pub rand: bool,
71+
pub reindex: bool,
72+
pub rpc: bool,
73+
pub selectcoins: bool,
74+
pub tor: bool,
75+
pub zmq: bool,
7676
}

types/src/v17/mod.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -271,20 +271,20 @@ pub use self::{
271271
ValidateAddress, ValidateAddressError, VerifyMessage,
272272
},
273273
wallet::{
274-
AbortRescan, AddMultisigAddress, AddMultisigAddressError, AddressInformation, BumpFee,
275-
BumpFeeError, CreateWallet, DumpPrivKey, DumpWallet, EncryptWallet, GetAddressInfo,
276-
GetAddressInfoEmbedded, GetAddressInfoEmbeddedError, GetAddressInfoError,
277-
GetAddressInfoLabel, GetAddressesByLabel, GetBalance, GetNewAddress, GetRawChangeAddress,
278-
GetReceivedByAddress, GetTransaction, GetTransactionDetail, GetTransactionDetailError,
279-
GetTransactionError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError,
280-
ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels,
281-
ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddress,
282-
ListReceivedByAddressError, ListReceivedByAddressItem, ListSinceBlock, ListSinceBlockError,
283-
ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions,
284-
ListTransactionsItem, ListTransactionsItemError, ListUnspent, ListUnspentItem,
285-
ListUnspentItemError, ListWallets, LoadWallet, RescanBlockchain, SendMany, SendToAddress,
286-
SignMessage, TransactionCategory, WalletCreateFundedPsbt, WalletCreateFundedPsbtError,
287-
WalletProcessPsbt,
274+
AbortRescan, AddMultisigAddress, AddMultisigAddressError, AddressInformation,
275+
Bip125Replaceable, BumpFee, BumpFeeError, CreateWallet, DumpPrivKey, DumpWallet,
276+
EncryptWallet, GetAddressInfo, GetAddressInfoEmbedded, GetAddressInfoEmbeddedError,
277+
GetAddressInfoError, GetAddressInfoLabel, GetAddressesByLabel, GetBalance, GetNewAddress,
278+
GetRawChangeAddress, GetReceivedByAddress, GetTransaction, GetTransactionDetail,
279+
GetTransactionDetailError, GetTransactionError, GetUnconfirmedBalance, GetWalletInfo,
280+
GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError,
281+
ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem,
282+
ListLockUnspentItemError, ListReceivedByAddress, ListReceivedByAddressError,
283+
ListReceivedByAddressItem, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction,
284+
ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem,
285+
ListTransactionsItemError, ListUnspent, ListUnspentItem, ListUnspentItemError, ListWallets,
286+
LoadWallet, RescanBlockchain, SendMany, SendToAddress, SignMessage, TransactionCategory,
287+
WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt,
288288
},
289289
zmq::GetZmqNotifications,
290290
};

types/src/v17/raw_transactions/into.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ impl DecodeScript {
304304
Ok(model::DecodeScript {
305305
script_pubkey,
306306
type_: self.type_,
307+
descriptor: None,
308+
address: None,
307309
required_signatures: self.required_signatures,
308310
addresses,
309311
p2sh,

types/src/v17/raw_transactions/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ pub struct DecodeScript {
209209
pub hex: Option<String>,
210210
/// The output type.
211211
#[serde(rename = "type")]
212-
pub type_: Option<String>,
212+
pub type_: String,
213213
/// The required signatures.
214214
#[serde(rename = "reqSigs")]
215215
pub required_signatures: Option<u64>,

0 commit comments

Comments
 (0)