Repository navigation
Description
When birthday_height is None, the account starts 100 blocks below the chain tip. The docs say otherwise. I ran this at the head of #27 (9ad0a58) and read the same code on main (317d790).
How I ran it. A native harness calls the inner Rust Wallet methods that the wasm bindings wrap, over native tonic, against a public mainnet lightwalletd, at #27's head (it pins zcash_client_backend 0.25.0; main requires 0.24.0-rc.1). The key is a throwaway key that holds no funds. The bindings and the browser transport were not exercised. The program and its output are in https://github.com/deegalabs/WebZjs/tree/409ce5a294db0a196a24e446f7687621bc9f3677/repro/birthday-lock-stall. Note 4 is the run. Notes 1, 2 and 5 to 7 are read from the code.
import_account_ufvkreads the tip withget_latest_blockand useschain_tip - 100(wallet.rs:232-244).create_account,create_account_ufvkandcreate_account_view_ufvkpass theirOption<u32>straight to it (bindgen/wallet.rs:175, :208, :247), so all three do this.- A restored seed or an imported key given no birthday scans from 100 blocks below the tip. Notes received earlier are not found. The balance leaves them out and no error is raised. It reads 0 when every note is older. That older notes are missed follows from the scan start. I did not run that case, because it needs a wallet with funded notes.
- Measured.
import_ufvkandcreate_accountwithNonestore a birthday of tip minus 100 (3,617,626 at a tip of 3,617,726), read back from the account. The UFVK path and the seed path give the same result. - The docs say two other things. The Rust doc says "optionally None and the current height is used" (wallet.rs:178). The
WebWalletdoc says a missing birthday means the wallet "will need to scan the entire blockchain" (bindgen/wallet.rs:51). Thebirthday_heightdocs of the three functions do not say whatNonedoes (:167). - The web wallet creates its account with the tip as birthday (useWebzjsActions.ts:250-254). Full Resync passes
undefinedwhen it has no custom birthday and no storedwebWalletSyncStartBlock(:417-419, :453), so it takes this path too. - There is no call that changes an account's birthday after import. A wallet created this way is repaired only by building a new one.
Fix to consider. Make birthday_height a required u32 in the three JS functions, so every caller chooses one.
If that is too strict, two other ways.
- Return an
Errorwhen it isNone, with a message that names the problem. - Keep the default, document it in all three functions, and correct the two docs above.
🤖 Generated with Claude Code
Activity