1 minor finding · 1 suggestion
Findings
[minor] · Commit message describes normalization instead of timeout rejection
The commit message and PR description promise zero-timeout normalization, but waitNext and waitTipChanged reject invalid values; no current production caller sending negative timeouts was found.
Location: src/node/interfaces.cpp:928 (head).
Details and suggested fix
Both guards throw std::runtime_error for negative or NaN timeouts, matching mining.h and the new tests. The commit message instead says these values become zero, and the PR description also says the Assume was removed. The manager retains Assume(timeout >= 0ms) as an internal invariant. This distinction changes finite-negative-timeout behavior: previously, waitNext performed one nonblocking predicate/template check and returned a template or no result in every build. Without abort-on-failed-assume enabled, waitTipChanged clamped the timeout to zero and returned the current tip after its startup wait for a non-null tip, unless interrupted or shutting down. Both methods now throw before reaching those paths. Update the commit message and PR description to describe rejection, the retained internal Assume, and this change from results to errors.
Optional improvements
[suggestion] · waitNext infinity test also passes on an immediate timeout
The new waitNext test would still pass if positive infinity became a zero timeout, because expiration and interruption both return None.
Location: test/functional/interface_ipc_mining.py:357 (head).
Details and suggested fix
With feeThreshold = MAX_MONEY and no tip change, a zero timeout skips template creation and returns nullptr, which mining_wait_next_template maps to None. wait_and_do gathers the wait and delayed interrupt without checking whether the wait finished first. The delayed interruptWait() would then leave its flag set, and the following interruption test would consume that flag immediately and also obtain its expected None. Start the infinity wait as a task and assert that it remains pending after a short delay, for example using asyncio.wait with a timeout that does not cancel the task. Then call interruptWait() and assert that the task returns None.