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

peer: add mock BestBlockView to test peer config

Public commit record

What the developer wrote

Authored by Elle Mouton

78/100 · Adequate
peer: add mock BestBlockView to test peer config

The test Config in createTestPeer left BestBlockView nil. When the
PingManager's timer fires during a test, it calls
BestBlockView.BestBlockHeader() which panics on the nil receiver.
This was a flaky failure since it depended on a race between the
timer and test completion.

Add a trivial mockBestBlockView that returns an empty block header
and wire it into the test Config.
✓ 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 a flaky test in LND's peer package. The test helper that creates a fake peer was missing a mock object for BestBlockView. When a background ping timer fired during tests, it tried to call a method on the nil mock, causing random test panics. The change adds a trivial mock that returns empty values and wires it into the test config. There is no production code change and no security relevance.

Recommended action

No security action needed. Treat as normal test-quality improvement.

Security signals we found

No strong security signals were identified.

Risk score

Why this scored 15/100

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