Commit b8ee823
committed
Track HolderCommitmentTransaction in HolderFundingOutput
The `ChannelMonitor` and `OnchainTxHandler` have historically been tied
together, often tracking some of the same state twice. As we introduce
support for splices in the `ChannelMonitor`, we'd like to avoid leaking
some of those details to the `OnchainTxHandler`. Ultimately, the
`OnchainTxHandler` should stand on its own and support claiming funds
from multiple `ChannelMonitor`s, allowing us to save on fees by batching
aggregatable claims across multiple in-flight closing channels.
Once splices are supported, we may run into cases where we are
attempting to claim an output from a specific `FundingScope`, while also
having an additional pending `FundingScope` for a splice. If the pending
splice confirms over the output claim, we need to cancel the claim and
re-offer it with the set of relevant parameters in the new
`FundingScope`.
This commit tracks the `HolderCommitmentTransaction` for the specific
`FundingScope` the `HolderFundingOutput` claim originated from. This
allows us to remove the dependency on `OnchainTxHandler` when obtaining
the current `HolderCommitmentTransaction` and ensures any alternative
commitment transaction state due to splicing does not leak into the
`OnchainTxHandler`. As a result, we can now include all the information
required to emit a `BumpTransactionEvent::ChannelClose` within its
intermediate representation `ClaimEvent::BumpCommitment`, as opposed to
relying on the `ChannelMonitor` to provide it.
Along the way, this commit also fixes a bug where
`BumpTransactionEvent::ChannelClose` could be emitted with an unsigned
commitment transaction, resulting in the child transaction not being
broadcastable due to a non-existent ancestor. This isn't a huge deal as
we have retry logic for such claims; once the signer returns a valid
signature, the event is re-emitted properly.1 parent 6f6ce44 commit b8ee823
File tree
3 files changed
+94
-55
lines changed- lightning/src/chain
3 files changed
+94
-55
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3278 | 3278 | | |
3279 | 3279 | | |
3280 | 3280 | | |
| 3281 | + | |
3281 | 3282 | | |
3282 | 3283 | | |
3283 | 3284 | | |
| |||
3530 | 3531 | | |
3531 | 3532 | | |
3532 | 3533 | | |
3533 | | - | |
| 3534 | + | |
| 3535 | + | |
3534 | 3536 | | |
3535 | 3537 | | |
3536 | 3538 | | |
3537 | 3539 | | |
3538 | | - | |
3539 | | - | |
3540 | | - | |
3541 | | - | |
3542 | | - | |
3543 | 3540 | | |
3544 | 3541 | | |
3545 | 3542 | | |
| |||
3550 | 3547 | | |
3551 | 3548 | | |
3552 | 3549 | | |
3553 | | - | |
| 3550 | + | |
3554 | 3551 | | |
3555 | 3552 | | |
3556 | 3553 | | |
3557 | 3554 | | |
3558 | 3555 | | |
3559 | 3556 | | |
3560 | 3557 | | |
3561 | | - | |
| 3558 | + | |
3562 | 3559 | | |
3563 | 3560 | | |
3564 | 3561 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
| 197 | + | |
196 | 198 | | |
197 | 199 | | |
198 | 200 | | |
| |||
641 | 643 | | |
642 | 644 | | |
643 | 645 | | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
| 646 | + | |
648 | 647 | | |
649 | | - | |
| 648 | + | |
| 649 | + | |
650 | 650 | | |
| 651 | + | |
651 | 652 | | |
652 | 653 | | |
653 | 654 | | |
654 | 655 | | |
655 | | - | |
656 | | - | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
657 | 668 | | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
658 | 680 | | |
659 | 681 | | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
670 | 690 | | |
671 | 691 | | |
672 | 692 | | |
673 | 693 | | |
674 | | - | |
| 694 | + | |
675 | 695 | | |
676 | 696 | | |
677 | 697 | | |
| |||
681 | 701 | | |
682 | 702 | | |
683 | 703 | | |
684 | | - | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
685 | 707 | | |
686 | 708 | | |
687 | 709 | | |
| |||
690 | 712 | | |
691 | 713 | | |
692 | 714 | | |
693 | | - | |
| 715 | + | |
694 | 716 | | |
695 | 717 | | |
696 | 718 | | |
| |||
1193 | 1215 | | |
1194 | 1216 | | |
1195 | 1217 | | |
1196 | | - | |
1197 | | - | |
1198 | | - | |
1199 | | - | |
1200 | | - | |
1201 | | - | |
1202 | | - | |
1203 | | - | |
1204 | | - | |
1205 | | - | |
1206 | | - | |
1207 | 1218 | | |
1208 | 1219 | | |
1209 | 1220 | | |
| |||
1410 | 1421 | | |
1411 | 1422 | | |
1412 | 1423 | | |
1413 | | - | |
| 1424 | + | |
1414 | 1425 | | |
1415 | 1426 | | |
1416 | 1427 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
440 | 442 | | |
441 | 443 | | |
442 | 444 | | |
443 | | - | |
| 445 | + | |
444 | 446 | | |
| 447 | + | |
445 | 448 | | |
446 | 449 | | |
447 | 450 | | |
448 | 451 | | |
449 | | - | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
450 | 456 | | |
451 | 457 | | |
452 | | - | |
| 458 | + | |
453 | 459 | | |
| 460 | + | |
454 | 461 | | |
455 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
456 | 480 | | |
457 | 481 | | |
458 | 482 | | |
| |||
462 | 486 | | |
463 | 487 | | |
464 | 488 | | |
465 | | - | |
| 489 | + | |
| 490 | + | |
466 | 491 | | |
467 | 492 | | |
468 | 493 | | |
| |||
473 | 498 | | |
474 | 499 | | |
475 | 500 | | |
476 | | - | |
| 501 | + | |
| 502 | + | |
477 | 503 | | |
478 | 504 | | |
479 | 505 | | |
480 | 506 | | |
481 | 507 | | |
482 | | - | |
| 508 | + | |
| 509 | + | |
483 | 510 | | |
484 | 511 | | |
485 | 512 | | |
486 | 513 | | |
487 | 514 | | |
488 | 515 | | |
489 | 516 | | |
490 | | - | |
| 517 | + | |
| 518 | + | |
491 | 519 | | |
492 | 520 | | |
493 | 521 | | |
| |||
519 | 547 | | |
520 | 548 | | |
521 | 549 | | |
522 | | - | |
| 550 | + | |
523 | 551 | | |
524 | 552 | | |
525 | 553 | | |
| |||
716 | 744 | | |
717 | 745 | | |
718 | 746 | | |
719 | | - | |
| 747 | + | |
720 | 748 | | |
721 | 749 | | |
722 | 750 | | |
| |||
1406 | 1434 | | |
1407 | 1435 | | |
1408 | 1436 | | |
1409 | | - | |
| 1437 | + | |
1410 | 1438 | | |
1411 | 1439 | | |
1412 | 1440 | | |
| |||
1508 | 1536 | | |
1509 | 1537 | | |
1510 | 1538 | | |
1511 | | - | |
1512 | | - | |
1513 | | - | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
1514 | 1545 | | |
1515 | 1546 | | |
1516 | 1547 | | |
| |||
0 commit comments