Skip to content

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

@darosior

Description

@darosior

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 1d813e4 create a clean default build and run the test:

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

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

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

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

[...]
2025-02-10T21:30:27.577000Z TestFramework (INFO): Test tip including OP_RETURN
2025-02-10T21:30:27.577000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/home/darosior/code/core/bitcoin/test/functional/test_framework/test_framework.py", line 135, in main
    self.run_test()
  File "/home/darosior/code/core/bitcoin/./repro/test/functional/rpc_getblockstats.py", line 182, in run_test
    assert_equal(tip_stats["utxo_size_inc"], 441)
  File "/home/darosior/code/core/bitcoin/test/functional/test_framework/util.py", line 77, in assert_equal
    raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
AssertionError: not(450 == 441)
[...]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions