Skip to content

Commit

Permalink
fix(ln-dlc-node): Only sync UTXOs owned by the wallet
Browse files Browse the repository at this point in the history
It turns out that we don't need to watch literaly all the UTXOs ever
:facepalm:
  • Loading branch information
luckysori committed Mar 11, 2024
1 parent c33b6be commit eb4145d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crates/ln-dlc-node/src/on_chain_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,15 @@ impl<D> OnChainWallet<D> {
.map(|tx| tx.tx_node.txid)
.collect();

// We must watch every UTXO we own (until it is spent).
let indexed_outpoints = bdk.spk_index().outpoints().iter().cloned();
let utxos = bdk
.tx_graph()
.all_txouts()
.map(|(outpoint, _)| outpoint)
.filter_chain_unspents(
&local_chain,
local_chain.tip().block_id(),
indexed_outpoints,
)
.map(|(_, utxo)| utxo.outpoint)
.collect();

(
Expand Down

0 comments on commit eb4145d

Please sign in to comment.