test: fix `feature_pruning` when built without wallet #34185

pull brunoerg wants to merge 2 commits into bitcoin:master from brunoerg:2025-12-test-pruning-wout-wallet changing 1 files +14 −8
  1. brunoerg commented at 3:14 PM on December 31, 2025: contributor

    Fixes #34175

    In feature_pruning, thewallet_test doesn't require any specific wallet functionality and this test is important for one of next ones (test_scanblocks_pruned). The reason is that it synchronizes the node 5 and, without this sync, test_scanblocks_pruned will fail since we expect scanblocks to fail due to Block not available (pruned data) and it doesn't happen without this sync.

  2. DrahtBot added the label Tests on Dec 31, 2025
  3. DrahtBot commented at 3:14 PM on December 31, 2025: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34185.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK furszy, musaHaruna, w0xlt, achow101
    Stale ACK bensig

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. hebasto commented at 3:23 PM on December 31, 2025: member

    thewallet_test doesn't require any specific wallet functionality...

    Perhaps consider giving this function a less confusing name?

  5. furszy commented at 4:50 PM on December 31, 2025: member

    if the function was meant to test wallet restarts during pruning, what about actually checking the wallet?

  6. brunoerg commented at 5:27 PM on December 31, 2025: contributor

    if the function was meant to test wallet restarts during pruning, what about actually checking the wallet?

    Sounds good, I'm going to address it.

  7. brunoerg commented at 6:20 PM on December 31, 2025: contributor

    Force-pushed:

    • Added a proper check for wallet rescan (verifying getwalletinfo).
    • Renamed wallet_test to test_wallet_rescan.
    • Added a comment explaining why we do not skip test_wallet_rescan entirely if there is no wallet compiled.
  8. bensig commented at 9:33 PM on December 31, 2025: contributor

    ACK fa49789

    Tested on macOS with ENABLE_WALLET=OFF - feature_pruning.py passes.

    nit: "benefit of synchronization" --> "benefit from the synchronization"

  9. furszy commented at 6:52 PM on January 1, 2026: member

    Rather than applying the first and third commits, I think it is better to isolate the tests and add the missing sync where it's actually needed. Making other tests depend on the wallet test internal code isn’t really a good idea. It makes it more complicate to reason about. We should be able to fix this by adding another self.sync_blocks([self.nodes[0], self.nodes[5]], wait=5, timeout=300) call in the right place.

  10. test: fix feature_pruning when built without wallet 9b57c8d2bd
  11. brunoerg force-pushed on Jan 2, 2026
  12. brunoerg force-pushed on Jan 2, 2026
  13. brunoerg commented at 10:03 PM on January 2, 2026: contributor

    We should be able to fix this by adding another self.sync_blocks([self.nodes[0], self.nodes[5]], wait=5, timeout=300) call in the right place.

    Just a single sync_blocks call would not solve it, but anyway, I've changed the approach to a simpler one.

    • 9b57c8d - fix feature_pruning when built without wallet by moving the syncronization code from wallet_test to be done before calling test_wallet and the next tests that also need it (It avoids duplicated code and actions).
    • 9011083 - check wallet rescan properly in feature_pruning by checking "scanning" and "lastprocessedblock" from getwalletinfo RPC. Also, it renames wallet_test to test_wallet_rescan.
  14. DrahtBot added the label CI failed on Jan 2, 2026
  15. DrahtBot removed the label CI failed on Jan 2, 2026
  16. in test/functional/feature_pruning.py:356 in 639832d006
     353 |          self.restart_node(2, extra_args=["-prune=550"])
     354 | -        self.log.info("Success")
     355 | +
     356 | +        wallet_info = self.nodes[2].getwalletinfo()
     357 | +        assert_equal(wallet_info["scanning"], False)
     358 | +        assert_equal(wallet_info["lastprocessedblock"]["height"], 1553)
    


    w0xlt commented at 9:42 PM on January 6, 2026:
            assert_equal(wallet_info["lastprocessedblock"]["height"], self.nodes[2].getblockcount())
    

    brunoerg commented at 7:56 PM on January 8, 2026:

    I will leave as is for now. Going to address it.

  17. in test/functional/feature_pruning.py:364 in 639832d006
     366 |          self.restart_node(5, extra_args=["-prune=550", "-blockfilterindex=1"]) # restart to trigger rescan
     367 | -        self.log.info("Success")
     368 | +
     369 | +        wallet_info = self.nodes[5].getwalletinfo()
     370 | +        assert_equal(wallet_info["scanning"], False)
     371 | +        assert_equal(wallet_info["lastprocessedblock"]["height"], 1553)
    


    w0xlt commented at 9:42 PM on January 6, 2026:
            assert_equal(wallet_info["lastprocessedblock"]["height"], self.nodes[5].getblockcount())
    
  18. brunoerg force-pushed on Jan 8, 2026
  19. brunoerg commented at 8:11 PM on January 8, 2026: contributor

    Force-pushed addressing #34185 (review).

  20. in test/functional/feature_pruning.py:364 in f892ee88ec
     362 |          self.restart_node(5, extra_args=["-prune=550", "-blockfilterindex=1"]) # restart to trigger rescan
     363 | -        self.log.info("Success")
     364 | +
     365 | +        wallet_info = self.nodes[5].getwalletinfo()
     366 | +        assert_equal(wallet_info["scanning"], False)
     367 | +        assert_equal(wallet_info["lastprocessedblock"]["height"], self.nodes[2].getblockcount())
    


    furszy commented at 8:25 PM on January 8, 2026:

    As node[5] syncs from node[0], I guess this should have been self.nodes[0}.getblockcount()


    brunoerg commented at 8:37 PM on January 8, 2026:

    Yes, just addressed it.

  21. furszy commented at 8:25 PM on January 8, 2026: member

    utACK f892ee88ec2aedcb8bd03460739b3a05124287d8

  22. DrahtBot requested review from w0xlt on Jan 8, 2026
  23. brunoerg force-pushed on Jan 8, 2026
  24. DrahtBot added the label CI failed on Jan 8, 2026
  25. brunoerg commented at 8:40 PM on January 8, 2026: contributor

    Force-pushed addressing #34185 (review)

  26. DrahtBot removed the label CI failed on Jan 8, 2026
  27. test: check wallet rescan properly in feature_pruning 8fb5e5f41d
  28. brunoerg force-pushed on Jan 9, 2026
  29. furszy commented at 4:42 PM on January 10, 2026: member

    utACK 8fb5e5f41ddf550a78b1253184d79a107097815a

  30. luke-jr referenced this in commit ff488b542c on Jan 13, 2026
  31. luke-jr referenced this in commit eca0952bbe on Jan 13, 2026
  32. musaHaruna commented at 6:26 AM on January 14, 2026: contributor

    Tested ACK 8fb5e5f I was able to reproduce the issue on macOS 26.0 before the changes in this PR

    % cmake -B build -DENABLE_WALLET=OFF
    % cmake --build build -j 10
    % ./build/test/functional/feature_pruning.py --tmpdir $(pwd)/tmp
    2026-01-14T06:17:09.449618Z TestFramework (ERROR): Unexpected exception
    Traceback (most recent call last):
      File "/Users/musaharuna/bitcoin/test/functional/test_framework/test_framework.py", line 142, in main
        self.run_test()
        ~~~~~~~~~~~~~^^
      File "/Users/musaharuna/bitcoin/./build/test/functional/feature_pruning.py", line 481, in run_test
        self.test_scanblocks_pruned()
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
      File "/Users/musaharuna/bitcoin/./build/test/functional/feature_pruning.py", line 496, in test_scanblocks_pruned
        assert_raises_rpc_error(-1, "Block not available (pruned data)", node.scanblocks,
        ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            "start", [{"desc": f"raw({false_positive_spk.hex()})"}], 0, 0, "basic", {"filter_false_positives": True})
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/musaharuna/bitcoin/test/functional/test_framework/util.py", line 157, in assert_raises_rpc_error
        assert try_rpc(code, message, fun, *args, **kwds), "No exception raised"
               ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AssertionError: No exception raised
    2026-01-14T06:17:09.504754Z TestFramework (INFO): Not stopping nodes as test failed. The dangling processes will be cleaned up later.
    

    Test passed successfully after the changes in the PR. Also tested when cmake -B build -DENABLE_WALLET=ON test passed successfully as well.

  33. achow101 commented at 8:53 PM on January 14, 2026: member

    ACK 8fb5e5f41ddf550a78b1253184d79a107097815a

  34. achow101 merged this on Jan 14, 2026
  35. achow101 closed this on Jan 14, 2026

  36. fanquake referenced this in commit 4431a60f9c on Jan 15, 2026
  37. fanquake referenced this in commit 311da7fee3 on Jan 15, 2026
  38. fanquake commented at 11:25 AM on January 15, 2026: member

    Backported to 30.x in #34283.

  39. brunoerg deleted the branch on Jan 15, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-15 00:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me