Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pythcoiner committed Jan 23, 2024
1 parent 264f09a commit cfaaa4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,15 +584,17 @@ impl DaemonControl {
let mut db_conn = self.db.connection();
let spend_psbts = db_conn.list_spend();

let txids_set: HashSet<_> = txids
.as_ref()
.map(|list| list.iter().cloned().collect())
.unwrap_or_default();
let txids_set: Option<HashSet<_>> =
txids.as_ref().map(|list| list.iter().cloned().collect());

let spend_txs = spend_psbts
.into_iter()
.filter(|(psbt, _)| {
txids_set.is_empty() || txids_set.contains(&psbt.unsigned_tx.txid())
if let Some(set) = &txids_set {
set.contains(&psbt.unsigned_tx.txid())
} else {
false
}
})
.map(|(psbt, updated_at)| ListSpendEntry { psbt, updated_at })
.collect();
Expand Down
1 change: 0 additions & 1 deletion tests/test_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,6 @@ def test_list_spend(lianad, bitcoind):
# change and which one doesn't.
list_res = lianad.rpc.listspendtxs()["spend_txs"]
assert len(list_res) == 2

first_psbt = next(entry for entry in list_res if entry["psbt"] == res["psbt"])
assert time_before_update <= first_psbt["updated_at"] <= int(time.time())
second_psbt = next(entry for entry in list_res if entry["psbt"] == res_b["psbt"])
Expand Down

0 comments on commit cfaaa4b

Please sign in to comment.