MCPcopy Create free account
hub / github.com/ElementsProject/lightning / payment_chanhints_unapply_route

Function payment_chanhints_unapply_route

plugins/libplugin-pay.c:587–614  ·  view source on GitHub ↗

Undo route changes above */

Source from the content-addressed store, hash-verified

585
586/* Undo route changes above */
587static void payment_chanhints_unapply_route(struct payment *p)
588{
589 struct payment *root = payment_root(p);
590
591 for (size_t i = 0; i < tal_count(p->route); i++) {
592 struct route_hop *curhop;
593 struct channel_hint *curhint;
594
595 curhop = &p->route[i];
596 curhint = payment_chanhints_get(root, curhop);
597 if (!curhint)
598 continue;
599
600 /* Update the number of htlcs for any local
601 * channel in the route */
602 if (curhint->local)
603 curhint->local->htlc_budget++;
604
605 if (!amount_msat_accumulate(&curhint->estimated_capacity,
606 curhop->amount)) {
607 /* This should never happen, it'd mean
608 * that we unapply a route that would
609 * result in a msatoshi
610 * wrap-around. */
611 abort();
612 }
613 }
614}
615
616static const struct short_channel_id_dir *
617payment_get_excluded_channels(const tal_t *ctx, struct payment *p)

Callers 1

Calls 4

payment_rootFunction · 0.85
payment_chanhints_getFunction · 0.85
amount_msat_accumulateFunction · 0.85
abortFunction · 0.85

Tested by

no test coverage detected