.into_iter()
.map(|outpoint| OutPoint::new(outpoint.txid, outpoint.vout))
.collect(),
)
}
#[cfg(test)]
fn set_durability(&mut self, durability: redb::Durability) {
self.durability = durability;
}
pub(crate) fn get_unspent_outputs(&self, wallet: Wallet) -> Result<BTreeMap<OutPoint, Amount>> {
let mut utxos = BTreeMap::new();
utxos.extend(
self
.client
.list_unspent(None, None, None, None, None)?
.into_iter()
.map(|utxo| {
let outpoint = OutPoint::new(utxo.txid, utxo.vout);
let amount = utxo.amount;
(outpoint, amount)
}),
);
let locked_utxos: BTreeSet<OutPoint> = self.get_locked_outputs(wallet)?;
for outpoint in locked_utxos {
utxos.insert(
outpoint,
Amount::from_sat(
self
.client
.get_raw_transaction(&outpoint.txid, None)?
.output[TryInto::<usize>::try_into(outpoint.vout).unwrap()]
.value,
),