Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

offers: fix our blinded path setting in invoices #7311

Merged

Conversation

rustyrussell
Copy link
Contributor

@rustyrussell rustyrussell commented May 14, 2024

And fix pay to pay them properly too!

Thanks @carlaKC for the reports!
Closes: #7161
Closes: #7179

@rustyrussell rustyrussell added this to the v24.05 milestone May 14, 2024
Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 83cb66d

I pile my ACK on top of the #7304 where thsi PR is based

I think by the next few days I should be able to test the iterop with ldk by running https://github.com/vincenzopalazzo/lampo.rs/blob/main/tests/tests/src/lampo_cln_tests.rs#L372

Comment on lines +1232 to +1234
rpc_scan(p, "getchaininfo",
take(json_out_obj(NULL, "last_height", "0")),
"{headercount:%}", JSON_SCAN(json_to_u32, &blockheight));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bloody hell! good catch!

struct tlv_encrypted_data_tlv_payment_relay *payment_relay,
struct tlv_encrypted_data_tlv_payment_constraints *payment_constraints,
u8 *path_secret,
struct pubkey *node_alias)
{
struct tlv_encrypted_data_tlv *tlv = tlv_encrypted_data_tlv_new(tmpctx);

tlv->short_channel_id = next_scid;
tlv->next_node_id = cast_const(struct pubkey *, next_node_id);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know about this cast_const, ccan is like the std that C should have

@endothermicdev
Copy link
Collaborator

trivial bolt quote and spelling fixup

This demonstrates a number of issues reported by Carla: no surprise
since there was no test!

(We create a one-hop blinded path when we only have private channels).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
At plugin startup, we don't have an accurate blockheight and can get 0!

Fixes: ElementsProject#7161
Reported-by: @carlaKC
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Without this, it was broken because our peer will no longer forward
via scids for private channels.  We could use the scid alias, but the
node id is right at hand.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…info.

It should probably be renamed "minimum_cltv_delta" or something.

Fixes: ElementsProject#7179
Reported-by: @carlaKC
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
The spec has moved a bit here: the `outgoing_cltv_value` in the final onion
is basically the blockheight now (plus the 1 block delta we give ourselves).

Also, we were doubling ours, since p->min_final_cltv_expiry was already set
to p->blindedpay->cltv_expiry_delta above.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@rustyrussell
Copy link
Contributor Author

Trivial rebase after other merges

Copy link
Collaborator

@endothermicdev endothermicdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 2f7d79e

offer = l3.rpc.offer(1000, 'test_pay_blindedpath_privchan')
l1.rpc.decode(offer['bolt12'])

inv = l2.rpc.fetchinvoice(offer['bolt12'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does l2 fetch rather than l1?

@endothermicdev endothermicdev merged commit 3c48438 into ElementsProject:master May 15, 2024
27 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants