Return a struct routing_failure for an immediate failure * (returned directly from send_htlc_out). The returned * failure is allocated from the given context. */
| 351 | * (returned directly from send_htlc_out). The returned |
| 352 | * failure is allocated from the given context. */ |
| 353 | static struct routing_failure* |
| 354 | immediate_routing_failure(const tal_t *ctx, |
| 355 | const struct lightningd *ld, |
| 356 | enum onion_wire failcode, |
| 357 | const struct short_channel_id *channel0, |
| 358 | const struct node_id *dstid) |
| 359 | { |
| 360 | struct routing_failure *routing_failure; |
| 361 | |
| 362 | assert(failcode); |
| 363 | |
| 364 | routing_failure = tal(ctx, struct routing_failure); |
| 365 | routing_failure->erring_index = 0; |
| 366 | routing_failure->failcode = failcode; |
| 367 | routing_failure->erring_node = |
| 368 | tal_dup(routing_failure, struct node_id, &ld->id); |
| 369 | routing_failure->erring_channel = |
| 370 | tal_dup(routing_failure, struct short_channel_id, channel0); |
| 371 | routing_failure->channel_dir = node_id_idx(&ld->id, dstid); |
| 372 | routing_failure->msg = NULL; |
| 373 | |
| 374 | return routing_failure; |
| 375 | } |
| 376 | |
| 377 | /* Return a struct routing_failure for a local failure allocated |
| 378 | * from the given context. */ |
no test coverage detected