wallet, test: remove unnecessary node restart from wallet_reindex #34879

Open
rkrux wants to merge 2 commits from wallet-birthtime into master AGit
rkrux commented 2026-03-20 12:57:19 +00:00 (Migrated from github.com)

The need for this change was ideated during the review of #34857.

  • The node doesn't need to be restarted (with reindex or without) because
    rescanblockchain RPC already updates the wallet birthtime, which is the property
    that needs to be tested - this allows us to rename the test class to highlight
    the change in intention of the test.
  • Generate 9 blocks fewer to fund the miner wallet.
  • Generate 30 blocks fewer because 20 are sufficient to surpass the wallet
    rescan window.
  • Use common bumpmocktime helper instead of custom advance_time function.
  • Unload miner wallet before 20 blocks generation to avoid notifications from
    being processed by that wallet.
  • Change the order of arguments in assert_equal for consistency.
  • Add few constant and verbose comments for test clarity.

Note: This overhaul helps in reducing the time taken by the test from 2s to 0s as observed in few runs.

The need for this change was ideated during the review of #34857. - The node doesn't need to be restarted (with reindex or without) because rescanblockchain RPC already updates the wallet birthtime, which is the property that needs to be tested - this allows us to rename the test class to highlight the change in intention of the test. - Generate 9 blocks fewer to fund the miner wallet. - Generate 30 blocks fewer because 20 are sufficient to surpass the wallet rescan window. - Use common bumpmocktime helper instead of custom advance_time function. - Unload miner wallet before 20 blocks generation to avoid notifications from being processed by that wallet. - Change the order of arguments in assert_equal for consistency. - Add few constant and verbose comments for test clarity. Note: This overhaul helps in reducing the time taken by the test from 2s to 0s as observed in few runs.
DrahtBot commented 2026-03-20 12:57:36 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK pablomartin4btc, polespinasa

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

No conflicts as of last run.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/34879 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/34879.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/34879#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [pablomartin4btc](https://github.com/bitcoin/bitcoin/pull/34879#pullrequestreview-6183085275), [polespinasa](https://github.com/bitcoin/bitcoin/pull/34879#pullrequestreview-6185590872) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts No conflicts as of last run. <!--5faf32d7da4f0f540f40219e4f7537a3-->
rkrux commented 2026-03-21 11:54:29 +00:00 (Migrated from github.com)

It appears that this overhaul helps in reducing the tests time as well from 2s to 0s, which is nice to see.

Few runs that I checked:
wallet_reindex test time in macOS native job in other PR1 and PR2 - 2 sec.
wallet_birthtime test time in macOS native job in this PR - 0 sec.

It appears that this overhaul helps in reducing the tests time as well from 2s to 0s, which is nice to see. Few runs that I checked: wallet_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**. wallet_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**.
w0xlt commented 2026-03-22 08:04:54 +00:00 (Migrated from github.com)

I’ll take a closer look, but what’s the motivation for those changes?

I’ll take a closer look, but what’s the motivation for those changes?
rkrux commented 2026-03-22 08:34:56 +00:00 (Migrated from github.com)

I’ll take a closer look, but what’s the motivation for those changes?

As 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

> I’ll take a closer look, but what’s the motivation for those changes? As 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
rkrux commented 2026-03-22 08:38:00 +00:00 (Migrated from github.com)

Thanks for asking, made me realise that the motivation was obscured away at the end of the PR description.
I updated the PR description to highlight the motivation at the start.

Thanks for asking, made me realise that the motivation was obscured away at the end of the PR description. I updated the PR description to highlight the motivation at the start.
pablomartin4btc (Migrated from github.com) reviewed 2026-08-12 22:41:45 +00:00
pablomartin4btc (Migrated from github.com) left a comment

Concept ACK

The goal is correct — 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 × 10 min = 200 min > 2h window, COINBASE_MATURITY + 1 is the right minimum, and bumpmocktime is cleaner than the custom helper.

In 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."

Commit structure:

The 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 — that way the class and file names always match across commits. Or a single commit since it's all test-only changes.

I think commit prefixes should both be test: — no production wallet code is touched.

