Skip to content

Commit ea21d81

Browse files
committed
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.
1 parent d1030d8 commit ea21d81

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/chain/cbf.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,14 @@ impl CbfChainSource {
548548
let (tx, rx) = oneshot::channel();
549549
*self.sync_completion_tx.lock().expect("lock") = Some(tx);
550550

551-
if let Err(e) = requester.rescan().map_err(|e| {
551+
// Delegate the skip to kyoto so it doesn't re-stream filters we would discard
552+
// client-side via filter_skip_height. Without `_from`, kyoto replays from its
553+
// build-time checkpoint (potentially genesis on a fresh wallet) every tick.
554+
let rescan_res = match skip_before_height {
555+
Some(h) => requester.rescan_from(h),
556+
None => requester.rescan(),
557+
};
558+
if let Err(e) = rescan_res.map_err(|e| {
552559
log_error!(self.logger, "Failed to trigger CBF rescan: {:?}", e);
553560
Error::WalletOperationFailed
554561
}) {

0 commit comments

Comments
 (0)