@@ -1852,27 +1852,96 @@ pub struct SignRawTransactionInput {
1852
1852
pub amount : Option < Amount > ,
1853
1853
}
1854
1854
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
+
1855
1872
#[ derive( Clone , PartialEq , Eq , Debug , Deserialize , Serialize ) ]
1856
1873
pub struct GetTxOutSetInfoResult {
1857
- /// The current block height (index)
1874
+ /// The block height (index) of the returned statistics
1858
1875
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
1860
1877
#[ serde( rename = "bestblock" ) ]
1861
1878
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 > ,
1864
1882
/// The number of unspent transaction outputs
1865
1883
#[ serde( rename = "txouts" ) ]
1866
1884
pub tx_outs : u64 ,
1867
1885
/// A meaningless metric for UTXO set size
1868
1886
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 > ,
1873
1896
/// The total amount
1874
1897
#[ serde( with = "bitcoin::util::amount::serde::as_btc" ) ]
1875
1898
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 ,
1876
1945
}
1877
1946
1878
1947
#[ derive( Clone , PartialEq , Eq , Debug , Deserialize , Serialize ) ]
0 commit comments