diff --git a/lightningd/pay.c b/lightningd/pay.c index b483884328e1..73ea1903028a 100644 --- a/lightningd/pay.c +++ b/lightningd/pay.c @@ -16,6 +16,7 @@ #include #include #include +#include #include /* Routing failure object */ @@ -778,7 +779,7 @@ static const u8 *send_onion(const tal_t *ctx, struct lightningd *ld, return send_htlc_out(ctx, channel, first_hop->amount, base_expiry + first_hop->delay, final_amount, payment_hash, - blinding, partid, groupid, onion, NULL, hout); + blinding, partid, groupid, onion, NULL, hout, false /*endorsed*/); } static struct command_result *check_invoice_request_usage(struct command *cmd, diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index ebbaa869e2dd..b2cae3483a4f 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -605,7 +605,8 @@ const u8 *send_htlc_out(const tal_t *ctx, u64 groupid, const u8 *onion_routing_packet, struct htlc_in *in, - struct htlc_out **houtp) + struct htlc_out **houtp, + bool endorsed) { u8 *msg; @@ -646,6 +647,7 @@ const u8 *send_htlc_out(const tal_t *ctx, *houtp); } + // FIXME: add the `endorsed` variable here msg = towire_channeld_offer_htlc(out, amount, cltv, payment_hash, onion_routing_packet, blinding); subd_req(out->peer->ld, out->owner, take(msg), -1, 0, rcvd_htlc_reply, @@ -700,7 +702,8 @@ static void forward_htlc(struct htlc_in *hin, const struct short_channel_id *forward_scid, const struct channel_id *forward_to, const u8 next_onion[TOTAL_PACKET_SIZE(ROUTING_INFO_SIZE)], - const struct pubkey *next_blinding) + const struct pubkey *next_blinding, + const bool endorsed) { const u8 *failmsg; struct lightningd *ld = hin->key.channel->peer->ld; @@ -811,7 +814,7 @@ static void forward_htlc(struct htlc_in *hin, outgoing_cltv_value, AMOUNT_MSAT(0), &hin->payment_hash, next_blinding, 0 /* partid */, 0 /* groupid */, - next_onion, hin, &hout); + next_onion, hin, &hout, endorsed); if (!failmsg) return; @@ -1144,7 +1147,7 @@ htlc_accepted_hook_final(struct htlc_accepted_hook_payload *request STEALS) request->payload->forward_channel, request->fwd_channel_id, serialize_onionpacket(tmpctx, rs->next), - request->next_blinding); + request->next_blinding, false /*endorsed*/); } else handle_localpay(hin, request->payload->amt_to_forward, @@ -1184,6 +1187,7 @@ static bool ecdh_maybe_blinding(const struct pubkey *ephemeral_key, return true; } +// FIXME: this is the way to implement the hook REGISTER_PLUGIN_HOOK(htlc_accepted, htlc_accepted_hook_deserialize, htlc_accepted_hook_final, diff --git a/lightningd/peer_htlcs.h b/lightningd/peer_htlcs.h index db41ccada2e8..18593310d8ba 100644 --- a/lightningd/peer_htlcs.h +++ b/lightningd/peer_htlcs.h @@ -50,7 +50,8 @@ const u8 *send_htlc_out(const tal_t *ctx, u64 groupid, const u8 *onion_routing_packet, struct htlc_in *in, - struct htlc_out **houtp); + struct htlc_out **houtp, + bool endorsed); void onchain_failed_our_htlc(const struct channel *channel, const struct htlc_stub *htlc,