{
 "number": 34879,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/34879",
 "title": "wallet, test: remove unnecessary node restart from wallet_reindex",
 "author": "rkrux",
 "author_association": "MEMBER",
 "created_at": "2026-03-20T12:57:19Z",
 "updated_at": "2026-09-09T20:49:44Z",
 "age_days": 181,
 "draft": false,
 "labels": [],
 "milestone": null,
 "base": "master",
 "head_sha": "4996874b58b3f08b586eded89528fc5632fc909b",
 "head_ref": "wallet-birthtime",
 "head_repo": "rkrux/bitcoin",
 "head_history": [
  {
   "t": "2026-03-24T09:52:08Z",
   "sha": "fbbbe75ba9c0926a960852ac5ee130701d7507f6"
  },
  {
   "t": "2026-09-02T11:28:13Z",
   "sha": "4996874b58b3f08b586eded89528fc5632fc909b"
  }
 ],
 "additions": 90,
 "deletions": 93,
 "changed_files": 3,
 "commit_count": 2,
 "size_bucket": "M",
 "mergeable_state": "clean",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "ack": [
     {
      "login": "pablomartin4btc",
      "url": "https://github.com/bitcoin/bitcoin/pull/34879#pullrequestreview-5148129343"
     }
    ]
   },
   "conflicts": []
  }
 },
 "acks_parsed": {
  "pablomartin4btc": {
   "kind": "ack",
   "hash": "4996874b58b3f08b586eded89528fc5632fc909b",
   "t": "2026-09-08T23:39:33Z",
   "stale": false
  }
 },
 "acks_tally": {
  "ack": 1,
  "stale_ack": 0,
  "concept_ack": 0,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "pablomartin4btc",
   "polespinasa",
   "w0xlt"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "clean",
  "last_author_activity": "2026-09-02T11:29:14Z",
  "last_reviewer_activity": "2026-09-09T20:49:43Z",
  "last_reviewer": "pablomartin4btc",
  "author_silent_days": 15,
  "waiting_on_author_days": 7,
  "days_since_update": 7
 },
 "refs": {
  "mentioned": [
   34857
  ],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [
   {
    "number": 34857,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2026-03-24",
    "title": "test: Remove confusing assert_debug_log in wallet_reindex.py"
   }
  ],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [
  "test/functional/wallet_birthtime.py"
 ],
 "body": "The need for this change was ideated during the review of #34857.\n\n- The node doesn't need to be restarted (with reindex or without) because\nrescanblockchain RPC already updates the wallet birthtime, which is the property\nthat needs to be tested - this allows us to rename the test class to highlight\nthe change in intention of the test.\n- Generate 9 blocks fewer to fund the miner wallet.\n- Generate 30 blocks fewer because 20 are sufficient to surpass the wallet\nrescan window.\n- Use common bumpmocktime helper instead of custom advance_time function.\n- Unload miner wallet before 20 blocks generation to avoid notifications from\nbeing processed by that wallet.\n- Change the order of arguments in assert_equal for consistency.\n- Add few constant and verbose comments for test clarity.\n\nNote: This overhaul helps in reducing the time taken by the test from 2s to 0s as observed in few runs.",
 "commits": [
  {
   "sha": "3c260e70a121b77e95e05452486eff56335e7c9f",
   "date": "2026-09-02T11:23:17Z",
   "message": "test: rename wallet_reindex to wallet_birthtime\n\nThis rename precedes the change in intention of the test in the subsequent\ncommit."
  },
  {
   "sha": "4996874b58b3f08b586eded89528fc5632fc909b",
   "date": "2026-09-02T11:27:24Z",
   "message": "test: remove unnecessary restart from the test among other optimisations\n\nChanges done:\n- The node doesn't need to be restarted (with reindex or without) because\nrescanblockchain RPC already updates the wallet birthtime, which is the property\nthat needs to be tested - this allows us to rename the test class to highlight\nthe change in intention of the test.\n- Generate 9 blocks fewer to fund the miner wallet.\n- Generate 30 blocks fewer because 20 are sufficient to surpass the wallet\nrescan window.\n- Use common bumpmocktime helper instead of custom advance_time function.\n- Unload miner wallet before 20 blocks generation to avoid notifications from\nbeing processed by that wallet.\n- Change the order of arguments in assert_equal for consistency.\n- Add few constants and verbose comments for test clarity while removing\ncomments that allude to legacy wallets."
  }
 ],
 "timeline": [
  {
   "t": "2026-03-21T11:54:29Z",
   "kind": "comment",
   "who": "rkrux",
   "assoc": "MEMBER",
   "text": "It appears that this overhaul helps in reducing the tests time as well from 2s to 0s, which is nice to see.\n\nFew runs that I checked:\nwallet_reindex test time in macOS native job in other [PR1](https://github.com/bitcoin/bitcoin/actions/runs/23140061239/job/67213763443?pr=34667#step:9:3881) and [PR2](https://github.com/bitcoin/bitcoin/actions/runs/23332312140/job/67866296946?pr=34863#step:9:3883) - **2 sec**.\nwallet_birthtime test time in macOS native job in [this PR](https://github.com/bitcoin/bitcoin/actions/runs/23343833618/job/67903884742?pr=34879#step:9:3848) - **0 sec**."
  },
  {
   "t": "2026-03-22T08:04:54Z",
   "kind": "comment",
   "who": "w0xlt",
   "assoc": "CONTRIBUTOR",
   "text": "I\u2019ll take a closer look, but what\u2019s the motivation for those changes?"
  },
  {
   "t": "2026-03-22T08:34:56Z",
   "kind": "comment",
   "who": "rkrux",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nAs mentioned in the last line of the PR description, it started from the review of PR #34857 here: https://github.com/bitcoin/bitcoin/pull/34857#discussion_r2964881776"
  },
  {
   "t": "2026-03-22T08:38:00Z",
   "kind": "comment",
   "who": "rkrux",
   "assoc": "MEMBER",
   "text": "Thanks for asking, made me realise that the motivation was obscured away at the end of the PR description.\nI updated the PR description to highlight the motivation at the start."
  },
  {
   "t": "2026-03-24T09:52:08Z",
   "kind": "force_push",
   "who": "rkrux",
   "commit": "fbbbe75ba9c0926a960852ac5ee130701d7507f6"
  },
  {
   "t": "2026-08-12T22:25:40Z",
   "kind": "review_comment",
   "who": "pablomartin4btc",
   "assoc": "MEMBER",
   "path": "test/functional/wallet_birthtime.py",
   "commit": "fbbbe75ba9c0926a960852ac5ee130701d7507f6",
   "in_reply_to": null,
   "text": "nit: the comment says \"Blank wallets\" but the wallet isn't created with `blank=True` \u2014 the comment should describe the actual condition instead."
  },
  {
   "t": "2026-08-12T22:41:45Z",
   "kind": "review",
   "who": "pablomartin4btc",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "fbbbe75ba9c0926a960852ac5ee130701d7507f6",
   "text": "Concept ACK\n\nThe goal is correct \u2014 the old \"Reindex...\" comment was misleading, the restart never used `-reindex`, and `rescanblockchain` is sufficient to test birthtime updates (the restart coverage was dropped intentionally). All the optimisations check out: 20 blocks \u00d7 10 min = 200 min > 2h window, `COINBASE_MATURITY` + 1 is the right minimum, and `bumpmocktime` is cleaner than the custom helper.\n\nIn PR description, at bullet point 3, \"Generate 30 blocks fewer to accommodate for the wallet scan start time while importing descriptor with 'now' timestamp.\", it's more accurate to say \"30 fewer because 20 blocks is sufficient to surpass the 2-hour rescan window.\"\n\n**Commit structure:**\n\nThe commit ordering creates a transient inconsistency: commit 1 renames the class to `WalletBirthTimeTest` but the file is still `wallet_reindex.py`, so at that commit the class and file names are mismatched. Cleaner would be to rename both the file and class together in commit 1 (pure rename, git detects with `--find-renames`), then overhaul the content in commit 2 \u2014 that way the class and file names always match across commits. Or a single commit since it's all test-only changes.\n\nI think commit prefixes should both be `test:` \u2014 no production wallet code is touched.\n\nLeft an inline comment..."
  },
  {
   "t": "2026-09-02T11:28:13Z",
   "kind": "force_push",
   "who": "rkrux",
   "commit": "4996874b58b3f08b586eded89528fc5632fc909b"
  },
  {
   "t": "2026-09-02T11:29:14Z",
   "kind": "review_comment",
   "who": "rkrux",
   "assoc": "MEMBER",
   "path": "test/functional/wallet_birthtime.py",
   "commit": "fbbbe75ba9c0926a960852ac5ee130701d7507f6",
   "in_reply_to": 3770795264,
   "text": "Taken along with other suggestions in the overall review comment."
  },
  {
   "t": "2026-09-08T23:39:33Z",
   "kind": "review",
   "who": "pablomartin4btc",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "4996874b58b3f08b586eded89528fc5632fc909b",
   "text": "ACK 4996874b58b3f08b586eded89528fc5632fc909b\n\nThanks for taking the suggestions."
  },
  {
   "t": "2026-09-09T07:58:52Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "test/functional/wallet_birthtime.py",
   "commit": "3c260e70a121b77e95e05452486eff56335e7c9f",
   "in_reply_to": null,
   "text": "in 3c260e70a121b77e95e05452486eff56335e7c9f test: rename wallet_reindex to wallet_birthtime\n\n```suggestion\nclass WalletBirthtimeTest(BitcoinTestFramework):\n```"
  },
  {
   "t": "2026-09-09T08:25:06Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "test/functional/wallet_birthtime.py",
   "commit": "4996874b58b3f08b586eded89528fc5632fc909b",
   "in_reply_to": null,
   "text": "in 4996874b58b3f08b586eded89528fc5632fc909b test: remove unnecessary restart from the test among other optimisations\n\nI would rather keep `Blank`. Although the wallet is not created using the `blank` parameter, a `blank` wallet is just a wallet without keys. A wallet that has private keys disabled and did not import yet a public descriptor is in fact a blank wallet."
  },
  {
   "t": "2026-09-09T08:32:37Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "test/functional/wallet_birthtime.py",
   "commit": "4996874b58b3f08b586eded89528fc5632fc909b",
   "in_reply_to": null,
   "text": "in 4996874 test: remove unnecessary restart from the test among other optimisations\n\nI find this comment really hard to read. The test is not mining 20blocks every 10min, it is mining 20 blocks, one every 10min."
  },
  {
   "t": "2026-09-09T08:35:36Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "test/functional/wallet_birthtime.py",
   "commit": "4996874b58b3f08b586eded89528fc5632fc909b",
   "in_reply_to": null,
   "text": "in 4996874b58b3f08b586eded89528fc5632fc909b test: remove unnecessary restart from the test among other optimisations\n\nBy removing this restart we are loosing some test coverage, we now don't that tx confirmations and the birthtime are preserved over restart under reindex."
  },
  {
   "t": "2026-09-09T08:49:22Z",
   "kind": "review",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "4996874b58b3f08b586eded89528fc5632fc909b",
   "text": "I am not sure about removing the restart.\n\nFriendly pinging @furszy. Do you remember why you added it in the first place? Do you think it is correct to remove it or are we losing useful test coverage with it?"
  },
  {
   "t": "2026-09-09T08:51:25Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "test/functional/wallet_birthtime.py",
   "commit": "fbbbe75ba9c0926a960852ac5ee130701d7507f6",
   "in_reply_to": 3770795264,
   "text": "Sorry I just saw this after I added my comment: https://github.com/bitcoin/bitcoin/pull/34879#discussion_r3966210090\n\nThe wallet is in-fact a blank wallet, not `blank=True` does not mean  that is not `blank`.\nAs the wallet does not have private keys enabled, the wallet is at creation moment a blank wallet. The `blank` parameter is useful for a wallet with private keys to not create new keys on creation and allow the user to import their own keys.\n\nI would rather revert this change."
  },
  {
   "t": "2026-09-09T20:49:43Z",
   "kind": "review_comment",
   "who": "pablomartin4btc",
   "assoc": "MEMBER",
   "path": "test/functional/wallet_birthtime.py",
   "commit": "fbbbe75ba9c0926a960852ac5ee130701d7507f6",
   "in_reply_to": 3770795264,
   "text": "I'm fine with that."
  }
 ],
 "labels_log": [
  {
   "t": "2026-03-24T06:04:34Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-03-24T10:37:10Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  }
 ],
 "state_log": [
  {
   "t": "2026-06-05T11:32:47Z",
   "kind": "renamed",
   "who": "rkrux",
   "from": "test, wallet: overhaul wallet_reindex test to wallet_birthtime",
   "to": "wallet, test: remove unnecessary node restart from wallet_reindex"
  }
 ],
 "text_chars": 6295,
 "text_tokens_estimate": 1573,
 "changed_paths": [
  "test/functional/test_runner.py",
  "test/functional/wallet_birthtime.py",
  "test/functional/wallet_reindex.py"
 ],
 "files": [
  {
   "path": "test/functional/test_runner.py",
   "add": 1,
   "del": 1
  },
  {
   "path": "test/functional/wallet_birthtime.py",
   "add": 89,
   "del": 0
  },
  {
   "path": "test/functional/wallet_reindex.py",
   "add": 0,
   "del": 92
  }
 ],
 "test_lines": 183,
 "git": {
  "head": "4996874b58b3f08b586eded89528fc5632fc909b",
  "head_matches_backup": true,
  "base": "400aa68b4aa8de52c1a8bf543dd195cd1b2b1f32",
  "commits": [
   {
    "sha": "3c260e70a1",
    "subject": "test: rename wallet_reindex to wallet_birthtime",
    "files": 2,
    "add": 3,
    "del": 3
   },
   {
    "sha": "4996874b58",
    "subject": "test: remove unnecessary restart from the test among other optimisations",
    "files": 1,
    "add": 39,
    "del": 42
   }
  ],
  "patch_truncated": false
 },
 "input_hash": "8e0b6ab0f16a88c0",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}