From ea21d81b3313664381a8e19af1971599bfb7ced1 Mon Sep 17 00:00:00 2001 From: Alexander Shevtsov Date: Sat, 16 May 2026 02:24:36 +0200 Subject: [PATCH] Use kyoto's rescan_from(h) instead of rescan() Previously rescan would go from kyoto's build-time checkpoint, which might be a very old block. We can explicitely use rescan_from(height) to process only new blocks. --- src/chain/cbf.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/chain/cbf.rs b/src/chain/cbf.rs index eb53678bbc..8e0a7b3391 100644 --- a/src/chain/cbf.rs +++ b/src/chain/cbf.rs @@ -548,7 +548,14 @@ impl CbfChainSource { let (tx, rx) = oneshot::channel(); *self.sync_completion_tx.lock().expect("lock") = Some(tx); - if let Err(e) = requester.rescan().map_err(|e| { + // Delegate the skip to kyoto so it doesn't re-stream filters we would discard + // client-side via filter_skip_height. Without `_from`, kyoto replays from its + // build-time checkpoint (potentially genesis on a fresh wallet) every tick. + let rescan_res = match skip_before_height { + Some(h) => requester.rescan_from(h), + None => requester.rescan(), + }; + if let Err(e) = rescan_res.map_err(|e| { log_error!(self.logger, "Failed to trigger CBF rescan: {:?}", e); Error::WalletOperationFailed }) {