Skip to content

Commit 83f57ac

Browse files
cdeckerrustyrussell
authored andcommitted
pay: Move the chanhint update up to payment_getroute
We were delaying the channel_hint update till after the `createonion` call which gave us the same situation we had with concurrent `getroute` calls. Now we update the hints as soon as the plugins have had their say in the route construction. If we still fail, either because a modifier changed the route causing the failure, or because we interleaved the route computation for multiple parts, we reset the attempt and retry inline (i.e., without creating a new sub-payment). Notice that interleaved route computations now only happen if the modifier makes an async call to some RPC or similar.
1 parent abad494 commit 83f57ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugins/libplugin-pay.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,8 +1364,6 @@ static struct command_result *payment_createonion_success(struct command *cmd,
13641364
struct route_hop *first = &p->route[0];
13651365
struct secret *secrets;
13661366

1367-
payment_chanhints_apply_route(p, false);
1368-
13691367
p->createonion_response = json_to_createonion_response(p, buffer, toks);
13701368

13711369
req = jsonrpc_request_start(p->plugin, NULL, "sendonion",
@@ -1486,6 +1484,8 @@ static void payment_compute_onion_payloads(struct payment *p)
14861484
p->step = PAYMENT_STEP_ONION_PAYLOAD;
14871485
hopcount = tal_count(p->route);
14881486

1487+
payment_chanhints_apply_route(p, false);
1488+
14891489
/* Now compute the payload we're about to pass to `createonion` */
14901490
cr = p->createonion_request = tal(p, struct createonion_request);
14911491
cr->assocdata = tal_arr(cr, u8, 0);

0 commit comments

Comments
 (0)