rust-bitcoin / rust-bitcoincore-rpc

Rust RPC client library for the Bitcoin Core JSON-RPC API.
343 stars 256 forks source link

chore: add new blockhash and confirmations fields to Utxo struct #366

Open luisschwab opened 4 months ago

luisschwab commented 4 months ago

As per PR #30515 on Bitcoin Core, two new fields are added on the output of scantxoutset for versions v28 and above:

This PR adds these two new fields on the Utxo struct as an Option, since not all clients will be running v28:

pub struct Utxo {
    pub txid: bitcoin::Txid,
    pub vout: u32,
    pub script_pub_key: bitcoin::ScriptBuf,
    #[serde(rename = "desc")]
    pub descriptor: String,
    #[serde(with = "bitcoin::amount::serde::as_btc")]
    pub amount: bitcoin::Amount,
    pub height: u64,
+   pub blockhash: Option<bitcoin::BlockHash>,
+   pub confirmations: Option<u64>,
}