-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Parent: #236 (Phase 1)
Problem
CPFP detection and RBF conflict detection in sync.rs use .find() inside loops over all BDK transactions, resulting in O(n²) complexity. At 50K+ transactions, sync takes minutes instead of milliseconds.
What to change
CPFP detection
Replace:
all_bdk_txs.iter().find(|tx| tx.txid.to_string() == *txid)With a pre-built HashMap<String, &CanonicalTx> keyed by txid, built once before the loop.
RBF conflict detection
Same pattern — the nested loop searches all_bdk_txs linearly for each conflicted and canonical txid. Build the HashMap once, do O(1) lookups.
Expected result
- O(N) total instead of O(N²)
- 50K tx sync: <100ms instead of minutes
- Memory: one HashMap allocation (~50K entries) instead of repeated linear scans
Key files
backend/src/sync.rs— CPFP detection and RBF conflict detection
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request