Commit b409c7d
committed
lntest: make sure HTLCs are locked in when sending a payment
Before this change, CompletePaymentRequestsNoWait would return as
soon as the channel's NumUpdates increased by at least one. When
sending multiple payments, this meant the function could return
while some HTLCs were still in-flight and not yet committed to the
channel state.
The problem occurred when tests captured the channel state
immediately after calling this function. Even though we read the
current NumUpdates from the channel, HTLCs could still be in the
process of being committed. This led to a race where the channel
would progress to a new state after we thought we had correctly
captured it, causing tests to see unexpected commitment heights.
Fix this by waiting for all outgoing HTLCs to appear in
PendingHtlcs before returning. We count outgoing HTLCs before
sending, then wait until exactly len(paymentRequests) new HTLCs
are present. This guarantees all payments have fully completed
their commitment exchange and are locked in on both sides.
Fixes the flaky revokedCloseRetributionRemoteHodlCase test where
backups would capture state at height N+1 instead of the expected
height N.1 parent 91423ee commit b409c7d
1 file changed
Lines changed: 33 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1619 | 1619 | | |
1620 | 1620 | | |
1621 | 1621 | | |
1622 | | - | |
1623 | | - | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
1624 | 1625 | | |
1625 | 1626 | | |
1626 | 1627 | | |
| |||
1629 | 1630 | | |
1630 | 1631 | | |
1631 | 1632 | | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
1632 | 1643 | | |
1633 | 1644 | | |
1634 | 1645 | | |
1635 | 1646 | | |
1636 | 1647 | | |
1637 | | - | |
1638 | | - | |
1639 | | - | |
1640 | | - | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
1641 | 1652 | | |
1642 | 1653 | | |
1643 | 1654 | | |
1644 | | - | |
1645 | | - | |
1646 | | - | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
1647 | 1667 | | |
1648 | 1668 | | |
1649 | 1669 | | |
1650 | | - | |
1651 | | - | |
1652 | | - | |
1653 | | - | |
1654 | | - | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
1655 | 1673 | | |
1656 | | - | |
| 1674 | + | |
1657 | 1675 | | |
1658 | 1676 | | |
1659 | 1677 | | |
| |||
0 commit comments