Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit 4920d35

Browse files
committed
Don't sync unconfirmed txids when syncing bdk
1 parent 2fee185 commit 4920d35

1 file changed

Lines changed: 3 additions & 18 deletions

File tree

mutiny-core/src/onchain.rs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -168,30 +168,15 @@ impl<S: MutinyStorage> OnChainWallet<S> {
168168
self.storage.delete(&[NEED_FULL_SYNC_KEY])?;
169169
}
170170
// get first wallet lock that only needs to read
171-
let (spks, txids, chain, prev_tip) = {
171+
let (spks, chain, prev_tip) = {
172172
if let Ok(wallet) = self.wallet.try_read() {
173173
let spk_vec = wallet
174174
.spk_index()
175175
.unused_spks()
176176
.map(|(_, _, v)| ScriptBuf::from(v))
177177
.collect::<Vec<_>>();
178178

179-
let chain = wallet.local_chain();
180-
let chain_tip = chain.tip().block_id();
181-
182-
let unconfirmed_txids = wallet
183-
.tx_graph()
184-
.list_chain_txs(chain, chain_tip)
185-
.filter(|canonical_tx| !canonical_tx.chain_position.is_confirmed())
186-
.map(|canonical_tx| canonical_tx.tx_node.txid)
187-
.collect::<Vec<Txid>>();
188-
189-
(
190-
spk_vec,
191-
unconfirmed_txids,
192-
chain.clone(),
193-
wallet.latest_checkpoint(),
194-
)
179+
(spk_vec, wallet.local_chain(), wallet.latest_checkpoint())
195180
} else {
196181
log_error!(self.logger, "Could not get wallet lock to sync");
197182
return Err(MutinyError::WalletOperationFailed);
@@ -200,7 +185,7 @@ impl<S: MutinyStorage> OnChainWallet<S> {
200185

201186
let update_graph = self
202187
.blockchain
203-
.sync(spks, txids, core::iter::empty(), 5)
188+
.sync(spks, core::iter::empty(), core::iter::empty(), 5)
204189
.await?;
205190
let missing_heights = update_graph.missing_heights(&chain);
206191
let chain_update = self

0 commit comments

Comments
 (0)