| 677 | static void delayed_forward(struct delayed_forward *dfwd); |
| 678 | |
| 679 | static void forward_htlc(struct info *info, |
| 680 | struct fake_htlc *htlc, |
| 681 | struct amount_msat amount, |
| 682 | u32 cltv_expiry, |
| 683 | const u8 onion_routing_packet[TOTAL_PACKET_SIZE(ROUTING_INFO_SIZE)], |
| 684 | const struct pubkey *path_key, |
| 685 | const struct node_id *expected) |
| 686 | { |
| 687 | struct onion_payload *payload; |
| 688 | u8 *next_onion_packet; |
| 689 | struct gossmap_node *me; |
| 690 | struct secret shared_secret; |
| 691 | struct node_id next; |
| 692 | struct gossmap_chan *c; |
| 693 | struct short_channel_id_dir scidd; |
| 694 | struct amount_msat amt_expected, htlc_min, htlc_max; |
| 695 | struct pubkey *next_path_key; |
| 696 | struct oneshot *timer; |
| 697 | struct delayed_forward *dfwd; |
| 698 | unsigned int msec_delay; |
| 699 | |
| 700 | current_node = get_current_node(info, expected); |
| 701 | if (!current_node) { |
| 702 | status_failed(STATUS_FAIL_INTERNAL_ERROR, |
| 703 | "Could not find privkey for %s", |
| 704 | fmt_node_id(tmpctx, expected)); |
| 705 | } |
| 706 | |
| 707 | /* Decode, and figure out who I am */ |
| 708 | payload = decode_onion(tmpctx, |
| 709 | info, |
| 710 | onion_routing_packet, |
| 711 | path_key, |
| 712 | &htlc->payment_hash, |
| 713 | amount, cltv_expiry, |
| 714 | &next_onion_packet, |
| 715 | &shared_secret, |
| 716 | &me); |
| 717 | |
| 718 | tal_arr_expand(&htlc->secrets, shared_secret); |
| 719 | if (!next_onion_packet) { |
| 720 | if (cltv_expiry < payload->outgoing_cltv) { |
| 721 | fail(info, htlc, payload, |
| 722 | WIRE_FINAL_INCORRECT_CLTV_EXPIRY); |
| 723 | return; |
| 724 | } |
| 725 | if (cltv_expiry < info->current_block_height + 18) { |
| 726 | fail(info, htlc, payload, |
| 727 | WIRE_FINAL_INCORRECT_CLTV_EXPIRY); |
| 728 | return; |
| 729 | } |
| 730 | |
| 731 | /* MPP: consume htlc and payload */ |
| 732 | add_mpp(info, htlc, payload); |
| 733 | return; |
| 734 | } |
| 735 | |
| 736 | /* Find next node by channel or scid */ |
no test coverage detected