wallet, test: make wallet_fast_rescan robust #34907

Manually merged
rkrux merged 1 commit from rescan-fast into master 2026-10-05 11:31:38 +00:00 AGit
rkrux commented 2026-03-24 10:40:27 +00:00 (Migrated from github.com)

This patch addresses my own review comments from the review of #34667 and adds some more changes that I find helpful. It was observed in the review of the earlier PR that there is a tendency for the test code to cause the topups not being done that defeats the purpose of the test. Combine that with the earlier issue where the block filter was not being updated ever since this test was written, I think it's helpful that some robustness is added in the test.

Exact details are in the commit message.

This patch addresses my own review comments from the review of #34667 and adds some more changes that I find helpful. It was observed in the review of the earlier PR that there is a tendency for the test code to cause the topups not being done that defeats the purpose of the test. Combine that with the earlier issue where the block filter was not being updated ever since this test was written, I think it's helpful that some robustness is added in the test. Exact details are in the commit message.
DrahtBot commented 2026-03-24 10:40:44 +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 Bicaru20, polespinasa, sedited
Stale ACK w0xlt

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #34400 (wallet: parallel fast rescan (approx 8x speed up with 8 threads) by Eunovo)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

<!--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/34907 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/34907.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/34907#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 | [Bicaru20](https://github.com/bitcoin/bitcoin/pull/34907#issuecomment-4653672220), [polespinasa](https://github.com/bitcoin/bitcoin/pull/34907#pullrequestreview-5275747774), [sedited](https://github.com/bitcoin/bitcoin/pull/34907#pullrequestreview-5413732670) | | Stale ACK | [w0xlt](https://github.com/bitcoin/bitcoin/pull/34907#pullrequestreview-4374545915) | 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 Reviewers, this pull request conflicts with the following ones: * [#34400](https://github.com/bitcoin/bitcoin/pull/34400) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/34400.svg"></sub> (wallet: parallel fast rescan (approx 8x speed up with 8 threads) by Eunovo) If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. <!--5faf32d7da4f0f540f40219e4f7537a3-->
w0xlt (Migrated from github.com) reviewed 2026-03-25 18:34:22 +00:00
w0xlt (Migrated from github.com) left a comment

The test already records the txids it creates, but at the end it only checks counts and that fast/slow agree with each other.

It would be stronger to flatten the generated wallet-related txids and assert each rescan result equals that exact expected set.

diff
diff --git a/test/functional/wallet_fast_rescan.py b/test/functional/wallet_fast_rescan.py
index b777ed9ced..683443d8a7 100755
--- a/test/functional/wallet_fast_rescan.py
+++ b/test/functional/wallet_fast_rescan.py
@@ -85,7 +85,7 @@ class WalletFastRescanTest(BitcoinTestFramework):
         txs_per_blocks.append([tx_result['txid'] for tx_result in send_result])
 
         self.log.info("Start generating blocks one by one with associated txs")
-        total_wallet_txs = 0
+        expected_wallet_txids = []
         fast_rescan_messages = []
         for i, block_txs in enumerate(txs_per_blocks):
             self.log.info(f"Block {i+1}/{NUM_BLOCKS}")
@@ -94,7 +94,7 @@ class WalletFastRescanTest(BitcoinTestFramework):
             # transactions - this block may or may not be fetched due to block filters false positives.
             if i < NUM_BLOCKS-1:
                 fast_rescan_messages.append(f"Fast rescan: inspect block {self.nodes[0].getblockcount()} [{generated_block['hash']}] (filter matched)")
-                total_wallet_txs += len(block_txs)
+                expected_wallet_txids.extend(block_txs)
 
         self.log.info("Import wallet backup with block filter index")
         with node.assert_debug_log(['fast variant using block filters', *fast_rescan_messages]):
@@ -122,12 +122,11 @@ class WalletFastRescanTest(BitcoinTestFramework):
         txids_slow_nonactive = self.get_wallet_txids(node, 'rescan_slow_nonactive')
 
         self.log.info("Verify that all rescans found the same txs in slow and fast variants")
