test: split interface_ipc.py #34452

pull Sjors wants to merge 3 commits into bitcoin:master from Sjors:2026/01/split-ipc-test changing 4 files +471 −339
  1. Sjors commented at 7:08 pm on January 29, 2026: member

    This test has been growing too large, making it difficult to maintain. Especially when multiple pull requests change it.

    • move helper functions to ipc_util.py
    • move mining test to ipc_mining.py, keeping only an interface sanity check in interface_ipc.py
    • split the tests in ipc_mining.py

    Review hint:

    0git show --color-moved=dimmed-zebra --color-moved-ws=ignore-space-change
    
  2. DrahtBot added the label Tests on Jan 29, 2026
  3. DrahtBot commented at 7:09 pm on January 29, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK ryanofsky, sedited
    Concept ACK ismaelsadeeq

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34422 (Update libmultiprocess subtree to be more stable with rust IPC client by ryanofsky)
    • #34284 (ipc, test: Add tests for unclean disconnect and thread busy behavior by ryanofsky)
    • #34184 (mining: add cooldown to createNewBlock() immediately after IBD by Sjors)
    • #33966 (refactor: disentangle miner startup defaults from runtime options by Sjors)
    • #33965 (mining: fix -blockreservedweight shadows IPC option by Sjors)
    • #33936 (mining: pass missing context to createNewBlock() and checkBlock() by Sjors)
    • #33922 (mining: add getMemoryLoad() and track template non-mempool memory footprint by Sjors)
    • #32420 (mining, ipc: omit dummy extraNonce from coinbase by Sjors)
    • #30437 (ipc: add bitcoin-mine test program by ryanofsky)

    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. Sjors force-pushed on Jan 29, 2026
  5. DrahtBot added the label CI failed on Jan 29, 2026
  6. in test/functional/test_framework/ipc_util.py:118 in 766c008920
    113+    ctx = capnp_modules['proxy'].Context()
    114+    ctx.thread = thread
    115+    return ctx, init
    116+
    117+
    118+async def parse_and_deserialize_block(block_template, ctx):
    


    ryanofsky commented at 7:44 pm on January 29, 2026:

    In commit “test: move helpers to ipc_util.py” (766c008920c2d45516065e502a826b60d9e8f5f1)

    Not important, but as long as these function signatures are being changed anyway (dropping self parameters) it would be nice to improve their current naming, which I think is misleading as have mentioned, and inconsistent with the names of the remote methods they call:

    • parse_and_deserialize_block -> get_block
    • parse_and_deserialize_coinbase_tx -> get_coinbase_raw_tx
    • parse_and_deserialize_coinbase -> get_coinbase_tx
  7. in test/functional/test_framework/ipc_util.py:45 in 766c008920
    40+        yield obj
    41+    finally:
    42+        await obj.destroy(ctx)
    43+
    44+
    45+async def create_block_template(mining, stack, ctx, opts):
    


    ryanofsky commented at 7:51 pm on January 29, 2026:

    In commit “test: move helpers to ipc_util.py” (766c008920c2d45516065e502a826b60d9e8f5f1)

    May be good to move create_block_template and wait_next_template below near parse_and_deserialize_block so the mining functions are grouped together and the file is organized with generic async functions at the top, followed by capnproto functions, followed by mining functions.

  8. in test/functional/interface_ipc_mining.py:293 in 9f80bd7c39 outdated
    289@@ -266,7 +290,15 @@ async def wait_for_block():
    290         asyncio.run(capnp.run(async_routine()))
    291 
    292     def run_test(self):
    293+        self.miniwallet = MiniWallet(self.nodes[0])
    


    ryanofsky commented at 8:00 pm on January 29, 2026:

    In commit “test: split interface_ipc_mining.py” (9f80bd7c390409cc1713a0ccc58018bd801758a0)

    Seems good to use a shared miniwallet variable like the shared opts variable, but also inconsistent to pass one as a parameter and attach other to self. It would seem better to pass them both as parameters so it’s clear which tests are using them.

  9. ryanofsky approved
  10. ryanofsky commented at 8:02 pm on January 29, 2026: contributor
    Code review ACK 9f80bd7c390409cc1713a0ccc58018bd801758a0. Thanks for the PR! Should make working with this test easier.
  11. ismaelsadeeq commented at 8:19 pm on January 29, 2026: member
    Concept ACK
  12. DrahtBot removed the label CI failed on Jan 29, 2026
  13. test: move helpers to ipc_util.py
    Move helper functions and dataclass from interface_ipc.py to a new
    test_framework/ipc_util.py module.
    
    Rename some helpers for clarity:
    
    - parse_and_deserialize_block -> get_block
    - parse_and_deserialize_coinbase_tx -> get_coinbase_raw_tx
    - parse_and_deserialize_coinbase -> get_coinbase_tx
    16ecb41585
  14. test: add interface_ipc_mining.py
    Split the Mining interface tests from interface_ipc.py into a dedicated
    interface_ipc_mining.py file. The original file now only tests basic IPC
    functionality (echo) and simple Mining inspectors.
    a35a9621fb
  15. test: split interface_ipc_mining.py
    Plus a few minor improvements.
    836ed1fb88
  16. Sjors force-pushed on Jan 30, 2026
  17. Sjors commented at 11:14 am on January 30, 2026: member
    Applied suggestions from @ryanofsky.
  18. DrahtBot added the label CI failed on Jan 30, 2026
  19. fanquake commented at 12:16 pm on January 30, 2026: member
    The Windows CI failure is (#34354).
  20. ryanofsky approved
  21. ryanofsky commented at 2:31 pm on January 30, 2026: contributor
    Code review ACK 836ed1fb88ed66bd966b35eb4aec69fb195a0f77. Thanks for the updates! Just some suggested renames and moves since last review
  22. DrahtBot requested review from ismaelsadeeq on Jan 30, 2026
  23. DrahtBot removed the label CI failed on Jan 30, 2026
  24. sedited approved
  25. sedited commented at 8:47 pm on January 30, 2026: contributor

    ACK 836ed1fb88ed66bd966b35eb4aec69fb195a0f77

    Nit: The commit messages could be a bit more descriptive.


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-02-02 06:13 UTC

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