@@ -1852,27 +1852,96 @@ 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( default , 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( default , 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( default , 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( default , 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+ default ,
1902+ skip_serializing_if = "Option::is_none" ,
1903+ with = "bitcoin::util::amount::serde::as_btc::opt"
1904+ ) ]
1905+ pub total_unspendable_amount : Option < Amount > ,
1906+ /// Info on amounts in the block at this block height (only available if coinstatsindex is used)
1907+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1908+ pub block_info : Option < BlockInfo > ,
1909+ }
1910+
1911+ /// Info on amounts in the block at the block height of the `gettxoutsetinfo` call (only available if coinstatsindex is used)
1912+ #[ derive( Clone , PartialEq , Eq , Debug , Deserialize , Serialize ) ]
1913+ pub struct BlockInfo {
1914+ /// Amount of previous outputs spent
1915+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1916+ pub prevout_spent : Amount ,
1917+ /// Output size of the coinbase transaction
1918+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1919+ pub coinbase : Amount ,
1920+ /// Newly-created outputs
1921+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1922+ pub new_outputs_ex_coinbase : Amount ,
1923+ /// Amount of unspendable outputs
1924+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1925+ pub unspendable : Amount ,
1926+ /// Detailed view of the unspendable categories
1927+ pub unspendables : Unspendables ,
1928+ }
1929+
1930+ /// Detailed view of the unspendable categories
1931+ #[ derive( Clone , PartialEq , Eq , Debug , Deserialize , Serialize ) ]
1932+ pub struct Unspendables {
1933+ /// Unspendable coins from the Genesis block
1934+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1935+ pub genesis_block : Amount ,
1936+ /// Transactions overridden by duplicates (no longer possible with BIP30)
1937+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1938+ pub bip30 : Amount ,
1939+ /// Amounts sent to scripts that are unspendable (for example OP_RETURN outputs)
1940+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1941+ pub scripts : Amount ,
1942+ /// Fee rewards that miners did not claim in their coinbase transaction
1943+ #[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1944+ pub unclaimed_rewards : Amount ,
18761945}
18771946
18781947#[ derive( Clone , PartialEq , Eq , Debug , Deserialize , Serialize ) ]
0 commit comments