-        assert_equal(len(txids_slow), total_wallet_txs)
-        assert_equal(len(txids_fast), total_wallet_txs)
-        assert_equal(len(txids_slow_nonactive), total_wallet_txs)
-        assert_equal(len(txids_fast_nonactive), total_wallet_txs)
-        assert_equal(sorted(txids_slow), sorted(txids_fast))
-        assert_equal(sorted(txids_slow_nonactive), sorted(txids_fast_nonactive))
+        expected_wallet_txids.sort()
+        assert_equal(sorted(txids_slow), expected_wallet_txids)
+        assert_equal(sorted(txids_fast), expected_wallet_txids)
+        assert_equal(sorted(txids_slow_nonactive), expected_wallet_txids)
+        assert_equal(sorted(txids_fast_nonactive), expected_wallet_txids)
 
 
 if __name__ == '__main__':
The test already records the txids it creates, but at the end it only checks counts and that fast/slow agree with each other. It would be stronger to flatten the generated wallet-related txids and assert each rescan result equals that exact expected set. <details> <summary>diff</summary> ```diff diff --git a/test/functional/wallet_fast_rescan.py b/test/functional/wallet_fast_rescan.py index b777ed9ced..683443d8a7 100755 --- a/test/functional/wallet_fast_rescan.py +++ b/test/functional/wallet_fast_rescan.py @@ -85,7 +85,7 @@ class WalletFastRescanTest(BitcoinTestFramework): txs_per_blocks.append([tx_result['txid'] for tx_result in send_result]) self.log.info("Start generating blocks one by one with associated txs") - total_wallet_txs = 0 + expected_wallet_txids = [] fast_rescan_messages = [] for i, block_txs in enumerate(txs_per_blocks): self.log.info(f"Block {i+1}/{NUM_BLOCKS}") @@ -94,7 +94,7 @@ class WalletFastRescanTest(BitcoinTestFramework): # transactions - this block may or may not be fetched due to block filters false positives. if i < NUM_BLOCKS-1: fast_rescan_messages.append(f"Fast rescan: inspect block {self.nodes[0].getblockcount()} [{generated_block['hash']}] (filter matched)") - total_wallet_txs += len(block_txs) + expected_wallet_txids.extend(block_txs) self.log.info("Import wallet backup with block filter index") with node.assert_debug_log(['fast variant using block filters', *fast_rescan_messages]): @@ -122,12 +122,11 @@ class WalletFastRescanTest(BitcoinTestFramework): txids_slow_nonactive = self.get_wallet_txids(node, 'rescan_slow_nonactive') self.log.info("Verify that all rescans found the same txs in slow and fast variants") - assert_equal(len(txids_slow), total_wallet_txs) - assert_equal(len(txids_fast), total_wallet_txs) - assert_equal(len(txids_slow_nonactive), total_wallet_txs) - assert_equal(len(txids_fast_nonactive), total_wallet_txs) - assert_equal(sorted(txids_slow), sorted(txids_fast)) - assert_equal(sorted(txids_slow_nonactive), sorted(txids_fast_nonactive)) + expected_wallet_txids.sort() + assert_equal(sorted(txids_slow), expected_wallet_txids) + assert_equal(sorted(txids_fast), expected_wallet_txids) + assert_equal(sorted(txids_slow_nonactive), expected_wallet_txids) + assert_equal(sorted(txids_fast_nonactive), expected_wallet_txids) if __name__ == '__main__': ``` </details>
w0xlt (Migrated from github.com) reviewed 2026-03-25 19:59:22 +00:00
w0xlt (Migrated from github.com) left a comment

The test doesn't need to depend on a specific debug-log string.
You can assert the same behavior more directly via listdescriptors: get the descriptor's current end_range, send to that address, then verify the range increases.

diff
diff --git a/test/functional/wallet_fast_rescan.py b/test/functional/wallet_fast_rescan.py
index b777ed9ced..f3d88c408a 100755
--- a/test/functional/wallet_fast_rescan.py
+++ b/test/functional/wallet_fast_rescan.py
@@ -48,6 +48,12 @@ class WalletFastRescanTest(BitcoinTestFramework):
         # backup the wallet here so that the restorations later are unaware of the below transactions
         w.backupwallet(WALLET_BACKUP_FILENAME)
 
