AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 19 Bitcoin

Merge bitcoin/bitcoin#36731: test: use monotonic clock for durations in test framework and http_interface

Public commit record

What the developer wrote

Authored by merge-script

91/100 · Strong
Merge bitcoin/bitcoin#36731: test: use monotonic clock for durations in test framework and http_interface

a7d3a4297321274ced64294e0bbd3252167e8879 test: use monotonic clock in interface_http (ViniciusCestarii)
eccca10e6460507e553e61a1cdaf664fa7738375 test: use monotonic clock for durations in test framework (ViniciusCestarii)

Pull request description:

Replace `time.time()` used to measure durations by `time.monotonic()` in test framework and http_interface.

This helps preventing future clock jump flakiness (same class of bug as #36529) on tests and fix:

```
faketime --exclude-monotonic -f "+0 x0.5" build/test/functional/feature_torcontrol.py
faketime --exclude-monotonic -f "+0 x0.1" build/test/functional/interface_http.py
```

ACKs for top commit:
nervana21:
tACK a7d3a4297321274ced64294e0bbd3252167e8879
maflcko:
review ACK a7d3a4297321274ced64294e0bbd3252167e8879 🕐
sedited:
ACK a7d3a4297321274ced64294e0bbd3252167e8879

Tree-SHA512: d1c6b98ceab4c4bf5b97a44b4a4577b0868292d2aaa359aa67a807be469700737f0d330da83e8b6f85403635db6809c41dcd4041a84f3ab6dad9ef16e50a44d1
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit only changes the test code that runs Bitcoin Core's automated tests. It swaps the clock used to measure how long things take from the regular system clock (which can jump forward or backward, for example when the system time is adjusted) to a monotonic clock (which only ever moves forward steadily). This makes the tests more reliable and less likely to fail randomly due to clock jumps, but it does not change the actual Bitcoin Core software that users run, nor does it fix any security vulnerability in the live network or node software.

Recommended action

No security action required. This is a normal test-quality improvement. Reviewers may verify that no time.time() calls remain in duration-measurement contexts in these files, but the patch appears complete for the stated scope.

Security signals we found

01

No production code modified

02

Test-only reliability improvement

03

Prevents timing-related test flakiness under faketime and clock jumps

04

No change to cryptographic, consensus, networking, or RPC behavior in shipped binaries

Risk score

Why this scored 19/100

Our methodology →
Potential impact 2/30
Exploitability 0/25
Stealth signal 1/15
Affected reach 2/15
Confidence 9/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.