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

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

    Code Coverage & Benchmarks

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

    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 <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  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:
    0        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:
    0        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

     0% cmake -B build -DENABLE_WALLET=OFF
     1% cmake --build build -j 10
     2% ./build/test/functional/feature_pruning.py --tmpdir $(pwd)/tmp
     32026-01-14T06:17:09.449618Z TestFramework (ERROR): Unexpected exception
     4Traceback (most recent call last):
     5  File "/Users/musaharuna/bitcoin/test/functional/test_framework/test_framework.py", line 142, in main
     6    self.run_test()
     7    ~~~~~~~~~~~~~^^
     8  File "/Users/musaharuna/bitcoin/./build/test/functional/feature_pruning.py", line 481, in run_test
     9    self.test_scanblocks_pruned()
    10    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
    11  File "/Users/musaharuna/bitcoin/./build/test/functional/feature_pruning.py", line 496, in test_scanblocks_pruned
    12    assert_raises_rpc_error(-1, "Block not available (pruned data)", node.scanblocks,
    13    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    14        "start", [{"desc": f"raw({false_positive_spk.hex()})"}], 0, 0, "basic", {"filter_false_positives": True})
    15        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    16  File "/Users/musaharuna/bitcoin/test/functional/test_framework/util.py", line 157, in assert_raises_rpc_error
    17    assert try_rpc(code, message, fun, *args, **kwds), "No exception raised"
    18           ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    19AssertionError: No exception raised
    202026-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-02-02 06:13 UTC

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