| 542 | } |
| 543 | |
| 544 | static struct command_result *do_getroutes(struct command *cmd, |
| 545 | struct gossmap_localmods *localmods, |
| 546 | struct getroutes_info *info) |
| 547 | { |
| 548 | struct askrene *askrene = get_askrene(cmd->plugin); |
| 549 | const struct gossmap_node *me; |
| 550 | bool include_fees; |
| 551 | const char *err; |
| 552 | struct timemono deadline; |
| 553 | int replyfds[2], logfds[2]; |
| 554 | struct router_child *child; |
| 555 | const struct layer **layers; |
| 556 | s8 *biases; |
| 557 | fp16_t *capacities; |
| 558 | bool include_next_node_id, include_amount_msat, include_delay; |
| 559 | |
| 560 | /* update the gossmap */ |
| 561 | if (gossmap_refresh(askrene->gossmap)) { |
| 562 | /* FIXME: gossmap_refresh callbacks to we can update in place */ |
| 563 | tal_free(askrene->capacities); |
| 564 | askrene->capacities = |
| 565 | get_capacities(askrene, askrene->plugin, askrene->gossmap); |
| 566 | } |
| 567 | |
| 568 | capacities = tal_dup_talarr(cmd, fp16_t, askrene->capacities); |
| 569 | |
| 570 | /* We also eliminate any local channels we *know* are dying. |
| 571 | * Most channels get 12 blocks grace in case it's a splice, |
| 572 | * but if it's us, we know about the splice already. */ |
| 573 | me = gossmap_find_node(askrene->gossmap, &askrene->my_id); |
| 574 | if (me) { |
| 575 | for (size_t i = 0; i < me->num_chans; i++) { |
| 576 | struct short_channel_id_dir scidd; |
| 577 | const struct gossmap_chan *c = gossmap_nth_chan(askrene->gossmap, |
| 578 | me, i, NULL); |
| 579 | if (!gossmap_chan_is_dying(askrene->gossmap, c)) |
| 580 | continue; |
| 581 | |
| 582 | scidd.scid = gossmap_chan_scid(askrene->gossmap, c); |
| 583 | /* Disable both directions */ |
| 584 | for (scidd.dir = 0; scidd.dir < 2; scidd.dir++) { |
| 585 | bool enabled = false; |
| 586 | gossmap_local_updatechan(localmods, |
| 587 | &scidd, |
| 588 | &enabled, |
| 589 | NULL, NULL, NULL, NULL, NULL); |
| 590 | } |
| 591 | } |
| 592 | } |
| 593 | |
| 594 | /* auto.no_mpp_support layer forces maxparts == 1. */ |
| 595 | if (have_layer(info->layers, "auto.no_mpp_support")) { |
| 596 | cmd_log(tmpctx, cmd, LOG_DBG, "Adding auto.no_mpp_support, sorry"); |
| 597 | info->maxparts = 1; |
| 598 | } |
| 599 | |
| 600 | /* apply selected layers to the localmods */ |
| 601 | layers = apply_layers(cmd, askrene, cmd, |
no test coverage detected