test: Speed up interface_ipc_mining.py and fix large timeout-factor bug #36924

Manually merged
maflcko merged 2 commits from 2611-fix-ipc-mining-test-issues into master 2026-11-21 18:00:57 +00:00 AGit
maflcko commented 2026-11-20 09:25:27 +00:00 (Migrated from github.com)

The test would fail with a large enough timeout factor, because the ipc
times out before the delayed generate() call: template2 would be None
and fail the assert.

Also, the test would sleep more than timeout_factor seconds in the happy
case in all test runs.

Fix both issues by sleeping for a bit longer than a single fee tick.

The test would fail with a large enough timeout factor, because the ipc times out before the delayed `generate()` call: `template2` would be `None` and fail the assert. Also, the test would sleep more than timeout_factor seconds in the happy case in all test runs. Fix both issues by sleeping for a bit longer than a single fee tick.
DrahtBot commented 2026-11-20 09:25:37 +00:00 (Migrated from github.com)

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

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK ViniciusCestarii, nervana21, mercie-ux

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36924 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36924.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36924#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [ViniciusCestarii](https://github.com/bitcoin/bitcoin/pull/36924#pullrequestreview-5994959043), [nervana21](https://github.com/bitcoin/bitcoin/pull/36924#issuecomment-7064386172), [mercie-ux](https://github.com/bitcoin/bitcoin/pull/36924#pullrequestreview-6006973791) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--5faf32d7da4f0f540f40219e4f7537a3-->
First-time contributor

No verified findings are available from this review.

Review coverage was incomplete.


Reviewed: faa89b1ae68d · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:3705f06c6a27c475c77f2533c4d016ac03c829c839b7b538bba5e4768ccf54f1:1ed10c4979af6fc548d6b8d4534d505e02e84ac4b0aa4f8633555b2ba75119e8 --> <!-- ralph-base:079437cca7a8e2997a6dcd83ad38350014352544 --> <!-- ralph-head:faa89b1ae68d8548f6288521b06c064fcfc0b50f --> <!-- ralph-case:d6c7ac218be7ae41ba13e3e44747da3fe9933ffa1d66ca8622313e57f10badd3 --> No verified findings are available from this review. Review coverage was incomplete. <!-- Review tier: routine --> --- Reviewed: [`faa89b1ae68d`](<https://git.fish.foo/bitcoin/bitcoin/commit/faa89b1ae68d8548f6288521b06c064fcfc0b50f>) · [Review report](<https://review.fish.foo/report/36924-faa89b1ae68d8548f6288521b06c064fcfc0b50f-2871-1.html>) · [Previous reports](<https://review.fish.foo/traces/36924/>) [permalink](<https://review.fish.foo/report/36924-faa89b1ae68d8548f6288521b06c064fcfc0b50f-2871-1.html>)
maflcko commented 2026-11-20 09:41:55 +00:00 (Migrated from github.com)

It should be possible to test this locally via: --timeout-factor=61. On master, the test deterministically fails, on this pull, it passes.

Or with --timeout-factor=40: On master, the test sleeps that long before passing, on this pull, it passes twice as fast.

The failure looks something like:

 test  2026-11-18T06:23:07.740448Z TestFramework (ERROR): Unexpected exception: 
                                   Traceback (most recent call last):
                                     File "/ci_container_base/test/functional/test_framework/test_framework.py", line 146, in main
                                       self.run_test()
                                     File "/ci_container_base/ci/scratch_ ₿🧪_/build-x86_64-pc-linux-gnu/test/functional/interface_ipc_mining.py", line 893, in run_test
                                       self.run_block_template_test()
                                     File "/ci_container_base/ci/scratch_ ₿🧪_/build-x86_64-pc-linux-gnu/test/functional/interface_ipc_mining.py", line 343, in run_block_template_test
                                       asyncio.run(capnp.run(async_routine()))
                                     File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
                                       return runner.run(main)
                                              ^^^^^^^^^^^^^^^^
                                     File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
                                       return self._loop.run_until_complete(task)
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                     File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
                                       return future.result()
                                              ^^^^^^^^^^^^^^^
                                     File "capnp/lib/capnp.pyx", line 2085, in run
                                     File "capnp/lib/capnp.pyx", line 2086, in capnp.lib.capnp.run
                                     File "/ci_container_base/ci/scratch_ ₿🧪_/build-x86_64-pc-linux-gnu/test/functional/interface_ipc_mining.py", line 287, in async_routine
                                       assert template2 is not None
                                              ^^^^^^^^^^^^^^^^^^^^^
                                   AssertionError
It should be possible to test this locally via: `--timeout-factor=61`. On master, the test deterministically fails, on this pull, it passes. Or with `--timeout-factor=40`: On master, the test sleeps that long before passing, on this pull, it passes twice as fast. The failure looks something like: ``` test 2026-11-18T06:23:07.740448Z TestFramework (ERROR): Unexpected exception: Traceback (most recent call last): File "/ci_container_base/test/functional/test_framework/test_framework.py", line 146, in main self.run_test() File "/ci_container_base/ci/scratch_ ₿🧪_/build-x86_64-pc-linux-gnu/test/functional/interface_ipc_mining.py", line 893, in run_test self.run_block_template_test() File "/ci_container_base/ci/scratch_ ₿🧪_/build-x86_64-pc-linux-gnu/test/functional/interface_ipc_mining.py", line 343, in run_block_template_test asyncio.run(capnp.run(async_routine())) File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "capnp/lib/capnp.pyx", line 2085, in run File "capnp/lib/capnp.pyx", line 2086, in capnp.lib.capnp.run File "/ci_container_base/ci/scratch_ ₿🧪_/build-x86_64-pc-linux-gnu/test/functional/interface_ipc_mining.py", line 287, in async_routine assert template2 is not None ^^^^^^^^^^^^^^^^^^^^^ AssertionError
fanquake commented 2026-11-20 11:09:04 +00:00 (Migrated from github.com)

cc @ViniciusCestarii @ryanofsky

cc @ViniciusCestarii @ryanofsky
ViniciusCestarii (Migrated from github.com) reviewed 2026-11-20 15:16:30 +00:00
ViniciusCestarii (Migrated from github.com) left a comment

tACK faa89b1ae6

Confirmed this fix the slowdown and the error when timeout factor is 55+.

tACK faa89b1ae68d8548f6288521b06c064fcfc0b50f Confirmed this fix the slowdown and the error when timeout factor is 55+.
nervana21 commented 2026-11-21 14:48:21 +00:00 (Migrated from github.com)

tACK faa89b1ae6

tACK faa89b1ae68d8548f6288521b06c064fcfc0b50f
mercie-ux (Migrated from github.com) reviewed 2026-11-21 17:31:01 +00:00
mercie-ux (Migrated from github.com) left a comment

Tested ACK faa89b1

verified the 2s sleep covers a fee tick. with feeThreshold = 1 the test fails because block2 has more than one transaction.

Tested ACK faa89b1 verified the 2s sleep covers a fee tick. with `feeThreshold = 1` the test fails because block2 has more than one transaction.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36924
No description provided.