* Callback when a plugin answers to the htlc_accepted hook */
| 1095 | * Callback when a plugin answers to the htlc_accepted hook |
| 1096 | */ |
| 1097 | static void |
| 1098 | htlc_accepted_hook_final(struct htlc_accepted_hook_payload *request STEALS) |
| 1099 | { |
| 1100 | struct route_step *rs = request->route_step; |
| 1101 | struct htlc_in *hin = request->hin; |
| 1102 | struct channel *channel = request->channel; |
| 1103 | |
| 1104 | request->hin->status = tal_free(request->hin->status); |
| 1105 | |
| 1106 | /* Hand the payload to the htlc_in since we'll want to have that info |
| 1107 | * handy for the hooks and notifications. */ |
| 1108 | request->hin->payload = tal_steal(request->hin, request->payload); |
| 1109 | |
| 1110 | /* *Now* we barf if it failed to decode */ |
| 1111 | if (!request->payload) { |
| 1112 | log_debug(channel->log, |
| 1113 | "Failing HTLC because of an invalid payload"); |
| 1114 | local_fail_in_htlc(hin, |
| 1115 | take(towire_invalid_onion_payload( |
| 1116 | NULL, request->failtlvtype, |
| 1117 | request->failtlvpos))); |
| 1118 | } else if (rs->nextcase == ONION_FORWARD) { |
| 1119 | forward_htlc(hin, hin->cltv_expiry, |
| 1120 | request->payload->amt_to_forward, |
| 1121 | request->payload->outgoing_cltv, |
| 1122 | request->payload->forward_channel, |
| 1123 | request->fwd_channel_id, |
| 1124 | serialize_onionpacket(tmpctx, rs->next), |
| 1125 | request->next_blinding); |
| 1126 | } else |
| 1127 | handle_localpay(hin, |
| 1128 | request->payload->amt_to_forward, |
| 1129 | request->payload->outgoing_cltv, |
| 1130 | *request->payload->total_msat, |
| 1131 | request->payload->payment_secret, |
| 1132 | request->payload->payment_metadata); |
| 1133 | |
| 1134 | tal_free(request); |
| 1135 | } |
| 1136 | |
| 1137 | /* Apply tweak to ephemeral key if blinding is non-NULL, then do ECDH */ |
| 1138 | static bool ecdh_maybe_blinding(const struct pubkey *ephemeral_key, |
nothing calls this directly
no test coverage detected