+        def get_descriptor_end_range(desc_str):
+            for descriptor in w.listdescriptors()['descriptors']:
+                if descriptor['desc'] == desc_str:
+                    return descriptor['range'][1]
+            raise AssertionError(f"Descriptor not found: {desc_str}")
+
         txs_per_blocks = []
 
         self.log.info("Create and broadcast tx sending to non-ranged descriptor")
@@ -70,8 +76,8 @@ class WalletFastRescanTest(BitcoinTestFramework):
                 spk = address_to_scriptpubkey(addr)
 
                 self.log.debug(f"-> range [{start_range},{end_range}], last address {addr}")
-                with node.assert_debug_log([f'Detected a used keypool item at index {end_range}, mark all keypool items up to this item as used']):
-                    send_result = funding_wallet.send_to(from_node=node, scriptPubKey=spk, amount=10000)
+                send_result = funding_wallet.send_to(from_node=node, scriptPubKey=spk, amount=10000)
+                self.wait_until(lambda desc_str=desc_str, end_range=end_range: get_descriptor_end_range(desc_str) > end_range)
                 block_txs.append(send_result["txid"])
 
             txs_per_blocks.append(block_txs)
The test doesn't need to depend on a specific debug-log string. You can assert the same behavior more directly via `listdescriptors`: get the descriptor's current `end_range`, send to that address, then verify the range increases. <details> <summary>diff</summary> ```diff diff --git a/test/functional/wallet_fast_rescan.py b/test/functional/wallet_fast_rescan.py index b777ed9ced..f3d88c408a 100755 --- a/test/functional/wallet_fast_rescan.py +++ b/test/functional/wallet_fast_rescan.py @@ -48,6 +48,12 @@ class WalletFastRescanTest(BitcoinTestFramework): # backup the wallet here so that the restorations later are unaware of the below transactions w.backupwallet(WALLET_BACKUP_FILENAME) + def get_descriptor_end_range(desc_str): + for descriptor in w.listdescriptors()['descriptors']: + if descriptor['desc'] == desc_str: + return descriptor['range'][1] + raise AssertionError(f"Descriptor not found: {desc_str}") + txs_per_blocks = [] self.log.info("Create and broadcast tx sending to non-ranged descriptor") @@ -70,8 +76,8 @@ class WalletFastRescanTest(BitcoinTestFramework): spk = address_to_scriptpubkey(addr) self.log.debug(f"-> range [{start_range},{end_range}], last address {addr}") - with node.assert_debug_log([f'Detected a used keypool item at index {end_range}, mark all keypool items up to this item as used']): - send_result = funding_wallet.send_to(from_node=node, scriptPubKey=spk, amount=10000) + send_result = funding_wallet.send_to(from_node=node, scriptPubKey=spk, amount=10000) + self.wait_until(lambda desc_str=desc_str, end_range=end_range: get_descriptor_end_range(desc_str) > end_range) block_txs.append(send_result["txid"]) txs_per_blocks.append(block_txs) ``` </details>
w0xlt (Migrated from github.com) reviewed 2026-03-25 20:07:35 +00:00
w0xlt (Migrated from github.com) commented 2026-03-25 20:07:35 +00:00

This part seems more complex than the behavior being asserted. If the goal is just to include a block with wallet-unrelated transactions, would a single unrelated tx be enough ? That would make the intent clearer.

        self.log.info("Create and broadcast tx unrelated to the wallet")
        send_result = funding_wallet.send_self_transfer(from_node=node)
        txs_per_blocks.append([send_result['txid']])
This part seems more complex than the behavior being asserted. If the goal is just to include a block with wallet-unrelated transactions, would a single unrelated tx be enough ? That would make the intent clearer. ```suggestion self.log.info("Create and broadcast tx unrelated to the wallet") send_result = funding_wallet.send_self_transfer(from_node=node) txs_per_blocks.append([send_result['txid']]) ```
w0xlt (Migrated from github.com) reviewed 2026-03-25 20:08:20 +00:00
w0xlt (Migrated from github.com) commented 2026-03-25 20:08:20 +00:00

