Skip to content

Commit fba125f

Browse files
LagginTimesevanlinjin
authored andcommitted
fix(electrum): fixed sync functionality
1 parent f1c013a commit fba125f

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

crates/electrum/src/electrum_ext.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<E: ElectrumApi> ElectrumExt for E {
147147
let full_scan_req = FullScanRequest::from_chain_tip(request.chain_tip.clone())
148148
.cache_txs(request.tx_cache)
149149
.set_spks_for_keychain((), request.spks.enumerate().map(|(i, spk)| (i as u32, spk)));
150-
let full_scan_res = self.full_scan(full_scan_req, usize::MAX, batch_size)?;
150+
let mut full_scan_res = self.full_scan(full_scan_req, usize::MAX, batch_size)?;
151151

152152
let (tip, _) = construct_update_tip(self, request.chain_tip)?;
153153
let cps = tip
@@ -156,9 +156,20 @@ impl<E: ElectrumApi> ElectrumExt for E {
156156
.map(|cp| (cp.height(), cp))
157157
.collect::<BTreeMap<u32, CheckPoint>>();
158158

159-
let mut tx_graph = TxGraph::<ConfirmationHeightAnchor>::default();
160-
populate_with_txids(self, &cps, &mut tx_cache, &mut tx_graph, request.txids)?;
161-
populate_with_outpoints(self, &cps, &mut tx_cache, &mut tx_graph, request.outpoints)?;
159+
populate_with_txids(
160+
self,
161+
&cps,
162+
&mut tx_cache,
163+
&mut full_scan_res.graph_update,
164+
request.txids,
165+
)?;
166+
populate_with_outpoints(
167+
self,
168+
&cps,
169+
&mut tx_cache,
170+
&mut full_scan_res.graph_update,
171+
request.outpoints,
172+
)?;
162173

163174
Ok(SyncResult {
164175
chain_update: full_scan_res.chain_update,

0 commit comments

Comments
 (0)