test: Add submitblock test in interface_ipc #33380

pull TheCharlatan wants to merge 1 commits into bitcoin:master from TheCharlatan:interface_ipc_submitblock changing 1 files +42 −1
  1. TheCharlatan commented at 5:59 pm on September 12, 2025: contributor
    Expands the ipc mining test a bit with submitting a solved block and checking its validity.
  2. DrahtBot added the label Tests on Sep 12, 2025
  3. DrahtBot commented at 5:59 pm on September 12, 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/33380.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK Sjors, marcofleon, zaidmstrr
    Stale ACK sipa

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

  4. sipa commented at 7:02 pm on September 12, 2025: member
    utACK 557644ee9499583b6d00efda289fb65e8359e084
  5. Sjors commented at 8:27 am on September 15, 2025: member

    ACK 557644ee9499583b6d00efda289fb65e8359e084

    Could expand it a bit:

     0diff --git a/test/functional/interface_ipc.py b/test/functional/interface_ipc.py
     1index 1651b53bda..89c1fd7d31 100755
     2--- a/test/functional/interface_ipc.py
     3+++ b/test/functional/interface_ipc.py
     4@@ -186,20 +186,33 @@ class IPCInterfaceTest(BitcoinTestFramework):
     5             balance = miniwallet.get_balance()
     6             coinbase.vout[0].scriptPubKey = miniwallet.get_output_script()
     7             coinbase.vout[0].nValue = COIN
     8             block.vtx[0] = coinbase
     9             block.hashMerkleRoot = block.calc_merkle_root()
    10+
    11+            # Ensure the block is invalid by setting version to 0
    12+            original_version = block.nVersion
    13+            block.nVersion = 0
    14+            block.solve()
    15+            res = await mining.result.checkBlock(block.serialize(), check_opts)
    16+            assert_equal(res.result, False)
    17+            assert_equal(res.reason, "bad-version(0x00000000)")
    18+            res = await template.result.submitSolution(ctx, block.nVersion, block.nTime, block.nNonce, coinbase.serialize())
    19+            assert_equal(res.result, False)
    20+
    21+            block.nVersion = original_version
    22             block.solve()
    23             res = await mining.result.checkBlock(block.serialize(), check_opts)
    24             assert_equal(res.result, True)
    25             res = await template.result.submitSolution(ctx, block.nVersion, block.nTime, block.nNonce, coinbase.serialize())
    26             assert_equal(res.result, True)
    27             assert_equal(self.nodes[0].getchaintips()[0]["height"], current_block_height + 1)
    28             miniwallet.rescan_utxos()
    29             assert_equal(miniwallet.get_balance(), balance + 1)
    30             res = await mining.result.checkBlock(block.serialize(), check_opts)
    31             assert_equal(res.result, False)
    32+            assert_equal(res.reason, "inconclusive-not-best-prevblk")
    33
    34             self.log.debug("Destroy template objects")
    35             template.result.destroy(ctx)
    
  6. test: Add submitblock test in interface_ipc
    Co-Authored-By: Sjors Provoost <sjors@sprovoost.nl>
    0a26731c4c
  7. TheCharlatan force-pushed on Sep 15, 2025
  8. TheCharlatan commented at 1:33 pm on September 15, 2025: contributor

    Updated 557644ee9499583b6d00efda289fb65e8359e084 -> 0a26731c4cc182e887ce959cdd301227cdc752d7 (interface_ipc_submitblock_0 -> interface_ipc_submitblock_1, compare)

  9. Sjors commented at 4:10 pm on September 15, 2025: member
    ACK 0a26731c4cc182e887ce959cdd301227cdc752d7
  10. DrahtBot requested review from sipa on Sep 15, 2025
  11. marcofleon commented at 10:58 am on September 16, 2025: contributor
    code review ACK 0a26731c4cc182e887ce959cdd301227cdc752d7
  12. fanquake requested review from ryanofsky on Sep 16, 2025
  13. zaidmstrr commented at 3:29 pm on September 16, 2025: contributor
    Tested ACK 0a26731
  14. glozow merged this on Sep 16, 2025
  15. glozow closed this on Sep 16, 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