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

Tests: take netgraph locks after peer_state

Public commit record

What the developer wrote

Authored by Valentine Wallace

78/100 · Adequate
Tests: take netgraph locks after peer_state

Previously we were taking the NetworkGraph::{channels,nodes} locks before
ChannelManager::per_peer_state's peer_state locks in some tests, which violated
a lock order requirement we have in ChannelManager to take netgraph locks
*after* peer_state locks. See OffersMessageFlow::path_for_release_htlc which is
called while a peer_state lock is held and takes netgraph locks while creating
blinded paths.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit fixes the order in which internal locks are acquired inside test code only. It prevents a potential deadlock during tests, but does not change any production code that an attacker could exploit. The change makes tests follow the same lock-ordering rule already required by the main ChannelManager code.

Recommended action

No production action required. Ensure the project's CI and test suite run these updated tests to confirm the lock-order fix eliminates any intermittent test deadlocks. Consider adding a lint or runtime lock-order checker if not already present to catch similar test-only violations.

Security signals we found

01

Lock-order correction in test code

02

Potential deadlock avoidance (test-only)

03

Alignment of test helpers with production lock-order invariant

04

No production code changes

Risk score

Why this scored 17/100

Our methodology →
Potential impact 5/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 0/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.