From 2945c6be88b3bf5105afeb8addff4861f0458b41 Mon Sep 17 00:00:00 2001 From: Wei Chen Date: Mon, 6 May 2024 15:52:57 +0800 Subject: [PATCH] fix(electrum): fixed `sync` functionality --- crates/electrum/src/electrum_ext.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/crates/electrum/src/electrum_ext.rs b/crates/electrum/src/electrum_ext.rs index a746c52cf..4c6786557 100644 --- a/crates/electrum/src/electrum_ext.rs +++ b/crates/electrum/src/electrum_ext.rs @@ -147,7 +147,7 @@ impl ElectrumExt for E { let full_scan_req = FullScanRequest::from_chain_tip(request.chain_tip.clone()) .cache_txs(request.tx_cache) .set_spks_for_keychain((), request.spks.enumerate().map(|(i, spk)| (i as u32, spk))); - let full_scan_res = self.full_scan(full_scan_req, usize::MAX, batch_size)?; + let mut full_scan_res = self.full_scan(full_scan_req, usize::MAX, batch_size)?; let (tip, _) = construct_update_tip(self, request.chain_tip)?; let cps = tip @@ -156,9 +156,20 @@ impl ElectrumExt for E { .map(|cp| (cp.height(), cp)) .collect::>(); - let mut tx_graph = TxGraph::::default(); - populate_with_txids(self, &cps, &mut tx_cache, &mut tx_graph, request.txids)?; - populate_with_outpoints(self, &cps, &mut tx_cache, &mut tx_graph, request.outpoints)?; + populate_with_txids( + self, + &cps, + &mut tx_cache, + &mut full_scan_res.graph_update, + request.txids, + )?; + populate_with_outpoints( + self, + &cps, + &mut tx_cache, + &mut full_scan_res.graph_update, + request.outpoints, + )?; Ok(SyncResult { chain_update: full_scan_res.chain_update,