The rpc_getblockstats.py
test was failing with --gen-test-data
because it used legacy wallet operations that could be affected by wallet changes, making the test data inconsistent.
I replaced the legacy wallet with MiniWallet to fix this. This makes the test data generation deterministic and reliable.
Changes:
- Switched from
wallet_importprivkey
/sendtoaddress
toMiniWallet.send_to()
- Added helper methods for OP_RETURN creation and block retrieval
- Made assertions dynamic instead of hardcoded
- Updated the test data JSON to match MiniWallet’s SegWit transactions
The test now passes consistently with both --gen-test-data
and existing data.
Fixes #31838