Browse Source

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.
ppa-prep
Christian Decker 4 years ago
committed by Rusty Russell
parent
commit
83f57ac300
  1. 4
      plugins/libplugin-pay.c

4
plugins/libplugin-pay.c

@ -1364,8 +1364,6 @@ static struct command_result *payment_createonion_success(struct command *cmd,
struct route_hop *first = &p->route[0];
struct secret *secrets;
payment_chanhints_apply_route(p, false);
p->createonion_response = json_to_createonion_response(p, buffer, toks);
req = jsonrpc_request_start(p->plugin, NULL, "sendonion",
@ -1486,6 +1484,8 @@ static void payment_compute_onion_payloads(struct payment *p)
p->step = PAYMENT_STEP_ONION_PAYLOAD;
hopcount = tal_count(p->route);
payment_chanhints_apply_route(p, false);
/* Now compute the payload we're about to pass to `createonion` */
cr = p->createonion_request = tal(p, struct createonion_request);
cr->assocdata = tal_arr(cr, u8, 0);

Loading…
Cancel
Save