Skip to content

Commit

Permalink
Merge #1340: v7: backport #1338
Browse files Browse the repository at this point in the history
cba8072 poller: query deposit tx for all coins, including expired (Antoine Poinsot)

Pull request description:

  Clean backport of #1338.

ACKs for top commit:
  darosior:
    ACK cba8072 -- clean backport of #1338, which was ACK'd by Michael.

Tree-SHA512: 06982237c755a2c9628615c59ae80258961ca66c068f8a615e97366799fa955704de08ae151a18d5a666780c1ae497700be69ad7fb86301a235f79bb199cfb49
  • Loading branch information
darosior committed Sep 16, 2024
2 parents 2056119 + cba8072 commit 7a2edeb
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/bitcoin/poller/looper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,10 @@ fn add_txs_to_db(
) {
let curr_txids: HashSet<_> = db_conn.list_saved_txids().into_iter().collect();
let mut new_txids = HashSet::new();
// First get all newly received coins that have not expired.
new_txids.extend(updated_coins.received.iter().filter_map(|c| {
if !updated_coins.expired.contains(&c.outpoint) {
Some(c.outpoint.txid)
} else {
None
}
}));
// Get the transaction for all newly received coins. Note we also query it if the coins
// expired, as it's possible for coin to not be in DB already (and therefore not have its
// deposit transaction stored there), to be marked as expired *and* newly received. In this
new_txids.extend(updated_coins.received.iter().map(|c| c.outpoint.txid));

// Add spend txid for new & existing coins.
new_txids.extend(updated_coins.spending.iter().map(|(_, txid)| txid));
Expand Down

0 comments on commit 7a2edeb

Please sign in to comment.