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

test: Move event loop creation to network thread

Public commit record

What the developer wrote

Authored by MarcoFalke

98/100 · Strong
test: Move event loop creation to network thread

This should fix https://github.com/bitcoin/bitcoin/issues/34367

I am not familiar with Windows sockets thread-safety, but creating the
event loop on the main thread, and running it in the network thread
could lead to a fast abort in Python on Windows (without any stderr):

```
77/276 - wallet_txn_clone.py failed, Duration: 1 s

stdout:
2025-12-10T08:04:27.500134Z TestFramework (INFO): PRNG seed is: 4018092284830106117

stderr:

Combine the logs and print the last 99999999 lines ...
============
Combined log for D:\a\_temp/test_runner_₿_🏃_20251210_075632/wallet_txn_clone_196:
============
test 2025-12-10T08:04:27.500134Z TestFramework (INFO): PRNG seed is: 4018092284830106117
test 2025-12-10T08:04:27.500433Z TestFramework (DEBUG): Setting up network thread
```

Also, I couldn't find any docs that require the loop must be created on
the thread that runs them:

* https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.new_event_loop
* https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_forever

However, the patch seems trivial to review, harmless, and easy to
revert, so it may be a good try to fix the intermittent Windows Python
crash.
✓ Descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ 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 is a small test-only change in Bitcoin Core's Python testing framework. It moves where an internal networking event loop is created so it is created on the same thread that later runs it, rather than on the main test thread. The goal is to stop an intermittent crash/abort that happens on Windows when running functional tests. It does not change the Bitcoin node itself, consensus rules, wallet handling, or network protocol, and there is no indication it fixes a security vulnerability.

Recommended action

No security action required. Treat as a normal test-framework reliability improvement. Reviewers may want to confirm the intermittent Windows crash is resolved in CI before closing the linked issue.

Security signals we found

01

No security-relevant signals in the diff or commit message

02

Change is confined to the functional test framework (Python test code)

03

No modifications to consensus, networking protocol, cryptography, or wallet logic

04

Commit message frames the change as a test stability fix, not a security fix

Risk score

Why this scored 17/100

Our methodology →
Potential impact 2/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 3/15
Confidence 8/10
Evidence quality 4/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.