Commit e95ebf8
committed
Properly handle funding key rotation during splices
When splicing, we're required by protocol to retain all the
existing keys material except the funding key which we're allowed
to rotate. In the original implementation we acknowledged that but
figured we'd stick with a single `pubkey` method in the
`ChannelSigner` anyway cause adding a specific method for it is
annoying.
Sadly, this was ultimately broken - in `FundingScope::for_splice`,
we called the signer's `new_pubkeys` method (renamed from `pubkeys`
after splicing initially landed), replacing all of the public keys
the `Channel` would use rather than just the funding key. This can
result in commitment signature mismatches if the signer changes any
keys aside from the funding one.
`InMemorySigner` did not do so, however, so we didn't notice the
bug. Luckily-ish, in 189b8ac we
started generating a fresh `remote_key` when splicing (at least
when upgrading from 0.1 to 0.2 or when setting `KeysManager` to use
v1 `remote_key` derivation). This breaks splicing cause we can't
communicate the new `remote_key` to the counterparty during the
splicing handshake.
Ultimately this bug is because the API we had didn't communicate to
the signer that we weren't allowed to change anything except the
funding key, and allowed returning a `ChannelPublicKeys` which
would break the channel.
Here we fix this by renaming `new_pubkeys` `pubkeys` again
(partially reverting 9d291e0 but
keeping the changed requirements that `pubkeys` only be called
once) and adding a new `ChannelSigner:new_funding_pubkey` method
specifically for splicing.
We also update `channel.rs` to correctly fetch the new funding
pubkey before sending `splice_init`, storing it in the
`PendingFunding` untl we build a `FundingScope`.1 parent b84ad65 commit e95ebf8
File tree
7 files changed
+112
-76
lines changed- lightning/src
- chain
- ln
- sign
- util
7 files changed
+112
-76
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7009 | 7009 | | |
7010 | 7010 | | |
7011 | 7011 | | |
7012 | | - | |
| 7012 | + | |
7013 | 7013 | | |
7014 | 7014 | | |
7015 | 7015 | | |
| |||
7272 | 7272 | | |
7273 | 7273 | | |
7274 | 7274 | | |
7275 | | - | |
| 7275 | + | |
7276 | 7276 | | |
7277 | 7277 | | |
7278 | 7278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1339 | 1339 | | |
1340 | 1340 | | |
1341 | 1341 | | |
1342 | | - | |
| 1342 | + | |
1343 | 1343 | | |
1344 | 1344 | | |
1345 | 1345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1018 | 1018 | | |
1019 | 1019 | | |
1020 | 1020 | | |
1021 | | - | |
| 1021 | + | |
1022 | 1022 | | |
1023 | 1023 | | |
1024 | 1024 | | |
1025 | | - | |
| 1025 | + | |
1026 | 1026 | | |
1027 | 1027 | | |
1028 | 1028 | | |
| |||
2245 | 2245 | | |
2246 | 2246 | | |
2247 | 2247 | | |
2248 | | - | |
2249 | | - | |
| 2248 | + | |
| 2249 | + | |
2250 | 2250 | | |
2251 | 2251 | | |
2252 | 2252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2470 | 2470 | | |
2471 | 2471 | | |
2472 | 2472 | | |
| 2473 | + | |
2473 | 2474 | | |
2474 | 2475 | | |
2475 | 2476 | | |
| |||
2489 | 2490 | | |
2490 | 2491 | | |
2491 | 2492 | | |
2492 | | - | |
2493 | | - | |
2494 | | - | |
2495 | | - | |
2496 | 2493 | | |
2497 | 2494 | | |
2498 | | - | |
| 2495 | + | |
2499 | 2496 | | |
2500 | 2497 | | |
2501 | 2498 | | |
2502 | 2499 | | |
2503 | 2500 | | |
2504 | | - | |
| 2501 | + | |
2505 | 2502 | | |
2506 | 2503 | | |
2507 | 2504 | | |
| |||
2637 | 2634 | | |
2638 | 2635 | | |
2639 | 2636 | | |
| 2637 | + | |
2640 | 2638 | | |
2641 | 2639 | | |
2642 | 2640 | | |
| |||
2667 | 2665 | | |
2668 | 2666 | | |
2669 | 2667 | | |
2670 | | - | |
| 2668 | + | |
2671 | 2669 | | |
2672 | 2670 | | |
2673 | 2671 | | |
| |||
3510 | 3508 | | |
3511 | 3509 | | |
3512 | 3510 | | |
3513 | | - | |
| 3511 | + | |
3514 | 3512 | | |
3515 | 3513 | | |
3516 | 3514 | | |
| |||
3748 | 3746 | | |
3749 | 3747 | | |
3750 | 3748 | | |
3751 | | - | |
| 3749 | + | |
3752 | 3750 | | |
3753 | 3751 | | |
3754 | 3752 | | |
| |||
4111 | 4109 | | |
4112 | 4110 | | |
4113 | 4111 | | |
4114 | | - | |
4115 | | - | |
4116 | | - | |
4117 | | - | |
4118 | | - | |
4119 | | - | |
4120 | | - | |
4121 | | - | |
4122 | | - | |
4123 | | - | |
4124 | 4112 | | |
4125 | 4113 | | |
4126 | 4114 | | |
| |||
6891 | 6879 | | |
6892 | 6880 | | |
6893 | 6881 | | |
6894 | | - | |
| 6882 | + | |
6895 | 6883 | | |
6896 | 6884 | | |
6897 | 6885 | | |
| |||
11962 | 11950 | | |
11963 | 11951 | | |
11964 | 11952 | | |
| 11953 | + | |
| 11954 | + | |
| 11955 | + | |
| 11956 | + | |
| 11957 | + | |
| 11958 | + | |
| 11959 | + | |
| 11960 | + | |
| 11961 | + | |
| 11962 | + | |
| 11963 | + | |
| 11964 | + | |
| 11965 | + | |
| 11966 | + | |
| 11967 | + | |
| 11968 | + | |
11965 | 11969 | | |
11966 | | - | |
| 11970 | + | |
11967 | 11971 | | |
11968 | 11972 | | |
11969 | 11973 | | |
11970 | 11974 | | |
11971 | 11975 | | |
11972 | | - | |
11973 | | - | |
11974 | | - | |
11975 | | - | |
11976 | 11976 | | |
11977 | 11977 | | |
11978 | 11978 | | |
| |||
12056 | 12056 | | |
12057 | 12057 | | |
12058 | 12058 | | |
| 12059 | + | |
| 12060 | + | |
| 12061 | + | |
| 12062 | + | |
| 12063 | + | |
| 12064 | + | |
| 12065 | + | |
| 12066 | + | |
| 12067 | + | |
| 12068 | + | |
| 12069 | + | |
| 12070 | + | |
| 12071 | + | |
| 12072 | + | |
| 12073 | + | |
| 12074 | + | |
12059 | 12075 | | |
12060 | 12076 | | |
12061 | 12077 | | |
12062 | 12078 | | |
12063 | 12079 | | |
12064 | 12080 | | |
| 12081 | + | |
12065 | 12082 | | |
12066 | 12083 | | |
12067 | 12084 | | |
| |||
12206 | 12223 | | |
12207 | 12224 | | |
12208 | 12225 | | |
12209 | | - | |
12210 | | - | |
| 12226 | + | |
12211 | 12227 | | |
12212 | 12228 | | |
12213 | 12229 | | |
| |||
12221 | 12237 | | |
12222 | 12238 | | |
12223 | 12239 | | |
12224 | | - | |
| 12240 | + | |
12225 | 12241 | | |
12226 | 12242 | | |
12227 | 12243 | | |
| |||
12247 | 12263 | | |
12248 | 12264 | | |
12249 | 12265 | | |
12250 | | - | |
12251 | | - | |
12252 | | - | |
12253 | | - | |
12254 | | - | |
12255 | | - | |
12256 | | - | |
| 12266 | + | |
| 12267 | + | |
| 12268 | + | |
| 12269 | + | |
| 12270 | + | |
| 12271 | + | |
| 12272 | + | |
| 12273 | + | |
12257 | 12274 | | |
12258 | 12275 | | |
12259 | 12276 | | |
| |||
12284 | 12301 | | |
12285 | 12302 | | |
12286 | 12303 | | |
12287 | | - | |
| 12304 | + | |
12288 | 12305 | | |
12289 | 12306 | | |
12290 | | - | |
| 12307 | + | |
| 12308 | + | |
| 12309 | + | |
12291 | 12310 | | |
12292 | 12311 | | |
12293 | | - | |
| 12312 | + | |
| 12313 | + | |
| 12314 | + | |
12294 | 12315 | | |
12295 | 12316 | | |
12296 | 12317 | | |
| |||
12309 | 12330 | | |
12310 | 12331 | | |
12311 | 12332 | | |
| 12333 | + | |
| 12334 | + | |
| 12335 | + | |
12312 | 12336 | | |
12313 | 12337 | | |
12314 | 12338 | | |
12315 | 12339 | | |
12316 | 12340 | | |
12317 | 12341 | | |
| 12342 | + | |
12318 | 12343 | | |
12319 | 12344 | | |
12320 | 12345 | | |
| |||
16475 | 16500 | | |
16476 | 16501 | | |
16477 | 16502 | | |
16478 | | - | |
| 16503 | + | |
16479 | 16504 | | |
16480 | 16505 | | |
16481 | 16506 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
| 275 | + | |
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
| 280 | + | |
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
| 295 | + | |
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| |||
792 | 792 | | |
793 | 793 | | |
794 | 794 | | |
795 | | - | |
796 | | - | |
797 | | - | |
798 | | - | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
799 | 798 | | |
800 | | - | |
801 | | - | |
802 | | - | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
803 | 809 | | |
804 | 810 | | |
805 | | - | |
806 | | - | |
807 | | - | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
808 | 814 | | |
809 | 815 | | |
810 | 816 | | |
| |||
1457 | 1463 | | |
1458 | 1464 | | |
1459 | 1465 | | |
1460 | | - | |
1461 | | - | |
1462 | | - | |
| 1466 | + | |
1463 | 1467 | | |
1464 | 1468 | | |
1465 | | - | |
1466 | | - | |
1467 | 1469 | | |
1468 | | - | |
| 1470 | + | |
1469 | 1471 | | |
1470 | | - | |
| 1472 | + | |
1471 | 1473 | | |
1472 | 1474 | | |
1473 | 1475 | | |
| |||
1477 | 1479 | | |
1478 | 1480 | | |
1479 | 1481 | | |
1480 | | - | |
1481 | | - | |
1482 | | - | |
1483 | | - | |
1484 | 1482 | | |
1485 | 1483 | | |
1486 | 1484 | | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
1487 | 1491 | | |
1488 | 1492 | | |
1489 | 1493 | | |
| |||
0 commit comments