mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-07 14:18:18 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user