Skip to content

Commit f097907

Browse files
committed
Add missing field to gettxoutsetinfo
There is a missing return field in v26 `gettxoutsetinfo`. Add the missing field to the existing redefinition of the type in v26. Update the model and into functions.
1 parent 8e01cfc commit f097907

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

types/src/model/blockchain.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,9 @@ pub struct GetTxOutSetInfo {
516516
///
517517
/// This was removed in Bitcoin Core v26, and hence will be `None` for v26 and later.
518518
pub hash_serialized_2: Option<String>, // FIXME: What sort of hash is this?
519+
/// The serialized hash (only present if 'hash_serialized_3' hash_type is chosen).
520+
/// v26 and later only.
521+
pub hash_serialized_3: Option<String>,
519522
/// The estimated size of the chainstate on disk.
520523
pub disk_size: u32,
521524
/// The total amount.

types/src/v17/blockchain/into.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ impl GetTxOutSetInfo {
541541
tx_outs,
542542
bogo_size,
543543
hash_serialized_2,
544+
hash_serialized_3: None, // v26 and later only.
544545
disk_size,
545546
total_amount,
546547
})

types/src/v26/blockchain.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ pub struct GetTxOutSetInfo {
3737
pub disk_size: i64,
3838
/// The total amount.
3939
pub total_amount: f64,
40+
/// The serialized hash (only present if 'hash_serialized_3' hash_type is chosen).
41+
/// v26 and later only.
42+
pub hash_serialized_3: Option<String>,
4043
}
4144

4245
impl GetTxOutSetInfo {
@@ -49,7 +52,6 @@ impl GetTxOutSetInfo {
4952
let transactions = crate::to_u32(self.transactions, "transactions")?;
5053
let tx_outs = crate::to_u32(self.tx_outs, "tx_outs")?;
5154
let bogo_size = crate::to_u32(self.bogo_size, "bogo_size")?;
52-
let hash_serialized_2 = None; // Removed in Core v26
5355
let disk_size = crate::to_u32(self.disk_size, "disk_size")?;
5456
let total_amount = Amount::from_btc(self.total_amount).map_err(E::TotalAmount)?;
5557

@@ -59,7 +61,8 @@ impl GetTxOutSetInfo {
5961
transactions,
6062
tx_outs,
6163
bogo_size,
62-
hash_serialized_2,
64+
hash_serialized_2: None, // v17 to v25 only.
65+
hash_serialized_3: self.hash_serialized_3,
6366
disk_size,
6467
total_amount,
6568
})

0 commit comments

Comments
 (0)