From a385342db1f7bbaab79a432852bf033f1e60b199 Mon Sep 17 00:00:00 2001 From: Daniel Karzel Date: Tue, 12 Oct 2021 11:48:42 +1100 Subject: [PATCH] Add txid to `model::Attesttion` so we can easily access it This makes it more comfortable to send `txid` to the UI. --- daemon/src/model/cfd.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/daemon/src/model/cfd.rs b/daemon/src/model/cfd.rs index 0c5d09f..a4bc67d 100644 --- a/daemon/src/model/cfd.rs +++ b/daemon/src/model/cfd.rs @@ -291,6 +291,7 @@ pub struct Attestation { #[serde(with = "::bdk::bitcoin::util::amount::serde::as_sat")] payout: Amount, price: u64, + txid: Txid, } impl Attestation { @@ -307,6 +308,8 @@ impl Attestation { .find_map(|(_, cet)| cet.iter().find(|cet| cet.range.contains(&price))) .context("Unable to find attested price in any range")?; + let txid = cet.tx.txid(); + let payout = cet .tx .output @@ -326,6 +329,7 @@ impl Attestation { price, scalars, payout, + txid, }) }