test: Replace legacy wallet with MiniWallet in rpc_getblockstats.py #33184

pull enirox001 wants to merge 2 commits into bitcoin:master from enirox001:2025_08_refactor_getblockstats changing 2 files +35 āˆ’300
  1. enirox001 commented at 2:52 pm on August 13, 2025: contributor

    Replaces legacy wallet operations with MiniWallet in rpc_getblockstats.py and simplifies the test structure.

    The test used legacy wallet RPCs and had a complex generate/load pattern that dumped data to JSON files. MiniWallet provides deterministic transaction creation, eliminating the need for file I/O and pre-generated data. This creates a single code path that works in all environments.

    Fixes #31838

  2. DrahtBot added the label Tests on Aug 13, 2025
  3. DrahtBot commented at 2:52 pm on August 13, 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/33184.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK kannapoix
    Concept ACK Eunovo

    If your review is incorrectly listed, please react with šŸ‘Ž to this comment and the bot will ignore it on the next update.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #32138 (wallet, rpc: remove settxfee and paytxfee by polespinasa)
    • #31449 (coins,refactor: Reduce getblockstats RPC UTXO overhead estimation by l0rinc)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  4. in test/functional/rpc_getblockstats.py:66 in 545aafb902 outdated
    79+        self.generate(wallet, COINBASE_MATURITY + 1)
    80+
    81+        external_address = self.nodes[0].get_deterministic_priv_key().address
    82+        external_script = address_to_scriptpubkey(external_address)
    83+
    84+        for i, (amount_btc, description) in enumerate(TRANSACTIONS):
    


    brunoerg commented at 6:45 pm on August 21, 2025:
    0        for i, (amount_btc, _) in enumerate(TRANSACTIONS):
    

    enirox001 commented at 4:33 pm on August 22, 2025:
    Done
  5. in test/functional/rpc_getblockstats.py:49 in 545aafb902 outdated
    62-        self.nodes[0].settxfee(amount=0.003)
    63-        self.nodes[0].sendtoaddress(address=address, amount=1, subtractfeefromamount=True)
    64-        # Send to OP_RETURN output to test its exclusion from statistics
    65-        self.nodes[0].send(outputs={"data": "21"})
    66+        MOCKTIME = 1525107225
    67+        FEE_SATOSHIS = 31200
    


    brunoerg commented at 6:49 pm on August 21, 2025:
    545aafb902cfe16194f90f7eb11cd5221b30015e: Do we need this FEE_SATOSHIS? Couldn’t we use the default value from send_to?

    enirox001 commented at 4:31 pm on August 22, 2025:
    Good catch! Removed FEE_SATOSHIS and now using the default fee. The original settxfee(0.003) was arbitrary - since getblockstats measures UTXOs (not fees), the default fee works fine. Test still passes and code is cleaner.
  6. enirox001 force-pushed on Aug 22, 2025
  7. in test/functional/rpc_getblockstats.py:93 in 10da636b15 outdated
    107+        with open(filename, 'w', encoding="utf8") as f:
    108+            json.dump(to_dump, f, sort_keys=True, indent=2)
    109+
    110+    def _create_op_return_transaction(self, wallet):
    111+        """Create a transaction with OP_RETURN output to test statistics exclusion."""
    112+        tx = wallet.create_self_transfer(fee_rate=Decimal("0.003"))
    


    kannapoix commented at 7:19 am on August 25, 2025:
    Is there a reason we need to explicitly specify fee_rate here? From what I can see, the test seems to pass even without setting this value. I understand that in the original test, the transaction with the OP_RETURN was sent with a fee rate of 0.003 implicitly. However, since we are not testing the fee rate in this case, I’m concerned that explicitly setting it here might be confusing for future readers.

    enirox001 commented at 5:56 pm on August 26, 2025:
    Good catch! You’re right - since create_self_transfer() defaults to fee_rate=0.003, explicitly setting it here is redundant and potentially confusing. I’ve removed the parameter to use the default.
  8. in test/functional/rpc_getblockstats.py:59 in 10da636b15 outdated
    86+                from_node=self.nodes[0],
    87+                scriptPubKey=external_script,
    88+                amount=amount_satoshis,
    89+            )
    90+            if i == 0:
    91+                self.generate(wallet, 1)
    


    kannapoix commented at 7:51 am on August 25, 2025:
    If we are not specifically testing address type or scripts here, perhaps we could use wallet.send_self_transfer(from_node=self.nodes) instead? I think this might make the code simpler than generating scripts and using wallet.send_to.

    enirox001 commented at 5:57 pm on August 26, 2025:
    Good idea, but send_self_transfer() only creates self-transfers (sending back to the wallet’s own address). For this test, we need external outputs to properly test getblockstats UTXO statistics. The send_to() method is necessary here to create transactions with external recipients.

    kannapoix commented at 2:37 am on August 28, 2025:

    Sorry, I don’t quite understand why specifically external outputs are necessary. In getblockstats, there are four UTXO-related statistics: utxo_increase, utxo_size_inc, utxo_increase_actual, and utxo_size_inc_actual. As far as I can see, none of these depend on whether a UTXO is sent to an external or internal address.

    That said, using send_self_transfer would significantly change the generated transactions compared to the original test, so I agree that it’s better to try to keep the generated transactions as close to the original as possible.


    enirox001 commented at 7:43 pm on August 28, 2025:

    You’re correct that UTXO statistics don’t depend on output destination. However, I’m keeping external outputs to maintain consistency with the original test’s transaction structure. Changing to send_self_transfer would alter the generated test data and expected statistics values.

    Since the goal is to replace the wallet implementation while preserving test behavior, send_to with external scripts is the most faithful translation of the original sendtoaddress calls.

  9. in test/functional/rpc_getblockstats.py:58 in 10da636b15 outdated
    85+            wallet.send_to(
    86+                from_node=self.nodes[0],
    87+                scriptPubKey=external_script,
    88+                amount=amount_satoshis,
    89+            )
    90+            if i == 0:
    


    kannapoix commented at 0:34 am on August 26, 2025:
    May I ask why we need to mine here after the first transaction? I noticed that the original test also mines at this point, but I’m not sure about the reason behind it: https://github.com/bitcoin/bitcoin/blob/6ca6f3b37b992591726bd13b494369bee3bd6468/test/functional/rpc_getblockstats.py#L53-L54

    enirox001 commented at 5:58 pm on August 26, 2025:

    This mining pattern is intentional - it creates a specific block structure for testing:

    • Block 1: 1 transaction (first 10 BTC send)
    • Block 2: 4 transactions (remaining sends + OP_RETURN)

    This allows testing getblockstats across different block scenarios (single vs multi-transaction blocks) rather than having all transactions in one block.


    kannapoix commented at 4:39 am on August 28, 2025:

    Thank you!

    It appears that we are no longer testing the case of send 10 BTC with fee subtracted, nor the case of send 1 BTC with a higher fee rate, since we are not specifying a fee in send_to().


    enirox001 commented at 7:43 pm on August 28, 2025:
    You’re correct - the comments were misleading. I’ve updated them to accurately reflect that MiniWallet uses consistent fee behavior for all transactions. The test still validates getblockstats functionality across different block structures, which is the primary goal.
  10. in test/functional/rpc_getblockstats.py:96 in 10da636b15 outdated
    110+    def _create_op_return_transaction(self, wallet):
    111+        """Create a transaction with OP_RETURN output to test statistics exclusion."""
    112+        tx = wallet.create_self_transfer(fee_rate=Decimal("0.003"))
    113+        op_return_data = b'\x21'
    114+        tx["tx"].vout.append(CTxOut(nValue=0, scriptPubKey=CScript([OP_RETURN, op_return_data])))
    115+        wallet.sendrawtransaction(from_node=self.nodes[0], tx_hex=tx["hex"])
    


    kannapoix commented at 1:27 am on August 26, 2025:

    Just to confirm, it seems we need to re-serialize the transaction after changing the output. Is that correct?

    0        wallet.sendrawtransaction(from_node=self.nodes[0], tx_hex=tx["tx"].serialize().hex())
    

    enirox001 commented at 6:00 pm on August 26, 2025:

    You’re right - we need to re-serialize after modifying the transaction. The tx["hex"] contains the original transaction, but we’re modifying tx["tx"] by adding the OP_RETURN output. Without re-serializing, the OP_RETURN wouldn’t actually be included in the sent transaction.

    I’ve applied your suggested fix.

  11. kannapoix commented at 3:06 am on August 26, 2025: none
    I’m new to this code base, so I might have missed something or made some mistakes in my review. Please feel free to correct me if that’s the case. Thanks!
  12. enirox001 force-pushed on Aug 26, 2025
  13. DrahtBot added the label CI failed on Aug 26, 2025
  14. DrahtBot commented at 5:41 pm on August 26, 2025: contributor

    🚧 At least one of the CI tasks failed. Task lint: https://github.com/bitcoin/bitcoin/runs/48935536189 LLM reason (✨ experimental): Lint check failed due to a style error detected by rust’s ruff, specifically an unused import in a Python test file.

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  15. enirox001 closed this on Aug 26, 2025

  16. enirox001 deleted the branch on Aug 26, 2025
  17. enirox001 restored the branch on Aug 26, 2025
  18. enirox001 reopened this on Aug 26, 2025

  19. enirox001 force-pushed on Aug 26, 2025
  20. kannapoix commented at 4:52 am on August 28, 2025: none
    Concept ACK
  21. in test/functional/rpc_getblockstats.py:22 in 5544dae670 outdated
    18+from test_framework.script import OP_RETURN, CScript
    19+from test_framework.messages import CTxOut, COIN
    20+from test_framework.address import address_to_scriptpubkey
    21 import json
    22 import os
    23+from decimal import Decimal
    


    maflcko commented at 7:23 am on August 28, 2025:
    [17:54:00.577] = help: Remove unused import: decimal.Decimal

    enirox001 commented at 7:43 pm on August 28, 2025:
    Done
  22. enirox001 force-pushed on Aug 28, 2025
  23. enirox001 force-pushed on Aug 28, 2025
  24. DrahtBot removed the label CI failed on Aug 28, 2025
  25. achow101 commented at 10:49 pm on September 17, 2025: member

    because it used legacy wallet operations

    That’s not why it fails, it does not use anything specific to legacy wallets at all. It fails initially because test nodes are started with -disablewallet if self.uses_wallet == False, and then fails again because of multiwallet, and lastly because settxfee is deprecated. But none of these are because of legacy wallet.

    Ultimately, the issues stem from the fact that this code path is pretty much never executed, and if MiniWallet were to change in the future, we’d run into the same problem.

  26. enirox001 commented at 11:13 pm on September 17, 2025: contributor

    because it used legacy wallet operations

    That’s not why it fails, it does not use anything specific to legacy wallets at all. It fails initially because test nodes are started with -disablewallet if self.uses_wallet == False, and then fails again because of multiwallet, and lastly because settxfee is deprecated. But none of these are because of legacy wallet.

    Ultimately, the issues stem from the fact that this code path is pretty much never executed, and if MiniWallet were to change in the future, we’d run into the same problem.

    Thanks for the review @achow101

    Originally assumed MiniWallet was the culprit based on the issue comments, but your explanation makes sense: the fixes here does not seem to be a proper solution to the problem.

    However, I believe the MiniWallet refactor is still the right approach here. The fundamental issue is that the –gen-test-data code path uses outdated testing patterns that are prone to breaking with framework changes. By modernizing to MiniWallet, we ensure the test follows current best practices and stays compatible with future framework updates.

    The alternative would be to just add self.add_wallet_options(parser) and replace deprecated RPCs, but that leaves the test using legacy patterns that could break again. What do you think would be the most effective long-term solution?

  27. enirox001 commented at 7:22 pm on September 18, 2025: contributor

    Looked into this @achow101 and you’re right about the setup issues - they weren’t legacy wallet specific but rather configuration problems. I’ve addressed the three issues you identified:

    1. Added self.uses_wallet = True to prevent -disablewallet
    2. MiniWallet naturally avoids deprecated settxfee by using modern fee handling
    3. MiniWallet sidesteps multiwallet complexity entirely

    Regarding your concern about the –gen-test-data path being rarely executed: I’ve ensured the test runs with proper wallet configuration, making it more likely to be executed in CI and catching issues earlier.

    While this PR may seem like overkill for the specific bug, MiniWallet does provide better maintainability and avoids the deprecated RPC patterns you mentioned. The changes are minimal and focused on the core issues.

  28. maflcko commented at 12:58 pm on September 25, 2025: member

    they weren’t legacy wallet specific but rather configuration problems.

    You’ll have to adjust the pull description. Also, CI fails.

    To ensure this is tested once, you can add --gen-test-data to one CI task config via TEST_RUNNER_EXTRA.

  29. enirox001 renamed this:
    test: Replace legacy wallet with MiniWallet in rpc_getblockstats.py
    test: Fix rpc_getblockstats for no-wallet environments
    on Sep 29, 2025
  30. enirox001 force-pushed on Sep 29, 2025
  31. enirox001 force-pushed on Sep 29, 2025
  32. in test/functional/rpc_getblockstats.py:42 in 12c9c7d927 outdated
    38@@ -39,6 +39,7 @@ def add_options(self, parser):
    39     def set_test_params(self):
    40         self.num_nodes = 1
    41         self.setup_clean_chain = True
    42+        self.uses_wallet = True
    


    Eunovo commented at 6:24 am on September 30, 2025:
    https://github.com/bitcoin/bitcoin/pull/33184/commits/12c9c7d927091f3be72f4acd99c166a41c789ae9: IIUC, MiniWallet doesn’t require wallet rpc, so what caused the “-disablewallet” error?

    enirox001 commented at 4:20 pm on September 30, 2025:
    The -disablewallet error was caused by self.uses_wallet = True, not MiniWallet. The test framework starts nodes with -disablewallet when uses_wallet = True in no-wallet CI environments. MiniWallet doesn’t need wallet RPC (it uses sendrawtransaction), so changing to uses_wallet = None allows the test to run in no-wallet environments while still using MiniWallet for transaction creation.
  33. in test/functional/test_framework/test_framework.py:256 in 316cf41c25 outdated
    252@@ -253,6 +253,8 @@ def parse_args(self, test_file):
    253                             help="Explicitly use v1 transport (can be used to overwrite global --v2transport option)")
    254         parser.add_argument("--test_methods", dest="test_methods", nargs='*',
    255                             help="Run specified test methods sequentially instead of the full test. Use only for methods that do not depend on any context set up in run_test or other methods.")
    256+        parser.add_argument("--gen-test-data", dest="gen_test_data", action='store_true', default=False,
    


    Eunovo commented at 6:25 am on September 30, 2025:
    https://github.com/bitcoin/bitcoin/pull/33184/commits/316cf41c25438d61f4e9568e20878fa374476a5a: I see that the CI fails because this argument conflicts with the argument defined in rpc_blockstats.

    enirox001 commented at 4:21 pm on September 30, 2025:
    Recent changes uses a different approach, so there is no need for this anymore
  34. Eunovo commented at 6:28 am on September 30, 2025: contributor
    I think this test could be simplified to always generate data with the MiniWallet and test with generated data, instead of dumping it to a file and loading it later. I don’t see the advantage of “generate” and “load” paths, and it’s creating unnecessary complexity.
  35. maflcko commented at 6:35 am on September 30, 2025: member

    I don’t see the advantage of “generate” and “load” paths, and it’s creating unnecessary complexity.

    I guess it depends on how long it takes to generate, but if it is just a few seconds, it seems easier not to cache.

  36. Eunovo commented at 6:37 am on September 30, 2025: contributor

    @maflcko This is from my 8-core laptop

     0☁  bitcoin [2e1836d744] build/test/functional/test_runner.py rpc_getblockstats --gen-test-data
     1Temporary test directory at /tmp/test_runner_₿_šŸƒ_20250930_083649
     2Remaining jobs: [rpc_getblockstats.py]
     31/1 - rpc_getblockstats.py passed, Duration: 1 s
     4
     5TEST                 | STATUS    | DURATION
     6
     7rpc_getblockstats.py | āœ“ Passed  | 1 s
     8
     9ALL                  | āœ“ Passed  | 1 s (accumulated) 
    10Runtime: 1 s
    
  37. enirox001 force-pushed on Sep 30, 2025
  38. enirox001 force-pushed on Sep 30, 2025
  39. enirox001 renamed this:
    test: Fix rpc_getblockstats for no-wallet environments
    test: Replace legacy wallet with MiniWallet in rpc_getblockstats.py
    on Sep 30, 2025
  40. enirox001 commented at 4:25 pm on September 30, 2025: contributor

    they weren’t legacy wallet specific but rather configuration problems.

    You’ll have to adjust the pull description. Also, CI fails.

    To ensure this is tested once, you can add --gen-test-data to one CI task config via TEST_RUNNER_EXTRA.

    Updated the PR title and description

    The recent simplification changes make adding a CI task config unnecessary. The test now always generates data with MiniWallet by default, so the data generation path is automatically tested in all CI environments without needing TEST_RUNNER_EXTRA configuration.

  41. enirox001 commented at 4:28 pm on September 30, 2025: contributor

    I think this test could be simplified to always generate data with the MiniWallet and test with generated data, instead of dumping it to a file and loading it later. I don’t see the advantage of “generate” and “load” paths, and it’s creating unnecessary complexity.

    I think this test could be simplified to always generate data with the MiniWallet and test with generated data, instead of dumping it to a file and loading it later. I don’t see the advantage of “generate” and “load” paths, and it’s creating unnecessary complexity. @Eunovo Great suggestion! I’ve implemented this simplification in the latest commit. The test now always generates data with MiniWallet by default, removing the generate/load pattern entirely.

    Since the time to generate the data is negligible, it makes much more sense to have it generated by default instead of the previous approach. This eliminates ~50 lines of complexity and makes the test more maintainable.

    The test now works in both wallet and no-wallet environments without any special configuration needed.

  42. enirox001 requested review from maflcko on Sep 30, 2025
  43. enirox001 requested review from kannapoix on Sep 30, 2025
  44. enirox001 requested review from brunoerg on Sep 30, 2025
  45. enirox001 requested review from Eunovo on Sep 30, 2025
  46. maflcko commented at 4:53 pm on September 30, 2025: member

    Changes:

    * Changed `self.uses_wallet = True` to `self.uses_wallet = None` to allow no-wallet environments
    
    * Added `self.skip_if_no_wallet()` when generating test data to ensure wallet is available when needed
    
    * Added `--gen-test-data` to TSan CI via `TEST_RUNNER_EXTRA` to ensure data generation is tested
    

    How it works:

    * In no-wallet environments: Test loads pre-generated data (no wallet required)
    
    * With `--gen-test-data` flag: Test requires wallet functionality and generates new data
    
    * In wallet environments: Test works normally with both modes
    

    the pull description is outdated and doesn’t make sense.

    Generally, instead of just repeating the changes made, it could make sense to motivate them and explain why each change makes sense and is correct.

  47. enirox001 commented at 5:10 pm on September 30, 2025: contributor

    Generally, instead of just repeating the changes made, it could make sense to motivate them and explain why each change makes sense and is correct.

    Updated PR description to explain motivation rather than just listing changes.

  48. in test/functional/data/rpc_getblockstats.json:1 in a6bcc6125f
    0@@ -1,117 +1,117 @@
    1 {
    


    maflcko commented at 5:12 pm on September 30, 2025:
    the file can be deleted now?

    enirox001 commented at 6:02 pm on September 30, 2025:

    Yes, since the json data is no longer being cached, this becomes stale

    Removed

  49. in test/functional/rpc_getblockstats.py:27 in a6bcc6125f
    34-                            help='Generate test data')
    35-        parser.add_argument('--test-data', dest='test_data',
    36-                            default='data/rpc_getblockstats.json',
    37-                            action='store', metavar='FILE',
    38-                            help='Test data file')
    39+        pass
    


    maflcko commented at 5:13 pm on September 30, 2025:
    method can be deleted now?

    enirox001 commented at 6:03 pm on September 30, 2025:

    Yes, this is no longer needed and can be deleted

    Done

  50. in test/functional/rpc_getblockstats.py:32 in a6bcc6125f
    39+        pass
    40 
    41     def set_test_params(self):
    42         self.num_nodes = 1
    43         self.setup_clean_chain = True
    44+        self.uses_wallet = None
    


    maflcko commented at 5:13 pm on September 30, 2025:
    what is this for?

    enirox001 commented at 6:34 pm on September 30, 2025:

    Was supposed to be for the test to work in non wallet environments, but since the test now always uses MiniWallet internally by default, this is no longer needed

    Removed the line of code

  51. maflcko commented at 5:15 pm on September 30, 2025: member
  52. in test/functional/rpc_getblockstats.py:38 in a6bcc6125f
    66-        # Send to OP_RETURN output to test its exclusion from statistics
    67-        self.nodes[0].send(outputs={"data": "21"})
    68-        self.sync_all()
    69-        self.generate(self.nodes[0], 1)
    70+    def generate_test_data(self):
    71+        MOCKTIME = 1525107225
    


    maflcko commented at 5:16 pm on September 30, 2025:
    why make this uppercase? could just leave as-is to make the diff smaller

    enirox001 commented at 6:04 pm on September 30, 2025:
    Reverted to make diff smaller
  53. enirox001 force-pushed on Sep 30, 2025
  54. in test/functional/rpc_getblockstats.py:152 in 1ffdf52533
    148@@ -177,10 +149,11 @@ def run_test(self):
    149 
    150         self.log.info('Test tip including OP_RETURN')
    151         tip_stats = self.nodes[0].getblockstats(tip)
    152-        assert_equal(tip_stats["utxo_increase"], 6)
    153-        assert_equal(tip_stats["utxo_size_inc"], 441)
    154-        assert_equal(tip_stats["utxo_increase_actual"], 4)
    155-        assert_equal(tip_stats["utxo_size_inc_actual"], 300)
    156+        expected_tip_stats = self.expected_stats[self.max_stat_pos]
    


    Eunovo commented at 12:45 pm on October 2, 2025:

    https://github.com/bitcoin/bitcoin/pull/33184/commits/1ffdf5253388af3cf274efd723b7129d9639da8c

    This is basically testing that two results of getblockstats match each other. It doesn’t actually determine the expected_tip_stats in the test and then compare against the actual result of getblockstats.


    Eunovo commented at 2:08 pm on October 2, 2025:

    I also want to note that the generated blocks already contain OP_RETURN outputs in coinbase transactions, so we don’t need to create a specific OP_RETURN output in the test.

    This might also remove the need to have a second block at all, since there’s no need to create a new tip for the OP_RETURN test


    enirox001 commented at 6:22 pm on October 2, 2025:

    This is basically testing that two results of getblockstats match each other. It doesn’t actually determine the expected_tip_stats in the test and then compare against the actual result of getblockstats.

    This is a good observation. I’ve reverted to using hardcoded expected values instead of circular getblockstats comparisons, ensuring the test validates actual correctness rather than just consistency.

    This might also remove the need to have a second block at all, since there’s no need to create a new tip for the OP_RETURN test

    Tested and confirmed coinbase already contains OP_RETURN outputs. I’ve updated the test to use existing coinbase OP_RETURN and removed the unnecessary extra block generation

  55. Eunovo commented at 12:46 pm on October 2, 2025: contributor

    Concept ACK https://github.com/bitcoin/bitcoin/pull/33184/commits/1ffdf5253388af3cf274efd723b7129d9639da8c

    The test is much simpler and the untested path has been eliminated, but I left the comment about the OP_RETURN test below.

  56. test: refactor rpc_getblockstats to use MiniWallet and hardcoded expected values
    - Replace legacy wallet-based test data generation with MiniWallet
    - Remove dependency on external test data file (rpc_getblockstats.json)
    - Use hardcoded expected values instead of circular getblockstats comparison
    - Add manual OP_RETURN transaction creation for testing statistics exclusion
    - Maintain backward compatibility with both wallet and no-wallet modes
    - Addresses reviewer feedback about circular logic in test assertions
    6cc1d07eff
  57. enirox001 force-pushed on Oct 2, 2025
  58. test: simplify rpc_getblockstats by using coinbase OP_RETURN
    - Remove manual OP_RETURN transaction creation
    - Use existing coinbase OP_RETURN outputs for testing statistics exclusion
    - Update expected values to match simplified test structure
    - Clean up unused imports
    f45b94d302
  59. enirox001 force-pushed on Oct 2, 2025
  60. in test/functional/rpc_getblockstats.py:33 in f45b94d302
    43     def get_stats(self):
    44         return [self.nodes[0].getblockstats(hash_or_height=self.start_height + i) for i in range(self.max_stat_pos+1)]
    45 
    46-    def generate_test_data(self, filename):
    47+    def generate_test_data(self):
    48         mocktime = 1525107225
    


    kannapoix commented at 3:40 am on October 9, 2025:
    nit: Do we still need this mocktime? The tests seem to pass without it. If it is necessary, could we use a more understandable value? Previously it was chosen to minimize diffs in generated test data, but that constraint no longer applies here: #14802 (review)
  61. kannapoix commented at 5:31 am on October 9, 2025: none

    tested ACK: f45b94d302a

    tests pass locally. I left a nit/question about mocktime.

  62. DrahtBot requested review from Eunovo on Oct 9, 2025

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-10-10 12:13 UTC

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