Skip to content

wallet: Date a new wallet by this computer's clock - #217

Open
BenWestgate wants to merge 2 commits into
gui-before-you-startfrom
claude/project-thread-p319g5
Open

BenWestgate wants to merge 2 commits into
gui-before-you-startfrom
claude/project-thread-p319g5

Conversation

@BenWestgate

Copy link
Copy Markdown
Owner

Requested by Ben · project thread

Follows Ben's review on BenWestgate/Bails#366 (comment): restores use the date the user gives, new wallets use the wall clock. Restores already do (#191). New wallets still imported with "now".

Bug. Core resolves "now" to its tip's median time. On an offline signer that never synced, that's the genesis block. So every new wallet's descriptors are dated genesis, and Bitcoin QR (which now carries the source timestamp) makes the online node rescan from genesis, which a pruned CipherStick can't do.

Change. One line in BitcoinCore.initialize: "now" becomes int(time.time()) - 86400. The day early matches parse_creation_date, so a clock up to a day fast can't make Core skip the wallet's first payments. check_history still skips new wallets. This covers the GUI and ms32 create/wallet --timestamp now.

Checked. On a Core 32.1 regtest signer at genesis, descriptors were dated 1296688602 (genesis) on 6c64411 and clock − 1 day here. The signer still found a 1.25 BTC payment from blocks it synced later. pytest: 659 passed, 2 skipped. The bip32-oracle modules (test_cli, test_generation, test_correction_*, one test_generic_hrp test) couldn't run here because the cloud proxy blocks the pinned GitHub tarball, so CI covers them. ruff and mypy are clean.

Stacked on #113 (#190 → #191 → #113 → this). Needs Ben's security review (recovery path). Bails #332's pin should then move from b045908 to this head.


Generated by Claude Code

Bitcoin Core resolves an import timestamp of "now" to its tip's median
time. On an offline signer that never synced, that is the genesis block,
so every new wallet was born in 2009, and the watch-only copy Bails
exports from it asks the online node to rescan from genesis, which a
pruned node cannot do.

A new wallet now takes this computer's clock, a day early like a
recorded creation date, so a clock running up to a day fast cannot skip
its first payments. Restores keep the recorded date.

On a Core 32.1 regtest signer at genesis, the descriptors were dated
1296688602 (genesis) before and the clock less a day after; the signer
still found a payment from blocks it synced later.

Claude-Session: https://claude.ai/code/session_01N8jLK61uohaW6W7Y8AHnMb
@BenWestgate BenWestgate self-assigned this Nov 4, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T18:43:47.490155Z ae9d360 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@BenWestgate
BenWestgate added this pull request to stack #204 November 10, 2026 04:55

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.

1 participant