diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index 50e3721812f0..3e23aa9328f8 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -1869,11 +1869,24 @@ static void payment_compute_onion_payloads(struct payment *p) /* If we're headed to a blinded path, connect that now. */ if (root->blindedpath) { + /* This final_cltv matches our payment heuristic of adding 1 block. */ + + /* BOLT #4: + * - For every node inside a blinded route: + *... + * - If it is the final node: + *... + * - The value set for `outgoing_cltv_value`: + * - MUST use the current block height as a baseline value. + * - if a [random offset](07-routing-gossip.md#recommendations-for-routing) was added to improve privacy: + * - SHOULD add the offset to the baseline value. + */ + u32 final_cltv = p->start_block + 1; payment_add_blindedpath(cr->hops, cr->hops + hopcount - 1, root->blindedpath, root->blindedouramount, root->blindedfinalamount, - root->blindedfinalcltv); + final_cltv); tal_append_fmt(&routetxt, "%s -> blinded path (%zu hops)", fmt_short_channel_id(tmpctx, p->route[hopcount-1].scid), diff --git a/plugins/libplugin-pay.h b/plugins/libplugin-pay.h index 7046f957340e..57310318efa0 100644 --- a/plugins/libplugin-pay.h +++ b/plugins/libplugin-pay.h @@ -197,7 +197,6 @@ struct payment { struct blinded_payinfo *blindedpay; struct amount_msat blindedouramount; struct amount_msat blindedfinalamount; - u32 blindedfinalcltv; u64 groupid; u32 partid; diff --git a/plugins/pay.c b/plugins/pay.c index aa6b1e4c37d4..dfd9bf692e38 100644 --- a/plugins/pay.c +++ b/plugins/pay.c @@ -1255,11 +1255,9 @@ static struct command_result *json_pay(struct command *cmd, /* We replace real final values if we're using a blinded path */ if (p->blindedpath) { - p->blindedfinalcltv = p->min_final_cltv_expiry; p->blindedouramount = p->our_amount; p->blindedfinalamount = p->final_amount; - p->min_final_cltv_expiry += p->blindedpay->cltv_expiry_delta; if (!amount_msat_add_fee(&p->final_amount, p->blindedpay->fee_base_msat, p->blindedpay->fee_proportional_millionths)