Commit 8c7aaa5
committed
Implement dual funding (#368)
In this PR, we change the funding flow to use dual-funding
(see spec here: lightning/bolts#851)
We completely remove the previous funding flow, as dual
funding is a super-set of it.
A few notes:
- we implicitly move existing channels to use a 1% reserve
(for the side that does have a reserve): this is ok since this
is already the setting used by Phoenix
- we support restoring unconfirmed channels that used the
single-funded flow: there won't be any backwards compat
issue for existing users
- we change the zero-conf behavior to directly go to the
WaitingForFundingLocked state without using a hacky
depth-0 watch
- we currently don't detect when an unconfirmed channel
will never confirm because the funding candidates have
been double-spent: such channels will stay stuck in the
WaitingForFundingConfirmed state1 parent e797ea4 commit 8c7aaa5
File tree
71 files changed
+3692
-3136
lines changed- src
- commonMain/kotlin/fr/acinq/lightning
- blockchain
- electrum
- fee
- channel
- io
- serialization
- v1
- v2
- v3
- wire
- commonTest/kotlin/fr/acinq/lightning
- blockchain/electrum
- channel
- states
- crypto
- io/peer
- payment
- serialization
- tests
- io/peer
- transactions
- wire
- jvmTest/kotlin/fr/acinq/lightning
- db/sqlite
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
71 files changed
+3692
-3136
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
115 | 122 | | |
116 | 123 | | |
117 | 124 | | |
| |||
290 | 297 | | |
291 | 298 | | |
292 | 299 | | |
| 300 | + | |
293 | 301 | | |
294 | 302 | | |
295 | 303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | 59 | | |
62 | 60 | | |
63 | 61 | | |
| |||
95 | 93 | | |
96 | 94 | | |
97 | 95 | | |
98 | | - | |
99 | | - | |
100 | 96 | | |
101 | 97 | | |
102 | 98 | | |
| |||
122 | 118 | | |
123 | 119 | | |
124 | 120 | | |
| 121 | + | |
125 | 122 | | |
126 | 123 | | |
127 | 124 | | |
Lines changed: 4 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
8 | 6 | | |
9 | 7 | | |
10 | | - | |
11 | 8 | | |
12 | 9 | | |
13 | | - | |
14 | | - | |
15 | 10 | | |
16 | 11 | | |
17 | 12 | | |
18 | | - | |
19 | 13 | | |
20 | 14 | | |
21 | 15 | | |
| |||
45 | 39 | | |
46 | 40 | | |
47 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
48 | 46 | | |
49 | 47 | | |
50 | 48 | | |
| |||
75 | 73 | | |
76 | 74 | | |
77 | 75 | | |
78 | | - | |
79 | | - | |
80 | 76 | | |
81 | 77 | | |
82 | 78 | | |
| |||
87 | 83 | | |
88 | 84 | | |
89 | 85 | | |
90 | | - | |
91 | | - | |
92 | 86 | | |
93 | 87 | | |
94 | 88 | | |
| |||
Lines changed: 33 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
53 | 57 | | |
54 | 58 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| |||
72 | 76 | | |
73 | 77 | | |
74 | 78 | | |
75 | | - | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| |||
Lines changed: 19 additions & 60 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | | - | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
| |||
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
24 | | - | |
25 | 22 | | |
26 | 23 | | |
27 | 24 | | |
| |||
85 | 82 | | |
86 | 83 | | |
87 | 84 | | |
88 | | - | |
| 85 | + | |
89 | 86 | | |
90 | 87 | | |
91 | 88 | | |
| |||
194 | 191 | | |
195 | 192 | | |
196 | 193 | | |
197 | | - | |
198 | | - | |
199 | | - | |
| 194 | + | |
200 | 195 | | |
201 | 196 | | |
202 | 197 | | |
| |||
207 | 202 | | |
208 | 203 | | |
209 | 204 | | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
230 | 208 | | |
231 | 209 | | |
232 | | - | |
| 210 | + | |
233 | 211 | | |
234 | 212 | | |
235 | 213 | | |
236 | 214 | | |
237 | 215 | | |
238 | 216 | | |
239 | 217 | | |
240 | | - | |
| 218 | + | |
241 | 219 | | |
242 | 220 | | |
243 | 221 | | |
| |||
279 | 257 | | |
280 | 258 | | |
281 | 259 | | |
282 | | - | |
| 260 | + | |
283 | 261 | | |
284 | 262 | | |
285 | 263 | | |
| |||
364 | 342 | | |
365 | 343 | | |
366 | 344 | | |
367 | | - | |
368 | 345 | | |
369 | 346 | | |
370 | 347 | | |
371 | 348 | | |
372 | 349 | | |
373 | 350 | | |
374 | | - | |
375 | | - | |
376 | | - | |
| 351 | + | |
377 | 352 | | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
388 | 361 | | |
389 | 362 | | |
390 | 363 | | |
| |||
532 | 505 | | |
533 | 506 | | |
534 | 507 | | |
535 | | - | |
| 508 | + | |
536 | 509 | | |
537 | 510 | | |
538 | 511 | | |
| |||
609 | 582 | | |
610 | 583 | | |
611 | 584 | | |
612 | | - | |
| 585 | + | |
613 | 586 | | |
614 | 587 | | |
615 | 588 | | |
| |||
622 | 595 | | |
623 | 596 | | |
624 | 597 | | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | 598 | | |
640 | 599 | | |
641 | 600 | | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| 41 | + | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| |||
53 | 57 | | |
54 | 58 | | |
55 | 59 | | |
| 60 | + | |
| 61 | + | |
56 | 62 | | |
57 | 63 | | |
58 | 64 | | |
| |||
0 commit comments