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 w0xlt
    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. test: check wallet rescan properly in feature_pruning 639832d006
  13. brunoerg force-pushed on Jan 2, 2026
  14. 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.
  15. DrahtBot added the label CI failed on Jan 2, 2026
  16. DrahtBot removed the label CI failed on Jan 2, 2026
  17. 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())
    
  18. 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())
    

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-01-07 03:13 UTC

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