ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.82k stars 896 forks source link

sendpay_failure notifications missing important fields #7430

Open daywalker90 opened 3 months ago

daywalker90 commented 3 months ago

cln v24.05: apparently some fields are missing from sendpay_failure notifications:

sendpay_failure notification: {\"sendpay_failure\":{\"code\":204,\"message\":\"failed: WIRE_UNKNOWN_NEXT_PEER (reply from remote)\",\"data\":{\"created_index\":8398,\"id\":8398,\"payment_hash\":\"a6ac55c126b415f9236526fbb6e8c847db5dc1da94db148f85db512ca3dc0c82\",\"groupid\":2,\"partid\":1,\"destination\":\"03f060953bef5b777dc77e44afa3859d022fc1a77c55138deb232ad7255e869c00\",\"amount_msat\":5311800403,\"amount_sent_msat\":5311859832,\"created_at\":1719325305,\"status\":\"pending\",\"erring_index\":1,\"failcode\":16394,\"failcodename\":\"WIRE_UNKNOWN_NEXT_PEER\",\"raw_message\":\"400a\"}}}

missing:

Also notice how status is pending instead of failed as promised by the docs:

https://docs.corelightning.org/docs/event-notifications#sendpay_failure

This makes the notification far less useful and also causes a panic in cln-plugin because it expects these fields.

daywalker90 commented 3 months ago

also:

waitsendpay a6ac55c126b415f9236526fbb6e8c847db5dc1da94db148f85db512ca3dc0c82 10 1 2
{
   "code": 209,
   "message": "Payment failure reason unknown"
}

From the docs: 209: The payment already failed, but the reason for failure was not stored. This should only occur when querying failed payments on very old databases.

The payment was tried just now, so it's not old.

daywalker90 commented 3 months ago

This is not the case in all sendpay_failure notifications but it still causes cln-plugin to panic alot when theres a plugin subscribing to this notification.