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

onion_message: use util.random_shuffled_copy instead rand sort

Public commit record

What the developer wrote

Authored by f321x

50/100 · Thin
onion_message: use util.random_shuffled_copy instead rand sort
✓ Specific, descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
The short version

What changed, and why it matters

This commit replaces a shaky way of shuffling lists with a proper utility function. The old code sorted items by random numbers, which can produce biased or predictable ordering and is generally considered bad practice. The change itself is a small code-quality improvement, not a clear-cut security fix, but it removes a weak randomness pattern used when selecting Lightning Network channels and peers for routing private messages.

Recommended action

Treat as a minor hardening/cleanup change. Review `electrum.util.random_shuffled_copy` to confirm it uses a cryptographically secure random source appropriate for network privacy decisions. No urgent action required unless the old ordering was relied upon for a security property.

Security signals we found

01

Replaced non-cryptographic random sort key with a dedicated shuffle utility

02

Removed unused imports (dataclasses, MappingProxyType, random)

03

Change affects selection of Lightning channels and onion-message peers for blinded path construction

04

Pattern is a known anti-pattern: sorting by random() does not produce a uniformly random permutation

Risk score

Why this scored 16/100

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