Left an inline comment...

Concept ACK The goal is correct — 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 × 10 min = 200 min > 2h window, `COINBASE_MATURITY` + 1 is the right minimum, and `bumpmocktime` is cleaner than the custom helper. In 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." **Commit structure:** The 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 — that way the class and file names always match across commits. Or a single commit since it's all test-only changes. I think commit prefixes should both be `test:` — no production wallet code is touched. Left an inline comment...
pablomartin4btc (Migrated from github.com) commented 2026-08-12 22:25:40 +00:00

nit: the comment says "Blank wallets" but the wallet isn't created with blank=True — the comment should describe the actual condition instead.

nit: the comment says "Blank wallets" but the wallet isn't created with `blank=True` — the comment should describe the actual condition instead.
rkrux (Migrated from github.com) reviewed 2026-09-02 11:29:14 +00:00
rkrux (Migrated from github.com) commented 2026-09-02 11:29:14 +00:00

Taken along with other suggestions in the overall review comment.

Taken along with other suggestions in the overall review comment.
pablomartin4btc (Migrated from github.com) reviewed 2026-09-08 23:39:33 +00:00
pablomartin4btc (Migrated from github.com) left a comment

ACK 4996874b58

Thanks for taking the suggestions.

ACK 4996874b58b3f08b586eded89528fc5632fc909b Thanks for taking the suggestions.
polespinasa (Migrated from github.com) reviewed 2026-09-09 08:49:22 +00:00
polespinasa (Migrated from github.com) left a comment

I am not sure about removing the restart.

Friendly 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?

I am not sure about removing the restart. Friendly 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?
polespinasa (Migrated from github.com) commented 2026-09-09 08:35:36 +00:00

in 4996874b58 test: remove unnecessary restart from the test among other optimisations

By 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.

in 4996874b58b3f08b586eded89528fc5632fc909b test: remove unnecessary restart from the test among other optimisations By 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.
polespinasa (Migrated from github.com) commented 2026-09-09 07:58:52 +00:00

in 3c260e70a1 test: rename wallet_reindex to wallet_birthtime

class WalletBirthtimeTest(BitcoinTestFramework):
in 3c260e70a121b77e95e05452486eff56335e7c9f test: rename wallet_reindex to wallet_birthtime ```suggestion class WalletBirthtimeTest(BitcoinTestFramework): ```
polespinasa (Migrated from github.com) commented 2026-09-09 08:32:37 +00:00

in 4996874 test: remove unnecessary restart from the test among other optimisations

I find this comment really hard to read. The test is not mining 20blocks every 10min, it is mining 20 blocks, one every 10min.

in 4996874 test: remove unnecessary restart from the test among other optimisations I find this comment really hard to read. The test is not mining 20blocks every 10min, it is mining 20 blocks, one every 10min.
polespinasa (Migrated from github.com) commented 2026-09-09 08:25:06 +00:00

in 4996874b58 test: remove unnecessary restart from the test among other optimisations

I 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.

in 4996874b58b3f08b586eded89528fc5632fc909b test: remove unnecessary restart from the test among other optimisations I 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.
polespinasa (Migrated from github.com) reviewed 2026-09-09 08:51:25 +00:00
polespinasa (Migrated from github.com) commented 2026-09-09 08:51:25 +00:00

Sorry I just saw this after I added my comment: https://github.com/bitcoin/bitcoin/pull/34879#discussion_r3966210090

The wallet is in-fact a blank wallet, not blank=True does not mean that is not blank.
As 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.

I would rather revert this change.

Sorry I just saw this after I added my comment: https://github.com/bitcoin/bitcoin/pull/34879#discussion_r3966210090 The wallet is in-fact a blank wallet, not `blank=True` does not mean that is not `blank`. As 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. I would rather revert this change.
pablomartin4btc (Migrated from github.com) reviewed 2026-09-09 20:49:43 +00:00
pablomartin4btc (Migrated from github.com) commented 2026-09-09 20:49:43 +00:00

I'm fine with that.

I'm fine with that.
sedited commented 2026-10-19 13:10:16 +00:00 (Migrated from github.com)

