Skip to content

Exploration: add custom sync methods#1012

Open
thunderbiscuit wants to merge 1 commit into
bitcoindevkit:masterfrom
thunderbiscuit:feat/custom-sync
Open

Exploration: add custom sync methods#1012
thunderbiscuit wants to merge 1 commit into
bitcoindevkit:masterfrom
thunderbiscuit:feat/custom-sync

Conversation

@thunderbiscuit

Copy link
Copy Markdown
Member

This is WIP, but would basically allow you to sync specific indices on either of your keychains, or say "sync me the last x number of addresses on each keychain".

Description

Notes to the reviewers

Documentation

Changelog

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing
  • I've added exactly one changelog:* label
  • I've linked the relevant upstream docs or specs above

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

Comment thread bdk-ffi/src/wallet.rs
.map(|spk| ((KeychainKind::Internal, i), spk))
}));

let builder = BdkSyncRequest::builder()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we preserve the expected_spk_txids behavior that BDK Wallet’s normal start_sync_with_revealed_spks{,_at} path adds? Those expected txids are used by sync backends to detect previously-seen mempool txs that disappear from SPK history. As written, this custom SyncRequest builder only sets the chain tip and selected SPKs, so these selective sync APIs can silently miss eviction/replacement updates compared with the existing sync path.

Comment thread bdk-ffi/src/wallet.rs
Arc::new(SyncRequestBuilder(Mutex::new(Some(builder))))
}

/// Create a partial [`SyncRequest`] for a specific set of derivation indices.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a new public FFI API, could we add tests that reveal a known set of external/internal addresses and assert the request contains only the selected indices / last N revealed SPKs? That would also help guard this custom builder against drifting from BDK Wallet’s normal sync-request semantics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants