Skip to content

Comments

refactor: lazy sync requests and batched payment store updates#62

Open
ben-kaufman wants to merge 2 commits intofix/peer-address-upsert-mainfrom
refactor/lazy-sync-requests-batched-payment-store
Open

refactor: lazy sync requests and batched payment store updates#62
ben-kaufman wants to merge 2 commits intofix/peer-address-upsert-mainfrom
refactor/lazy-sync-requests-batched-payment-store

Conversation

@ben-kaufman
Copy link

This PR:

  1. Splits wallet_sync_request into separate full-scan and incremental methods so only the needed request type is built per sync cycle
  2. Introduces a WalletSyncRequest enum to carry the chosen sync variant through the pipeline
  3. Spawns primary and additional wallet syncs concurrently in a single JoinSet instead of running primary sequentially first
  4. Batches update_payment_store_for_all_transactions and write_node_metrics into a single call after all wallet updates are applied
  5. Fixes a pre-existing bug where additional wallet sync timestamps were set even when apply_update_for_address_type failed

QA Notes

Testing

  • cargo test passes
  • cargo clippy clean
  • Verify Electrum sync path works with multiple address types
  • Verify Esplora sync path works with multiple address types
  • Confirm payment store is updated correctly after sync

Notes

  • No API changes — internal refactor only, no binding regeneration needed
  • The apply_update and apply_update_for_address_type methods now require callers to call update_payment_store_for_all_transactions afterward (documented via doc comments)

Made with Cursor

ben-kaufman and others added 2 commits February 24, 2026 13:09
Split wallet_sync_request into separate full_scan and incremental
methods so only the needed request type is built. Introduce
WalletSyncRequest enum to carry the chosen variant through the
sync pipeline.

Spawn primary and additional wallet syncs concurrently in a single
JoinSet instead of running primary first. Batch
update_payment_store_for_all_transactions and write_node_metrics
into a single call after all updates are applied, and only when at
least one update succeeded.

Fix a pre-existing bug where additional wallet sync timestamps
were set even when apply_update_for_address_type failed.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants