offers: add final node's CLTV delta in when creating blinded path payinfo.

It should probably be renamed "minimum_cltv_delta" or something.

Fixes: https://github.com/ElementsProject/lightning/issues/7179
Reported-by: @carlaKC
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-05-14 21:15:57 +09:30 committed by Alex Myers
parent 8b5bf716a8
commit 121403b5df
2 changed files with 9 additions and 3 deletions

View file

@ -439,7 +439,7 @@ static struct command_result *listincoming_done(struct command *cmd,
ir->inv->invoice_blindedpay[0] = tal(ir->inv->invoice_blindedpay, struct blinded_payinfo);
ir->inv->invoice_blindedpay[0]->fee_base_msat = best->feebase;
ir->inv->invoice_blindedpay[0]->fee_proportional_millionths = best->feeppm;
ir->inv->invoice_blindedpay[0]->cltv_expiry_delta = best->cltv;
ir->inv->invoice_blindedpay[0]->cltv_expiry_delta = best->cltv + cltv_final;
ir->inv->invoice_blindedpay[0]->htlc_minimum_msat = best->htlc_min;
ir->inv->invoice_blindedpay[0]->htlc_maximum_msat = best->htlc_max;
ir->inv->invoice_blindedpay[0]->features = NULL;

View file

@ -5608,8 +5608,10 @@ def test_pay_partial_msat(node_factory, executor):
def test_blindedpath_privchan(node_factory, bitcoind):
l1, l2 = node_factory.line_graph(2, wait_for_announce=True, opts={'experimental-offers': None})
l3 = node_factory.get_node(options={'experimental-offers': None})
l1, l2 = node_factory.line_graph(2, wait_for_announce=True,
opts={'experimental-offers': None})
l3 = node_factory.get_node(options={'experimental-offers': None,
'cltv-final': 120})
# Private channel.
node_factory.join_nodes([l2, l3], announce_channels=False)
@ -5624,6 +5626,10 @@ def test_blindedpath_privchan(node_factory, bitcoind):
assert len(decode['invoice_paths']) == 1
assert decode['invoice_paths'][0]['first_node_id'] == l2.info['id']
# Carla points out that the path's cltv_expiry_delta *includes*
# the final node's final value.
assert decode['invoice_paths'][0]['payinfo']['cltv_expiry_delta'] == l3.config('cltv-final') + l2.config('cltv-delta')
l1.rpc.pay(inv['invoice'])