test: move make_mining_ctx to ipc_util.py

The async routines in both interface_ipc.py and interface_ipc_mining.py
contain redundant code to initialize the mining proxy object.

Move the make_mining_ctx helper into test_framework/ipc_util.py and
update both test files to use it. This removes the boilerplate and
prevents code duplication across the IPC test suite.
This commit is contained in:
Enoch Azariah
2026-03-04 00:41:08 +01:00
parent 4ada575d6c
commit 63684d6922
3 changed files with 17 additions and 24 deletions

View File

@@ -148,3 +148,10 @@ async def mining_get_coinbase_tx(block_template, ctx) -> CoinbaseTxData:
requiredOutputs=[bytes(output) for output in template_capnp.requiredOutputs],
lockTime=int(template_capnp.lockTime),
)
async def make_mining_ctx(self):
"""Create IPC context and Mining proxy object."""
ctx, init = await make_capnp_init_ctx(self)
self.log.debug("Create Mining proxy object")
mining = init.makeMining(ctx).result
return ctx, mining