@@ -1852,27 +1852,95 @@ pub struct SignRawTransactionInput {
18521852 pub amount : Option < Amount > ,
18531853}
18541854
1855+ /// Used to represent UTXO set hash type
1856+ #[ derive( Clone , Serialize , PartialEq , Eq , Debug ) ]
1857+ #[ serde( rename_all = "snake_case" ) ]
1858+ pub enum TxOutSetHashType {
1859+ HashSerialized2 ,
1860+ Muhash ,
1861+ None ,
1862+ }
1863+
1864+ /// Used to specify a block hash or a height
1865+ #[ derive( Clone , Serialize , PartialEq , Eq , Debug ) ]
1866+ #[ serde( untagged) ]
1867+ pub enum HashOrHeight {
1868+ BlockHash ( bitcoin:: BlockHash ) ,
1869+ Height ( u64 ) ,
1870+ }
1871+
18551872#[ derive( Clone , PartialEq , Eq , Debug , Deserialize , Serialize ) ]
18561873pub struct GetTxOutSetInfoResult {
1857- /// The current block height (index)
1874+ /// The block height (index) of the returned statistics
18581875 pub height : u64 ,
1859- /// The hash of the block at the tip of the chain
1876+ /// The hash of the block at which these statistics are calculated
18601877 #[ serde( rename = "bestblock" ) ]
18611878 pub best_block : bitcoin:: BlockHash ,
1862- /// The number of transactions with unspent outputs
1863- pub transactions : u64 ,
1879+ /// The number of transactions with unspent outputs (not available when coinstatsindex is used)
1880+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1881+ pub transactions : Option < u64 > ,
18641882 /// The number of unspent transaction outputs
18651883 #[ serde( rename = "txouts" ) ]
18661884 pub tx_outs : u64 ,
18671885 /// A meaningless metric for UTXO set size
18681886 pub bogosize : u64 ,
1869- /// The serialized hash
1870- pub hash_serialized_2 : sha256:: Hash ,
1871- /// The estimated size of the chainstate on disk
1872- pub disk_size : u64 ,
1887+ /// The serialized hash (only present if 'hash_serialized_2' hash_type is chosen)
1888+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1889+ pub hash_serialized_2 : Option < sha256:: Hash > ,
1890+ /// The serialized hash (only present if 'muhash' hash_type is chosen)
1891+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1892+ pub muhash : Option < sha256:: Hash > ,
1893+ /// The estimated size of the chainstate on disk (not available when coinstatsindex is used)
1894+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1895+ pub disk_size : Option < u64 > ,
18731896 /// The total amount
18741897 #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
18751898 pub total_amount : Amount ,
1899+ /// The total amount of coins permanently excluded from the UTXO set (only available if coinstatsindex is used)
1900+ #[ serde(
1901+ skip_serializing_if = "Option::is_none" ,
1902+ with = "bitcoin::util::amount::serde::as_btc::opt"
1903+ ) ]
1904+ pub total_unspendable_amount : Option < Amount > ,
1905+ /// Info on amounts in the block at this block height (only available if coinstatsindex is used)
1906+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1907+ pub block_info : Option < BlockInfo > ,
1908+ }
1909+
1910+ /// Info on amounts in the block at the block height of the `gettxoutsetinfo` call (only available if coinstatsindex is used)
1911+ #[ derive( Clone , PartialEq , Eq , Debug , Deserialize , Serialize ) ]
1912+ pub struct BlockInfo {
1913+ /// Amount of previous outputs spent
1914+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1915+ pub prevout_spent : Amount ,
1916+ /// Output size of the coinbase transaction
1917+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1918+ pub coinbase : Amount ,
1919+ /// Newly-created outputs
1920+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1921+ pub new_outputs_ex_coinbase : Amount ,
1922+ /// Amount of unspendable outputs
1923+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1924+ pub unspendable : Amount ,
1925+ /// Detailed view of the unspendable categories
1926+ pub unspendables : Unspendables ,
1927+ }
1928+
1929+ /// Detailed view of the unspendable categories
1930+ #[ derive( Clone , PartialEq , Eq , Debug , Deserialize , Serialize ) ]
1931+ pub struct Unspendables {
1932+ /// Unspendable coins from the Genesis block
1933+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1934+ pub genesis_block : Amount ,
1935+ /// Transactions overridden by duplicates (no longer possible with BIP30)
1936+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1937+ pub bip30 : Amount ,
1938+ /// Amounts sent to scripts that are unspendable (for example OP_RETURN outputs)
1939+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1940+ pub scripts : Amount ,
1941+ /// Fee rewards that miners did not claim in their coinbase transaction
1942+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1943+ pub unclaimed_rewards : Amount ,
18761944}
18771945
18781946#[ derive( Clone , PartialEq , Eq , Debug , Deserialize , Serialize ) ]
0 commit comments