mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 05:32:22 +02:00
test: add IPC submitBlock functional test
Test the new Mining.submitBlock IPC method: - Invalid block (bad version) returns failure with reason - Valid block (with a real mempool tx) is accepted and propagates - Duplicate block returns failure with "duplicate" reason - Witness commitment without coinbase witness nonce is rejected (bad-witness-nonce-size), confirming no auto-fix behavior - submitBlock then submitSolution: duplicate is accepted (submitSolution returns true for already-known blocks) - submitSolution then submitBlock interaction (duplicate) Build candidate blocks from BlockTemplate data in the existing coinbase and submission test, then exercise checkBlock(), submitSolution(), and submitBlock() against those candidates. submitBlock() uses an isolated IPC node for cases that would otherwise affect the main submitSolution() and checkBlock() assertions.
This commit is contained in:
@@ -94,8 +94,8 @@ def load_capnp_modules(config):
|
||||
}
|
||||
|
||||
|
||||
async def make_capnp_init_ctx(self):
|
||||
node = self.nodes[0]
|
||||
async def make_capnp_init_ctx(self, node_index=0):
|
||||
node = self.nodes[node_index]
|
||||
# Establish a connection, and create Init proxy object.
|
||||
connection = await capnp.AsyncIoStream.create_unix_connection(node.ipc_socket_path)
|
||||
client = capnp.TwoPartyClient(connection)
|
||||
@@ -152,9 +152,9 @@ async def mining_get_coinbase_tx(block_template, ctx) -> CoinbaseTxData:
|
||||
lockTime=int(template_capnp.lockTime),
|
||||
)
|
||||
|
||||
async def make_mining_ctx(self):
|
||||
async def make_mining_ctx(self, node_index=0):
|
||||
"""Create IPC context and Mining proxy object."""
|
||||
ctx, init = await make_capnp_init_ctx(self)
|
||||
ctx, init = await make_capnp_init_ctx(self, node_index)
|
||||
self.log.debug("Create Mining proxy object")
|
||||
mining = init.makeMining(ctx).result
|
||||
return ctx, mining
|
||||
|
||||
Reference in New Issue
Block a user