Skip to content

Commit f673f70

Browse files
committed
fix(electrum): Only set last seen time for unconfirmed txs
Once a transaction is anchored in a confirmed block, changing the last seen time again leads to needless writes to the database.
1 parent c9dd821 commit f673f70

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

crates/electrum/src/electrum_ext.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ impl RelevantTxids {
4646
let new_txs = client.batch_transaction_get(&missing)?;
4747
let mut graph = TxGraph::<ConfirmationHeightAnchor>::new(new_txs);
4848
for (txid, anchors) in self.0 {
49-
if let Some(seen_at) = seen_at {
50-
let _ = graph.insert_seen_at(txid, seen_at);
49+
if anchors.is_empty() {
50+
if let Some(seen_at) = seen_at {
51+
let _ = graph.insert_seen_at(txid, seen_at);
52+
}
5153
}
5254
for anchor in anchors {
5355
let _ = graph.insert_anchor(txid, anchor);

0 commit comments

Comments
 (0)