nit:

        txids_per_block = []
nit: ```suggestion txids_per_block = [] ```
rkrux (Migrated from github.com) reviewed 2026-03-27 15:22:13 +00:00
rkrux (Migrated from github.com) commented 2026-03-27 15:22:13 +00:00

This was intentional on my part but I see it can come across as confusing and is also not necessary. I will remove the chain.

This was intentional on my part but I see it can come across as confusing and is also not necessary. I will remove the chain.
rkrux commented 2026-03-27 15:22:55 +00:00 (Migrated from github.com)

Good suggestions, I will add them.

Good suggestions, I will add them.
rkrux commented 2026-04-24 14:40:30 +00:00 (Migrated from github.com)

Added all the suggestions from w0xlt's review in latest push.

Added all the suggestions from w0xlt's review in latest push.
rkrux commented 2026-04-24 14:49:57 +00:00 (Migrated from github.com)

I realised that wait_until is not needed for asserting that the top is being done because adding a simple greater than assertion post send_to call is sufficient, so made that change.

I realised that wait_until is not needed for asserting that the top is being done because adding a simple greater than assertion post send_to call is sufficient, so made that change.
w0xlt (Migrated from github.com) reviewed 2026-05-21 20:05:54 +00:00
w0xlt (Migrated from github.com) left a comment

ACK 292a949863b4c13e1f88ac6f1b2622eaac7c4e70 with non-blocking suggestions.

ACK 292a949863b4c13e1f88ac6f1b2622eaac7c4e70 with non-blocking suggestions.
w0xlt (Migrated from github.com) commented 2026-05-21 20:04:49 +00:00

nit:

-   top-ups correctly and finds the same transactions than the slow variant."""
+   top-ups correctly and finds the same transactions than as the slow variant."""
nit: ```diff - top-ups correctly and finds the same transactions than the slow variant.""" + top-ups correctly and finds the same transactions than as the slow variant.""" ```
w0xlt (Migrated from github.com) commented 2026-05-21 20:04:40 +00:00

nit:

        for _ in range(1, NUM_BLOCKS-1):
nit: ```suggestion for _ in range(1, NUM_BLOCKS-1): ```
w0xlt (Migrated from github.com) commented 2026-05-21 20:04:26 +00:00

nit:

        assert_equal(len(txids_per_block), NUM_BLOCKS)
        self.log.info("Start generating blocks one by one with associated txs")
nit: ```suggestion assert_equal(len(txids_per_block), NUM_BLOCKS) self.log.info("Start generating blocks one by one with associated txs") ```
w0xlt (Migrated from github.com) commented 2026-05-21 20:04:35 +00:00

nit:

                fast_rescan_messages.append(f"Fast rescan: inspect block {node.getblockcount()} [{generated_block['hash']}] (filter matched)")
nit: ```suggestion fast_rescan_messages.append(f"Fast rescan: inspect block {node.getblockcount()} [{generated_block['hash']}] (filter matched)") ```
rkrux commented 2026-05-22 10:05:51 +00:00 (Migrated from github.com)
Force pushed to use suggestions from @w0xlt's review: https://github.com/bitcoin/bitcoin/pull/34907#pullrequestreview-4340246369.
w0xlt (Migrated from github.com) reviewed 2026-05-27 17:22:54 +00:00
w0xlt (Migrated from github.com) left a comment

reACK bf0f5d9941fb251692af58c411362c5b0e4e8396

reACK bf0f5d9941fb251692af58c411362c5b0e4e8396
Bicaru20 commented 2026-06-04 13:50:07 +00:00 (Migrated from github.com)

I'm fine as leaving as it is now. But wouldn’t it be clearer to generate the blocks when we broadcast the transaction? I understand your point about wanting to separate the transaction broadcast and block generation flows to highlight when the top is being done, but I think it makes the test a little bit more confusing. I believe that if the blocks are generated in the same loop where the topups are being done, it can still be clear to follow both flows and will make the test clearer and more compact.
I'll leave the diff of how I would do it.

