Browse Source

lightwallet get_utxos

mempool
Jonathan "Duke" Leto 2 years ago
parent
commit
741d37002c
  1. 14
      lib/src/lightwallet.rs

14
lib/src/lightwallet.rs

@ -1078,13 +1078,13 @@ impl LightWallet {
}
// Get all (unspent) utxos. Unconfirmed spent utxos are included
pub fn get_utxos(&self) -> Vec<Utxo> {
let txs = self.txs.read().unwrap();
txs.values()
.flat_map(|tx| {
tx.utxos.iter().filter(|utxo| utxo.spent.is_none())
})
pub async fn get_utxos(&self) -> Vec<Utxo> {
self.txns
.read()
.await
.current
.values()
.flat_map(|tx| tx.utxos.iter().filter(|utxo| utxo.spent.is_none()))
.map(|utxo| utxo.clone())
.collect::<Vec<Utxo>>()
}

Loading…
Cancel
Save