rpc_getblockstats.py fails with --gen-test-data #31838

issue darosior openend this issue on February 10, 2025
  1. darosior commented at 9:32 pm on February 10, 2025: member

    The test only pass with the currently generated data. It will fail when using the integrated feature to generate this data and running against it.

    Reproduction instructions. On top of current master 1d813e4bf52a207ec526303df7b2e3d40d5eaa54 create a clean default build and run the test:

    0cmake -B repro
    1cmake --build repro -j20
    2./repro/test/functional/rpc_getblockstats.py --gen-test-data
    

    Initially it will fail because it’s missing the wallet arguments. Patch it with:

     0diff --git a/test/functional/rpc_getblockstats.py b/test/functional/rpc_getblockstats.py
     1index 002763201a5..2a7c8ac34af 100755
     2--- a/test/functional/rpc_getblockstats.py
     3+++ b/test/functional/rpc_getblockstats.py
     4@@ -24,6 +24,7 @@ class GetblockstatsTest(BitcoinTestFramework):
     5     max_stat_pos = 2
     6 
     7     def add_options(self, parser):
     8+        self.add_wallet_options(parser)
     9         parser.add_argument('--gen-test-data', dest='gen_test_data',
    10                             default=False, action='store_true',
    11                             help='Generate test data')
    

    Run the test again. It will now fail in its own business logic:

     0[...]
     12025-02-10T21:30:27.577000Z TestFramework (INFO): Test tip including OP_RETURN
     22025-02-10T21:30:27.577000Z TestFramework (ERROR): Assertion failed
     3Traceback (most recent call last):
     4  File "/home/darosior/code/core/bitcoin/test/functional/test_framework/test_framework.py", line 135, in main
     5    self.run_test()
     6  File "/home/darosior/code/core/bitcoin/./repro/test/functional/rpc_getblockstats.py", line 182, in run_test
     7    assert_equal(tip_stats["utxo_size_inc"], 441)
     8  File "/home/darosior/code/core/bitcoin/test/functional/test_framework/util.py", line 77, in assert_equal
     9    raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
    10AssertionError: not(450 == 441)
    11[...]
    
  2. maflcko commented at 2:19 pm on February 12, 2025: member
    The test should be using the miniwallet. Otherwise, it seems likely that some wallet change can affect the transactions and thus block stats.

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: 2025-02-22 06:12 UTC

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