Skip to content

Commit cfaaa4b

Browse files
author
pythcoiner
committed
fix
1 parent 264f09a commit cfaaa4b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/commands/mod.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -584,15 +584,17 @@ impl DaemonControl {
584584
let mut db_conn = self.db.connection();
585585
let spend_psbts = db_conn.list_spend();
586586

587-
let txids_set: HashSet<_> = txids
588-
.as_ref()
589-
.map(|list| list.iter().cloned().collect())
590-
.unwrap_or_default();
587+
let txids_set: Option<HashSet<_>> =
588+
txids.as_ref().map(|list| list.iter().cloned().collect());
591589

592590
let spend_txs = spend_psbts
593591
.into_iter()
594592
.filter(|(psbt, _)| {
595-
txids_set.is_empty() || txids_set.contains(&psbt.unsigned_tx.txid())
593+
if let Some(set) = &txids_set {
594+
set.contains(&psbt.unsigned_tx.txid())
595+
} else {
596+
false
597+
}
596598
})
597599
.map(|(psbt, updated_at)| ListSpendEntry { psbt, updated_at })
598600
.collect();

tests/test_rpc.py

-1
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ def test_list_spend(lianad, bitcoind):
485485
# change and which one doesn't.
486486
list_res = lianad.rpc.listspendtxs()["spend_txs"]
487487
assert len(list_res) == 2
488-
489488
first_psbt = next(entry for entry in list_res if entry["psbt"] == res["psbt"])
490489
assert time_before_update <= first_psbt["updated_at"] <= int(time.time())
491490
second_psbt = next(entry for entry in list_res if entry["psbt"] == res_b["psbt"])

0 commit comments

Comments
 (0)