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

Function local_routing_failure

lightningd/pay.c:409–437  ·  view source on GitHub ↗

Return a struct routing_failure for a local failure allocated * from the given context. */

Source from the content-addressed store, hash-verified

407/* Return a struct routing_failure for a local failure allocated
408 * from the given context. */
409static struct routing_failure*
410local_routing_failure(const tal_t *ctx,
411 const struct lightningd *ld,
412 enum onion_wire failcode,
413 const struct wallet_payment *payment)
414{
415 struct routing_failure *routing_failure;
416
417 routing_failure = tal(ctx, struct routing_failure);
418 routing_failure->erring_index = 0;
419 routing_failure->failcode = failcode;
420
421 routing_failure->erring_node =
422 tal_dup(routing_failure, struct node_id, &ld->our_nodeid);
423
424 if (payment->route_nodes != NULL && payment->route_channels != NULL) {
425 routing_failure->erring_channel =
426 tal_dup(routing_failure, struct short_channel_id,
427 &payment->route_channels[0]);
428 routing_failure->channel_dir =
429 node_id_idx(&ld->our_nodeid, &payment->route_nodes[0]);
430 } else {
431 routing_failure->erring_channel = NULL;
432 }
433
434 routing_failure->msg = NULL;
435
436 return routing_failure;
437}
438
439/* Fills in *pay_errcode with PAY_TRY_OTHER_ROUTE or PAY_DESTINATION_PERM_FAIL */
440static struct routing_failure*

Callers 1

payment_failedFunction · 0.85

Calls 1

node_id_idxFunction · 0.85

Tested by

no test coverage detected