diff
diff --git a/test/functional/wallet_fast_rescan.py b/test/functional/wallet_fast_rescan.py
index ce65855779..096a1b80ef 100755
--- a/test/functional/wallet_fast_rescan.py
+++ b/test/functional/wallet_fast_rescan.py
@@ -54,14 +54,18 @@ class WalletFastRescanTest(BitcoinTestFramework):
                     return descriptor['range'][1]
             raise AssertionError(f"Descriptor not found: {desc_str}")
 
-        txids_per_block = []
+        expected_wallet_txids = []
+        fast_rescan_messages = []
 
         self.log.info("Create and broadcast tx sending to non-ranged descriptor")
         addr = w.deriveaddresses(non_ranged_descs[0]['desc'])[0]
         spk = address_to_scriptpubkey(addr)
         self.log.debug(f"-> fixed non-range descriptor address {addr}")
         send_result = funding_wallet.send_to(from_node=node, scriptPubKey=spk, amount=10000)
-        txids_per_block.append([send_result["txid"]])
+
+        generated_block = self.generateblock(node, output="raw(42)", transactions=[send_result["txid"]])
+        fast_rescan_messages.append(f"Fast rescan: inspect block {node.getblockcount()} [{generated_block['hash']}] (filter matched)")
+        expected_wallet_txids.extend([send_result["txid"]])
 
         self.log.info("Create and broadcast txs sending to end range address of each descriptor, triggering top-ups")
         for _ in range(1, NUM_BLOCKS-1):
@@ -80,7 +84,9 @@ class WalletFastRescanTest(BitcoinTestFramework):
                 assert_greater_than(get_descriptor_end_range(desc_str), end_range)
                 block_tx_ids.append(send_result["txid"])
 
-            txids_per_block.append(block_tx_ids)
+            generated_block = self.generateblock(node, output="raw(42)", transactions=block_tx_ids)
+            fast_rescan_messages.append(f"Fast rescan: inspect block {node.getblockcount()} [{generated_block['hash']}] (filter matched)")
+            expected_wallet_txids.extend(block_tx_ids)
 
         # wallet w (topup_test) is not required to be loaded from here on, unload so that it
         # doesn't needlessly process block generation notifications in the background
@@ -88,20 +94,6 @@ class WalletFastRescanTest(BitcoinTestFramework):
 
         self.log.info("Create and broadcast tx unrelated to the wallet")
         send_result = funding_wallet.send_self_transfer(from_node=node)
-        txids_per_block.append([send_result['txid']])
-        assert_equal(len(txids_per_block), NUM_BLOCKS)
-
-        self.log.info("Start generating blocks one by one with associated txs")
-        expected_wallet_txids = []
-        fast_rescan_messages = []
-        for i, block_tx_ids in enumerate(txids_per_block):
-            self.log.info(f"Block {i+1}/{NUM_BLOCKS}")
-            generated_block = self.generateblock(node, output="raw(42)", transactions=block_tx_ids)
-            # Not asserting the fast rescan message in the last block because it contains wallet-unrelated
-            # transactions - this block may or may not be fetched due to block filters false positives.
-            if i < NUM_BLOCKS-1:
-                fast_rescan_messages.append(f"Fast rescan: inspect block {node.getblockcount()} [{generated_block['hash']}] (filter matched)")
-                expected_wallet_txids.extend(block_tx_ids)
 
         self.log.info("Import wallet backup with block filter index")
         with node.assert_debug_log(['fast variant using block filters', *fast_rescan_messages]):

As said at the begining I'm fine with merging as is. Seeing other people have already ack maybe is just me who find this flow confusing.

