Skip to content

Commit

Permalink
lightningd: return invalid_onon_blinding for any blinded payment error.
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Oct 26, 2022
1 parent 511e8e6 commit 426886f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
6 changes: 5 additions & 1 deletion lightningd/peer_htlcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ static void fail_in_htlc(struct htlc_in *hin,
htlc_in_check(hin, __func__);

#if EXPERIMENTAL_FEATURES
/* In a blinded path, all failures become invalid_onion_blinding */
/* BOLT-route-blinding #4:
* - If `blinding_point` is set in the incoming `update_add_htlc`:
* - MUST return `invalid_onion_blinding` on any error, including
* downstream errors received from forwarding HTLCs.
*/
if (hin->blinding) {
failed_htlc = mk_failed_htlc_badonion(tmpctx, hin,
WIRE_INVALID_ONION_BLINDING);
Expand Down
6 changes: 0 additions & 6 deletions plugins/libplugin-pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,9 +1222,7 @@ handle_final_failure(struct command *cmd,
case WIRE_PERMANENT_NODE_FAILURE:
case WIRE_TEMPORARY_NODE_FAILURE:
case WIRE_REQUIRED_NODE_FEATURE_MISSING:
#if EXPERIMENTAL_FEATURES
case WIRE_INVALID_ONION_BLINDING:
#endif
case WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS:
case WIRE_MPP_TIMEOUT:
goto error;
Expand Down Expand Up @@ -1325,9 +1323,7 @@ handle_intermediate_failure(struct command *cmd,
case WIRE_REQUIRED_NODE_FEATURE_MISSING:
case WIRE_INVALID_ONION_PAYLOAD:
case WIRE_INVALID_REALM:
#if EXPERIMENTAL_FEATURES
case WIRE_INVALID_ONION_BLINDING:
#endif
tal_arr_expand(&root->excluded_nodes, *errnode);
goto error;

Expand Down Expand Up @@ -2239,9 +2235,7 @@ static bool payment_can_retry(struct payment *p)
case WIRE_PERMANENT_CHANNEL_FAILURE:
case WIRE_REQUIRED_CHANNEL_FEATURE_MISSING:
case WIRE_TEMPORARY_CHANNEL_FAILURE:
#if EXPERIMENTAL_FEATURES
case WIRE_INVALID_ONION_BLINDING:
#endif
return true;
}

Expand Down
8 changes: 8 additions & 0 deletions wire/extracted_onion_05_route-blinding_error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--- wire/onion_wire.csv 2022-08-10 16:09:32.851789435 +0930
+++ wire/onion_wire.csv.raw 2022-08-10 16:18:47.411275132 +0930
@@ -95,3 +81,5 @@
msgdata,invalid_onion_payload,type,bigsize,
msgdata,invalid_onion_payload,offset,u16,
msgtype,mpp_timeout,23
+msgtype,invalid_onion_blinding,BADONION|PERM|24
+msgdata,invalid_onion_blinding,sha256_of_onion,sha256,
9 changes: 0 additions & 9 deletions wire/extracted_onion_exp_badonion_blinding.patch

This file was deleted.

2 changes: 2 additions & 0 deletions wire/onion_wire.csv
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,5 @@ msgtype,invalid_onion_payload,PERM|22
msgdata,invalid_onion_payload,type,bigsize,
msgdata,invalid_onion_payload,offset,u16,
msgtype,mpp_timeout,23
msgtype,invalid_onion_blinding,BADONION|PERM|24
msgdata,invalid_onion_blinding,sha256_of_onion,sha256,

0 comments on commit 426886f

Please sign in to comment.