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

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33380.

    <!--021abf342d371248e50ceaed478a90ca-->

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  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:

    diff --git a/test/functional/interface_ipc.py b/test/functional/interface_ipc.py
    index 1651b53bda..89c1fd7d31 100755
    --- a/test/functional/interface_ipc.py
    +++ b/test/functional/interface_ipc.py
    @@ -186,20 +186,33 @@ class IPCInterfaceTest(BitcoinTestFramework):
                 balance = miniwallet.get_balance()
                 coinbase.vout[0].scriptPubKey = miniwallet.get_output_script()
                 coinbase.vout[0].nValue = COIN
                 block.vtx[0] = coinbase
                 block.hashMerkleRoot = block.calc_merkle_root()
    +
    +            # Ensure the block is invalid by setting version to 0
    +            original_version = block.nVersion
    +            block.nVersion = 0
    +            block.solve()
    +            res = await mining.result.checkBlock(block.serialize(), check_opts)
    +            assert_equal(res.result, False)
    +            assert_equal(res.reason, "bad-version(0x00000000)")
    +            res = await template.result.submitSolution(ctx, block.nVersion, block.nTime, block.nNonce, coinbase.serialize())
    +            assert_equal(res.result, False)
    +
    +            block.nVersion = original_version
                 block.solve()
                 res = await mining.result.checkBlock(block.serialize(), check_opts)
                 assert_equal(res.result, True)
                 res = await template.result.submitSolution(ctx, block.nVersion, block.nTime, block.nNonce, coinbase.serialize())
                 assert_equal(res.result, True)
                 assert_equal(self.nodes[0].getchaintips()[0]["height"], current_block_height + 1)
                 miniwallet.rescan_utxos()
                 assert_equal(miniwallet.get_balance(), balance + 1)
                 res = await mining.result.checkBlock(block.serialize(), check_opts)
                 assert_equal(res.result, False)
    +            assert_equal(res.reason, "inconclusive-not-best-prevblk")
    
                 self.log.debug("Destroy template objects")
                 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: 2026-05-02 18:12 UTC

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