@rkrux can you follow up on @polespinasa's review?

@rkrux can you follow up on @polespinasa's review?
First-time contributor

🔵 Suggestion · The restart-to-reload coverage change is obscured by cleanup edits

In af88705a, mixing the restart-to-wallet-reload change with setup optimizations and reordered assertions makes it harder to verify which reopening checks survive, and the commit message omits the replacement reload check.

Location: test/functional/wallet_birthtime.py:81 (commit).

Review coverage was incomplete.


Reviewed: af88705a9c83 · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:806938d40e279b6d701b2e78128bb1a09b55193a0b697245a1dce6241d3081c1:3607c760b63c01fb7f1f349adfc3fd0614b148a7df02e42f2f0edc2d448925a1 --> <!-- ralph-base:095860411807e29282e61122b3b0247c08f3c7a5 --> <!-- ralph-head:af88705a9c835b44e94c21366b1ce347f5cbed3b --> <!-- ralph-case:c06769397995f5651db9c9e2bfdd52ba67445cb372205db57dd711c18c5f79ba --> **🔵 Suggestion · The restart-to-reload coverage change is obscured by cleanup edits** In `af88705a`, mixing the restart-to-wallet-reload change with setup optimizations and reordered assertions makes it harder to verify which reopening checks survive, and the commit message omits the replacement reload check. Location: test/functional/wallet_birthtime.py:81 (commit). Review coverage was incomplete. <!-- Review tier: routine --> --- Reviewed: [`af88705a9c83`](<https://git.fish.foo/bitcoin/bitcoin/commit/af88705a9c835b44e94c21366b1ce347f5cbed3b>) · [Review report](<https://review.fish.foo/report/34879-af88705a9c835b44e94c21366b1ce347f5cbed3b-3247-3.html>) · [Previous reports](<https://review.fish.foo/traces/34879/>) [permalink](<https://review.fish.foo/report/34879-af88705a9c835b44e94c21366b1ce347f5cbed3b-3247-3.html>)
rkrux (Migrated from github.com) reviewed 2026-10-26 08:08:59 +00:00
rkrux (Migrated from github.com) commented 2026-10-26 08:08:59 +00:00

True, this comment could have come across as confusing. Updated.

True, this comment could have come across as confusing. Updated.
rkrux (Migrated from github.com) reviewed 2026-10-26 08:09:15 +00:00
rkrux (Migrated from github.com) commented 2026-10-26 08:09:15 +00:00

Either is fine, used both.

Either is fine, used both.
rkrux (Migrated from github.com) reviewed 2026-10-26 08:10:25 +00:00
rkrux (Migrated from github.com) commented 2026-10-26 08:10:25 +00:00

The original seems fine. There are instances of BirthTime in the codebase:
git grep 'BirthTime' -- '*.cpp' '*.h.

The original seems fine. There are instances of BirthTime in the codebase: `git grep 'BirthTime' -- '*.cpp' '*.h`.
rkrux (Migrated from github.com) reviewed 2026-10-26 10:28:09 +00:00
rkrux (Migrated from github.com) commented 2026-10-26 10:28:09 +00:00

I don't believe any test coverage is being lost here. The intent as per the original comments in this test file show that the correct update of wallet birthtime property needs to be tested, which can be achieved and tested via the rescanblockchain RPC. Once the transaction is seen while rescanning the blockchain, it's saved in the database and upon any further reload of wallet (with or without node restart), the birthtime is updated correspondingly. The test need not restart the node only to test the same assertion again.

I don't believe any test coverage is being lost here. The intent as per the original comments in this test file show that the correct update of wallet birthtime property needs to be tested, which can be achieved and tested via the rescanblockchain RPC. Once the transaction is seen while rescanning the blockchain, it's saved in the database and upon any further reload of wallet (with or without node restart), the birthtime is updated correspondingly. The test need not restart the node only to test the same assertion again.
polespinasa (Migrated from github.com) reviewed 2026-11-27 09:06:20 +00:00
polespinasa (Migrated from github.com) commented 2026-11-27 09:06:20 +00:00

Sorry for the late response, somehow I missed the mail notification from this comment.

It does indeed lose coverage. Try removing the call to MaybeUpdateBirthTime in CWallet:LoadToWallet. The new version of the test pass while before this commit it fails.
You are right saying that restarting is unneeded, adding just a wallet reload check restores the coverage.

diff --git a/test/functional/wallet_birthtime.py b/test/functional/wallet_birthtime.py
index 4df332b87e..d136307e85 100755
--- a/test/functional/wallet_birthtime.py
+++ b/test/functional/wallet_birthtime.py
@@ -77,7 +77,11 @@ class WalletBirthTimeTest(BitcoinTestFramework):
        # Verify the wallet updated the birth time to the transaction time
        assert_equal(wallet_watch_only.getwalletinfo()['birthtime'], tx_info['time'])

+        # Reload the wallet to verify it reconstructs the birth time from the saved transaction.
        wallet_watch_only.unloadwallet()
+        node.loadwallet('watch_only')
+        assert_equal(wallet_watch_only.gettransaction(tx_id)['confirmations'], TX_CONFIRMATIONS)
+        assert_equal(wallet_watch_only.getwalletinfo()['birthtime'], tx_info['time'])
+        wallet_watch_only.unloadwallet()

    def run_test(self):
        node = self.nodes[0]

Sorry for the late response, somehow I missed the mail notification from this comment. It does indeed lose coverage. Try removing the call to `MaybeUpdateBirthTime` in `CWallet:LoadToWallet`. The new version of the test pass while before this commit it fails. You are right saying that restarting is unneeded, adding just a wallet reload check restores the coverage. ```diff diff --git a/test/functional/wallet_birthtime.py b/test/functional/wallet_birthtime.py index 4df332b87e..d136307e85 100755 --- a/test/functional/wallet_birthtime.py +++ b/test/functional/wallet_birthtime.py @@ -77,7 +77,11 @@ class WalletBirthTimeTest(BitcoinTestFramework): # Verify the wallet updated the birth time to the transaction time assert_equal(wallet_watch_only.getwalletinfo()['birthtime'], tx_info['time']) + # Reload the wallet to verify it reconstructs the birth time from the saved transaction. wallet_watch_only.unloadwallet() + node.loadwallet('watch_only') + assert_equal(wallet_watch_only.gettransaction(tx_id)['confirmations'], TX_CONFIRMATIONS) + assert_equal(wallet_watch_only.getwalletinfo()['birthtime'], tx_info['time']) + wallet_watch_only.unloadwallet() def run_test(self): node = self.nodes[0] ```
rkrux (Migrated from github.com) reviewed 2026-11-27 11:17:17 +00:00
rkrux (Migrated from github.com) commented 2026-11-27 11:17:17 +00:00

Added the wallet reload, thanks.

Added the wallet reload, thanks.
rkrux commented 2026-11-27 11:17:39 +00:00 (Migrated from github.com)

Addressed comments and rebased.

Addressed comments and rebased.
pablomartin4btc (Migrated from github.com) reviewed 2026-12-04 04:12:29 +00:00
pablomartin4btc (Migrated from github.com) left a comment

re-ACK af88705a9c

Since my last review: rebase, comment rewording from @polespinasa's review, and the wallet reload check, which restores the coverage of the birth time being reconstructed in CWallet::LoadToWallet from the saved tx (good catch @polespinasa, I missed that).

Correcting my earlier review, where I said the restart never used -reindex and that its coverage was dropped intentionally: the test was added in #28920 as the regression test for #28897 (tx going to 0 confirmations after -reindex when it's older than the birth time), and #34857 dropped -reindex=1 from the restart without mentioning it.

Non-blocking: I tested reverting the #28920 fix (removing both MaybeUpdateBirthTime(wtx.GetTxTime()) calls in AddToWallet and LoadToWallet): the birth time assert here still catches it, but the reindex symptom itself is no longer covered. With 50 blocks and a -reindex restart instead of the reload, the tx drops to 0 confirmations; with 20 blocks it stays confirmed, since blocks are only skipped when chain_time_max < m_birth_time - TIMESTAMP_WINDOW * 2, so covering it would need >~30 blocks. Fine to leave as is or for a follow-up, cc @furszy.

Test results and trace (fix reverted)
blocks reload (this PR) -reindex restart
20 fails: birth time assert (20 confs) fails: birth time assert (20 confs)
50 fails: birth time assert (50 confs) fails: confirmations 0 != 50

With the fix in place all four pass. -reindex variant: replaced the unload/loadwallet with self.restart_node(0, extra_args=['-reindex', f'-mocktime={node.mocktime}', '-wallet=watch_only']).

Why the tx drops to 0 confirmations (traced with extra logging): on -reindex the wallet loads before the block index is rebuilt, so CWalletTx::updateState marks the tx Inactive; when its block is reconnected, blockConnected skips it (chain_time_max < m_birth_time - TIMESTAMP_WINDOW * 2), so the tx is never re-confirmed. With a plain reload the block is already in the chain, so the tx stays confirmed regardless of the birth time.

nit: the first bullet of the commit message (and PR description) still says the restart isn't needed since rescanblockchain already updates the birthtime. That's no longer the whole story: a reload was added because rescanblockchain doesn't cover the birth time being reconstructed from the saved tx on wallet load (CWallet::LoadToWallet).

re-ACK af88705a9c835b44e94c21366b1ce347f5cbed3b Since my last review: rebase, comment rewording from @polespinasa's review, and the wallet reload check, which restores the coverage of the birth time being reconstructed in `CWallet::LoadToWallet` from the saved tx (good catch @polespinasa, I missed that). Correcting my earlier review, where I said the restart never used `-reindex` and that its coverage was dropped intentionally: the test was added in #28920 as the regression test for #28897 (tx going to 0 confirmations after `-reindex` when it's older than the birth time), and #34857 dropped `-reindex=1` from the restart without mentioning it. Non-blocking: I tested reverting the #28920 fix (removing both `MaybeUpdateBirthTime(wtx.GetTxTime())` calls in `AddToWallet` and `LoadToWallet`): the birth time assert here still catches it, but the reindex symptom itself is no longer covered. With 50 blocks and a `-reindex` restart instead of the reload, the tx drops to 0 confirmations; with 20 blocks it stays confirmed, since blocks are only skipped when `chain_time_max < m_birth_time - TIMESTAMP_WINDOW * 2`, so covering it would need >~30 blocks. Fine to leave as is or for a follow-up, cc @furszy. <details> <summary>Test results and trace (fix reverted)</summary> | blocks | reload (this PR) | `-reindex` restart | |---|---|---| | 20 | fails: birth time assert (20 confs) | fails: birth time assert (20 confs) | | 50 | fails: birth time assert (50 confs) | fails: `confirmations` 0 != 50 | With the fix in place all four pass. `-reindex` variant: replaced the unload/`loadwallet` with `self.restart_node(0, extra_args=['-reindex', f'-mocktime={node.mocktime}', '-wallet=watch_only'])`. Why the tx drops to 0 confirmations (traced with extra logging): on `-reindex` the wallet loads before the block index is rebuilt, so `CWalletTx::updateState` marks the tx Inactive; when its block is reconnected, `blockConnected` skips it (`chain_time_max < m_birth_time - TIMESTAMP_WINDOW * 2`), so the tx is never re-confirmed. With a plain reload the block is already in the chain, so the tx stays confirmed regardless of the birth time. </details> nit: the first bullet of the commit message (and PR description) still says the restart isn't needed since `rescanblockchain` already updates the birthtime. That's no longer the whole story: a reload was added because `rescanblockchain` doesn't cover the birth time being reconstructed from the saved tx on wallet load (`CWallet::LoadToWallet`).
polespinasa (Migrated from github.com) reviewed 2026-12-04 08:13:34 +00:00
polespinasa (Migrated from github.com) left a comment

ACK af88705a9c

Thanks for addressing feedback

ACK af88705a9c835b44e94c21366b1ce347f5cbed3b Thanks for addressing feedback
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!34879
No description provided.