Skip to content

feat(import): select rescan height by month and year (#638) - #1503

Open
abhayrajjais01 wants to merge 10 commits into
joinmarket-webui:develfrom
abhayrajjais01:feat/import-rescan-date-picker
Open

abhayrajjais01 wants to merge 10 commits into
joinmarket-webui:develfrom
abhayrajjais01:feat/import-rescan-date-picker

Conversation

@abhayrajjais01

Copy link
Copy Markdown
Contributor

What does this PR do?

This pull request implements Part 1 of Issue #638 based on the maintainer-approved plan and the bitcoin.design mockup:

  1. Date-to-Blockheight Calculation (src/lib/blockheight.ts):

    • Implements piecewise linear interpolation anchored to key verified Bitcoin milestones (Genesis, Halvings 1–4, SegWit, Taproot).
    • Incorporates a 1-month safety buffer (DEFAULT_SAFETY_BUFFER_MONTHS = 1, as approved by @theborakompanioni) to ensure transactions created early in the selected month are not skipped.
    • For historical dates back to Jan 2009 or prior, cleanly defaults to block 0 (Genesis).
    • Extrapolates future blocks past the latest checkpoint and clamps to currentBlockHeight if available.
    • Includes comprehensive unit tests.
  2. Tabbed RescanHeightSelector Component (src/components/import/RescanHeightSelector.tsx):

    • "By creation date" tab:
      • Month and Year dropdown selectors with descending years (current year down to 2009).
      • Informative hint showing the calculated blockheight and confirming the ~1 month safety buffer.
      • "Start at genesis block (Jan 2009)" toggle that locks dropdowns and sets blockheight to 0.
    • "By block number" tab:
      • Retains direct numeric block input with icon addon for advanced users.
      • Uses forceMount with hidden styling to preserve DOM presence and backward compatibility for existing tests and form validation.
  3. Form & Review Step Integration:

    • Integrated into ImportDetailsForm.tsx using Controller from react-hook-form.
    • Updated ImportStepConfirm.tsx to display "Block #0 (Genesis)" when blockheight is 0.
    • Added all necessary English translation keys in translation.json.

Visual Demo

Image Demo:

State Preview
By creation date (Month / Year selection) date_selection_june_2022_1790320125328
Start at Genesis block toggle genesis_switch_on_state_1790320336906
By block number (Direct block input) by_block_number_tab_state_1790320446426

@abhayrajjais01
abhayrajjais01 force-pushed the feat/import-rescan-date-picker branch from e404cae to f5a8225 Compare September 29, 2026 05:33

This branch has not been deployed

No deployments
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.

ui(import): Input custom rescan blockheight as year/month datepicker

1 participant