I'm fine as leaving as it is now. But wouldn’t it be clearer to generate the blocks when we broadcast the transaction? I understand your point about wanting to separate the transaction broadcast and block generation flows to highlight when the top is being done, but I think it makes the test a little bit more confusing. I believe that if the blocks are generated in the same loop where the topups are being done, it can still be clear to follow both flows and will make the test clearer and more compact. I'll leave the diff of how I would do it. <details> <summary>diff</summary> ```diff diff --git a/test/functional/wallet_fast_rescan.py b/test/functional/wallet_fast_rescan.py index ce65855779..096a1b80ef 100755 --- a/test/functional/wallet_fast_rescan.py +++ b/test/functional/wallet_fast_rescan.py @@ -54,14 +54,18 @@ class WalletFastRescanTest(BitcoinTestFramework): return descriptor['range'][1] raise AssertionError(f"Descriptor not found: {desc_str}") - txids_per_block = [] + expected_wallet_txids = [] + fast_rescan_messages = [] self.log.info("Create and broadcast tx sending to non-ranged descriptor") addr = w.deriveaddresses(non_ranged_descs[0]['desc'])[0] spk = address_to_scriptpubkey(addr) self.log.debug(f"-> fixed non-range descriptor address {addr}") send_result = funding_wallet.send_to(from_node=node, scriptPubKey=spk, amount=10000) - txids_per_block.append([send_result["txid"]]) + + generated_block = self.generateblock(node, output="raw(42)", transactions=[send_result["txid"]]) + fast_rescan_messages.append(f"Fast rescan: inspect block {node.getblockcount()} [{generated_block['hash']}] (filter matched)") + expected_wallet_txids.extend([send_result["txid"]]) self.log.info("Create and broadcast txs sending to end range address of each descriptor, triggering top-ups") for _ in range(1, NUM_BLOCKS-1): @@ -80,7 +84,9 @@ class WalletFastRescanTest(BitcoinTestFramework): assert_greater_than(get_descriptor_end_range(desc_str), end_range) block_tx_ids.append(send_result["txid"]) - txids_per_block.append(block_tx_ids) + generated_block = self.generateblock(node, output="raw(42)", transactions=block_tx_ids) + fast_rescan_messages.append(f"Fast rescan: inspect block {node.getblockcount()} [{generated_block['hash']}] (filter matched)") + expected_wallet_txids.extend(block_tx_ids) # wallet w (topup_test) is not required to be loaded from here on, unload so that it # doesn't needlessly process block generation notifications in the background @@ -88,20 +94,6 @@ class WalletFastRescanTest(BitcoinTestFramework): self.log.info("Create and broadcast tx unrelated to the wallet") send_result = funding_wallet.send_self_transfer(from_node=node) - txids_per_block.append([send_result['txid']]) - assert_equal(len(txids_per_block), NUM_BLOCKS) - - self.log.info("Start generating blocks one by one with associated txs") - expected_wallet_txids = [] - fast_rescan_messages = [] - for i, block_tx_ids in enumerate(txids_per_block): - self.log.info(f"Block {i+1}/{NUM_BLOCKS}") - generated_block = self.generateblock(node, output="raw(42)", transactions=block_tx_ids) - # Not asserting the fast rescan message in the last block because it contains wallet-unrelated - # transactions - this block may or may not be fetched due to block filters false positives. - if i < NUM_BLOCKS-1: - fast_rescan_messages.append(f"Fast rescan: inspect block {node.getblockcount()} [{generated_block['hash']}] (filter matched)") - expected_wallet_txids.extend(block_tx_ids) self.log.info("Import wallet backup with block filter index") with node.assert_debug_log(['fast variant using block filters', *fast_rescan_messages]): ``` </details> As said at the begining I'm fine with merging as is. Seeing other people have already ack maybe is just me who find this flow confusing.
rkrux commented 2026-06-04 14:46:26 +00:00 (Migrated from github.com)

But wouldn’t it be clearer to generate the blocks when we broadcast the transaction?

Yeah, that makes sense as it can make the test feel less contrived. I had considered it when I had raised the PR but ended up didn't doing it then.
Done now.

> But wouldn’t it be clearer to generate the blocks when we broadcast the transaction? Yeah, that makes sense as it can make the test feel less contrived. I had considered it when I had raised the PR but ended up didn't doing it then. Done now.
rkrux commented 2026-06-05 11:04:58 +00:00 (Migrated from github.com)

The Windows native, VS failure is a Github issue.

