Return a struct routing_failure for a local failure allocated * from the given context. */
| 377 | /* Return a struct routing_failure for a local failure allocated |
| 378 | * from the given context. */ |
| 379 | static struct routing_failure* |
| 380 | local_routing_failure(const tal_t *ctx, |
| 381 | const struct lightningd *ld, |
| 382 | const struct htlc_out *hout, |
| 383 | enum onion_wire failcode, |
| 384 | const struct wallet_payment *payment) |
| 385 | { |
| 386 | struct routing_failure *routing_failure; |
| 387 | |
| 388 | routing_failure = tal(ctx, struct routing_failure); |
| 389 | routing_failure->erring_index = 0; |
| 390 | routing_failure->failcode = failcode; |
| 391 | |
| 392 | routing_failure->erring_node = |
| 393 | tal_dup(routing_failure, struct node_id, &ld->id); |
| 394 | |
| 395 | if (payment->route_nodes != NULL && payment->route_channels != NULL) { |
| 396 | routing_failure->erring_channel = |
| 397 | tal_dup(routing_failure, struct short_channel_id, |
| 398 | &payment->route_channels[0]); |
| 399 | routing_failure->channel_dir = |
| 400 | node_id_idx(&ld->id, &payment->route_nodes[0]); |
| 401 | } else { |
| 402 | routing_failure->erring_channel = NULL; |
| 403 | } |
| 404 | |
| 405 | routing_failure->msg = NULL; |
| 406 | |
| 407 | log_debug(hout->key.channel->log, "local_routing_failure: %u (%s)", |
| 408 | routing_failure->failcode, |
| 409 | onion_wire_name(routing_failure->failcode)); |
| 410 | return routing_failure; |
| 411 | } |
| 412 | |
| 413 | /* Fills in *pay_errcode with PAY_TRY_OTHER_ROUTE or PAY_DESTINATION_PERM_FAIL */ |
| 414 | static struct routing_failure* |
no test coverage detected