Onion TLV support (EXPERIMENTAL_FEATURE)#3167
Conversation
| wait_for(lambda: 'alias' in l1.rpc.listnodes(l3.info['id'])['nodes'][0]) | ||
|
|
||
| inv = l3.rpc.invoice(10000, "test_tlv3", "test_tlv3")['bolt11'] | ||
| print(inv) |
There was a problem hiding this comment.
probably can delete this
40e81d9 to
82a38a1
Compare
|
Rebased on top of #3245 |
5bb917e to
dcaf848
Compare
|
Back on top of master again... |
cdecker
left a comment
There was a problem hiding this comment.
Looking forward to seeing this merged :-)
| step->type = SPHINX_TLV_PAYLOAD; | ||
| } else { | ||
| step->type = SPHINX_INVALID_PAYLOAD; | ||
| return; |
There was a problem hiding this comment.
Good catch, the src[0] == 1 escape hatch got lost somewhere before.
| /* This should probably be removed, as it's just for testing */ | ||
| case SPHINX_RAW_PAYLOAD: | ||
| abort(); | ||
| } | ||
| abort(); |
There was a problem hiding this comment.
Yes, if you want I can clean it up since it also touches the onion-tool.
There was a problem hiding this comment.
The onion tool actually uses this to make an arbitrary raw payload, so we'll leave it for a bit longer.
| enum sphinx_payload_type type; | ||
| union { | ||
| struct hop_data_legacy v0; | ||
| struct tlv_tlv_payload *tlv; |
There was a problem hiding this comment.
Why not make this an instance of the struct tlv_tlv_payload instead of a pointer to it? The struct itself only consists of 3 pointers (fixed size) and we'd be saving 1 allocation.
There was a problem hiding this comment.
Our marshaling/unmarshaling really wants a pointer...
There was a problem hiding this comment.
Hm, ok, I should read the TLV implementation more carefully :-)
| /* FIXME: Generic realm support, not this hack! */ | ||
| /* FIXME: Multi hop! */ | ||
| /* /<hex> -> raw hopdata. /tlv -> TLV encoding. */ | ||
| if (argv[1 + i][klen] != '\0' && argv[1 + i][klen] != 't') { |
There was a problem hiding this comment.
This seems to undo some of the fixes from #3250 (https://github.com/ElementsProject/lightning/pull/3250/files#diff-6ba0afe5becbb580348286dbd8ca2b5cR63). Which version is the correct one?
There was a problem hiding this comment.
I've just rebased again on master, which fixes this...
This highlights the various places we need to change. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We add routines to decode the expected fields from both legacy and tlv hop formats. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-changed: JSON API: `htlc_accepted` hook has `type` (currently `legacy` or `tlv`) and other fields directly inside `onion`. Changelog-deprecated: JSON API: `htlc_accepted` hook `per_hop_v0` object deprecated, as is `short_channel_id` for the final hop.
We keep the feature bitmap on disk, so we cache this in the struct explicitly. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
There's only one caller. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Default is legacy. If we have future styles, new strings can be defined, but for now it's "tlv" or "legacy". Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
For legacy, they were the same, but for TLV we care whether it's the final hop or not. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This means we can make sphinx_add_v0_hop static, too. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
dcaf848 to
ed0b575
Compare
|
ACK ed0b575 |
No description provided.