The [Windows native, VS](https://github.com/bitcoin/bitcoin/actions/runs/26959178759/job/79544538694?pr=34907#logs) failure is a Github issue.
Bicaru20 commented 2026-06-08 21:22:57 +00:00 (Migrated from github.com)

lgtm ACK f217da5c59

lgtm ACK f217da5c59
sedited commented 2026-08-10 20:20:17 +00:00 (Migrated from github.com)

@w0xlt do you want to give this another look?

@w0xlt do you want to give this another look?
polespinasa (Migrated from github.com) reviewed 2026-09-22 08:43:49 +00:00
polespinasa (Migrated from github.com) left a comment

lgtm ACK f217da5c59

I don't think the wallet prefix in the commit title is accurate, this is not touching wallet code.

lgtm ACK f217da5c59f43b43abca96de66b95c24ae99eed7 I don't think the wallet prefix in the commit title is accurate, this is not touching wallet code.
polespinasa (Migrated from github.com) commented 2026-09-22 08:40:45 +00:00
        expected_wallet_txids.append(send_result["txid"])
```suggestion expected_wallet_txids.append(send_result["txid"]) ```
polespinasa (Migrated from github.com) commented 2026-09-22 08:31:09 +00:00
        for _ in range(NUM_BLOCKS-2):
```suggestion for _ in range(NUM_BLOCKS-2): ```
sedited (Migrated from github.com) approved these changes 2026-10-05 11:22:56 +00:00
sedited (Migrated from github.com) left a comment
ACK f217da5c59f43b43abca96de66b95c24ae99eed7
First-time contributor

Base: 8c49a9abe9196e35000849df76445037216b6d75
Head: f217da5c59f43b43abca96de66b95c24ae99eed7

🟡 Minor

Synchronize wallet notifications before checking range growth (test/functional/wallet_fast_rescan.py:84, head)

send_to broadcasts through sendrawtransaction, which queues a mempool notification for validation-interface processing. The RPC response does not guarantee that the wallet has processed the notification before this listdescriptors call. If the callback has not run, the range remains unchanged and the assertion fails despite correct top-up behavior. The test's own broadcasts exercise this timing path, so this is a test-reliability issue, not a production-wallet defect. Flush the validation-interface queue or wait for the range to advance before asserting.

💡 Suggestion

Express the loop count directly (test/functional/wallet_fast_rescan.py:70, head)

The loop variable is unused, but range(1, NUM_BLOCKS - 1) can look like it skips an iteration and requires readers to derive the block count. range(NUM_BLOCKS - 2) preserves the number of iterations while making the intended count explicit.

Review coverage was incomplete. The archaeology review had incomplete evidence. The adversarial_glm review had incomplete evidence.

Full review report

<!-- forgejo-review-bot:bitcoin/bitcoin --> Base: `8c49a9abe9196e35000849df76445037216b6d75` Head: `f217da5c59f43b43abca96de66b95c24ae99eed7` ##### 🟡 Minor **Synchronize wallet notifications before checking range growth** (test/functional/wallet_fast_rescan.py:84, head) `send_to` broadcasts through `sendrawtransaction`, which queues a mempool notification for validation-interface processing. The RPC response does not guarantee that the wallet has processed the notification before this `listdescriptors` call. If the callback has not run, the range remains unchanged and the assertion fails despite correct top-up behavior. The test's own broadcasts exercise this timing path, so this is a test-reliability issue, not a production-wallet defect. Flush the validation-interface queue or wait for the range to advance before asserting. ##### 💡 Suggestion **Express the loop count directly** (test/functional/wallet_fast_rescan.py:70, head) The loop variable is unused, but `range(1, NUM_BLOCKS - 1)` can look like it skips an iteration and requires readers to derive the block count. `range(NUM_BLOCKS - 2)` preserves the number of iterations while making the intended count explicit. Review coverage was incomplete. The archaeology review had incomplete evidence. The adversarial_glm review had incomplete evidence. [Full review report](<https://review.fish.foo/traces/34907-f217da5c59f43b43abca96de66b95c24ae99eed7-405-1.html>)
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!34907
No description provided.