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

renepay: refactor and bugfixes

Public commit record

What the developer wrote

Authored by Lagrang3

70/100 · Adequate
renepay: refactor and bugfixes

We remove the auxiliary RPC renesenday (only used internally) in favor
of a function that builds the onion, stores the shared secrets
needed to recover the onion reply, and calls sendonion/injectpaymentonion.

This solves a concurrency race
```
**BROKEN** plugin-cln-renepay: Unable to parse sendpay_failure
```
in which we are waiting for renesenday to return in order to record the shared
secrets but we get the a sendpay_failure notification with an onionreply
before we have secrets to decode it.

It also solves a missing JSON id seen in the logs
```
DEBUG plugin-cln-renepay: JSON reply with unknown id
```
because renesendpay was using his command variable to issue an RPC
to sendonion/injecpaymentonion and would fail or succeed the command
before those RPCs were done. This also meant that the callback
functions were silently being ignored.

Changelog-Fixed: renepay: fixes a race condition that leads to **BROKEN** plugin-cln-renepay: Unable to parse sendpay_failure

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
✓ Descriptive subject✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit fixes a timing bug in Core Lightning's experimental 'renepay' payment plugin. Previously, the plugin used an internal helper command (renesendpay) to send payment routes. Because of the way commands were chained, the plugin could receive a failure notification with an encrypted onion reply before it had saved the secrets needed to decode that reply. That caused error messages and could prevent the plugin from correctly learning why a payment failed. The fix builds the onion and stores the shared secrets directly before calling sendonion/injectpaymentonion, removing the race condition.

Recommended action

Apply the patch. After deployment, monitor renepay logs for the previously observed 'Unable to parse sendpay_failure' and 'JSON reply with unknown id' messages to confirm the race is resolved. No immediate incident response is indicated beyond normal update testing.

Security signals we found

01

Race condition between asynchronous sendpay_failure notifications and shared-secret availability

02

Loss or delayed handling of payment failure feedback due to RPC command lifecycle mismanagement

03

Plugin error logs indicating inability to decrypt/parse onion failure replies

04

Refactor of internal payment command flow to remove auxiliary RPC and capture secrets synchronously before send

Risk score

Why this scored 47/100

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