Skip to content

feat: expose Wallet create and load params - #1044

Merged
reez merged 2 commits into
bitcoindevkit:masterfrom
reez:params2
Jul 30, 2026
Merged

reez merged 2 commits into
bitcoindevkit:masterfrom
reez:params2

Conversation

@reez

@reez reez commented Jul 1, 2026 •

Copy link
Copy Markdown
Collaborator

#1030 first

Description

Exposes CreateParams and LoadParams so callers can configure genesis hash, lookahead, SPK cache, and loadtime checks when creating or loading wallets.

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

@thunderbiscuit thunderbiscuit added this to the 3.1.0 milestone Jul 8, 2026
@reez
reez marked this pull request as ready for review July 28, 2026 21:47
@reez
reez requested a review from thunderbiscuit July 28, 2026 21:48
@reez

reez commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

I kept it in 2 commits because 2nd commit built on #1042, but will squash into 1 commit when merge

@thunderbiscuit thunderbiscuit left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ACK af845a5.

We're now at 12 constructors on the wallet, which is a bit of a code smell for me (and the lookahead is now potentially passed twice, once as a straight argument and then again in the params argument).

Looking at this I wonder if adding the Params as a default of None would solve this (12 constructors to 6). The issues is maybe how downstream languages handle default arguments (I haven't dug into whether that'd be breaking for JS for example).

#[derive(Clone, Debug, uniffi::Record)]
pub struct CreateParams {
    #[uniffi(default = None)]
    pub genesis_hash: Option<Arc<BlockHash>>,
    #[uniffi(default = false)]
    pub use_spk_cache: bool,
}

#[uniffi::constructor(default(lookahead = 25, params = None))]
pub fn new(
    descriptor: Arc<Descriptor>,
    change_descriptor: Arc<Descriptor>,
    network: Network,
    persister: Arc<Persister>,
    lookahead: u32,
    params: Option<CreateParams>,
) -> Result<Self, CreateWithPersistError>

Overall this is a good addition and non-breaking, so I think we can just go ahead and ship 3.1 with it. But looking at 4.0 cleaning this up would be a good goal.

@reez
reez merged commit 18e180f into bitcoindevkit:master Jul 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants