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

swaps: add explicit check that (onchain_locktime < LN_locktime)

Public commit record

What the developer wrote

Authored by SomberNight

98/100 · Strong
swaps: add explicit check that (onchain_locktime < LN_locktime)

This was already implicitly checked. This diff makes the check explicit, and serves as an additional sanity-check.
- for client-forward-swaps, we have
- "cltv safety requirement: (onchain_locktime < LN_locktime), otherwise client is vulnerable"
- server chooses onchain locktime delta = 70
https://github.com/spesmilo/electrum/blob/71255c1e735cdfcd881e045b9f2f6bc6b599f459/electrum/submarine_swaps.py#L701
- client checks that onchain locktime delta is <100
https://github.com/spesmilo/electrum/blob/71255c1e735cdfcd881e045b9f2f6bc6b599f459/electrum/submarine_swaps.py#L887
- client chooses LN locktime delta = 432
https://github.com/spesmilo/electrum/blob/71255c1e735cdfcd881e045b9f2f6bc6b599f459/electrum/submarine_swaps.py#L907
- for client-reverse-swaps, we have
- "cltv safety requirement: (onchain_locktime < LN_locktime), otherwise server is vulnerable"
- server chooses onchain locktime delta = 70
https://github.com/spesmilo/electrum/blob/71255c1e735cdfcd881e045b9f2f6bc6b599f459/electrum/submarine_swaps.py#L598
- server chooses LN locktime delta: unset, i.e. our default of 147
https://github.com/spesmilo/electrum/blob/71255c1e735cdfcd881e045b9f2f6bc6b599f459/electrum/submarine_swaps.py#L612
https://github.com/spesmilo/electrum/blob/71255c1e735cdfcd881e045b9f2f6bc6b599f459/electrum/lnworker.py#L2273
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit adds an extra safety check in Electrum's submarine-swap feature to make sure the on-chain refund deadline is earlier than the Lightning Network payment deadline. The commit message says this was already implicitly guaranteed by other checks, and the code change just makes it explicit. It also adds clarifying comments about Lightning invoice expiry handling and payment bundles. There is no direct evidence that a real vulnerability was exploitable before this change.

Recommended action

Treat as a defensive hardening patch. Reviewers should verify that the new explicit check correctly captures the intended safety invariant and that MIN_LOCKTIME_DELTA provides adequate mining margin. No urgent response appears necessary based on the supplied materials.

Security signals we found

01

Explicit CLTV safety check added for submarine swaps

02

Commit message describes the check as already implicitly enforced

03

Clarifying comments added around invoice expiry and payment bundle behavior

04

No CVE, advisory, or researcher attribution present in commit materials

Risk score

Why this scored 29/100

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