Browse Source

Add txid to `model::Attesttion` so we can easily access it

This makes it more comfortable to send `txid` to the UI.
refactor/no-log-handler
Daniel Karzel 3 years ago
parent
commit
a385342db1
No known key found for this signature in database GPG Key ID: 30C3FC2E438ADB6E
  1. 4
      daemon/src/model/cfd.rs

4
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,
})
}

Loading…
Cancel
Save