Commit deb94b6
committed
multi: Support custom size onion packets
Onion messages allow for payloads that exceed 1300 bytes, in which case
the payload should become 32768 bytes. This commit introduces support
for those custom size packets and the tests for this feature.
NewOnionPacket now allows for a final variadic argument payloadSizes.
The sizes passed are then compared to the actual payload size of the
entire path, and the first value that fits the actual payload size will
then be used as the size of the routing info. We use this to fix the
size of onion messages at 1300 or 32768 bytes as suggested by BOLT-0004
but it can be used to fix the size at any value. If no values are passed
the func defaults to MaxRoutingPayloadSize.
MaxRoutingPayloadSize and MaxOnionMessagePayloadSize are exposed to
facilitate easy usage of this library.
sphinx_test now has a helper function to create onion messages of a
specified length. This helper is then used to test the handling of
packets larger than 1300 bytes specifically for onion messages.1 parent 75327ca commit deb94b6
File tree
5 files changed
+487
-76
lines changed- cmd
5 files changed
+487
-76
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
73 | 80 | | |
74 | 81 | | |
75 | 82 | | |
| |||
203 | 210 | | |
204 | 211 | | |
205 | 212 | | |
| 213 | + | |
206 | 214 | | |
207 | 215 | | |
| 216 | + | |
208 | 217 | | |
209 | 218 | | |
210 | 219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
30 | 56 | | |
31 | 57 | | |
32 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | | - | |
| 59 | + | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
0 commit comments