itest: adapt itest for the new anchor behavior.
Now we also register anchors when no HTLCs are at stake.
This commit is contained in:
1 file changed
+13
-5
+13
-5
@@ -73,9 +73,11 @@ func testSweepCPFPAnchorOutgoingTimeout(ht *lntest.HarnessTest) {
|
|||||||
htlcBudget := htlcValue.MulF64(contractcourt.DefaultBudgetRatio)
|
htlcBudget := htlcValue.MulF64(contractcourt.DefaultBudgetRatio)
|
||||||
|
|
||||||
// cpfpBudget is the budget used to sweep the CPFP anchor.
|
// cpfpBudget is the budget used to sweep the CPFP anchor.
|
||||||
|
// In addition to the htlc amount to protect we also need to include
|
||||||
|
// the anchor amount itself for the budget.
|
||||||
cpfpBudget := (htlcValue - htlcBudget).MulF64(
|
cpfpBudget := (htlcValue - htlcBudget).MulF64(
|
||||||
contractcourt.DefaultBudgetRatio,
|
contractcourt.DefaultBudgetRatio,
|
||||||
)
|
) + contractcourt.AnchorOutputValue
|
||||||
|
|
||||||
// Create a preimage, that will be held by Carol.
|
// Create a preimage, that will be held by Carol.
|
||||||
var preimage lntypes.Preimage
|
var preimage lntypes.Preimage
|
||||||
@@ -488,9 +490,11 @@ func testSweepCPFPAnchorIncomingTimeout(ht *lntest.HarnessTest) {
|
|||||||
htlcBudget := htlcValue.MulF64(contractcourt.DefaultBudgetRatio)
|
htlcBudget := htlcValue.MulF64(contractcourt.DefaultBudgetRatio)
|
||||||
|
|
||||||
// cpfpBudget is the budget used to sweep the CPFP anchor.
|
// cpfpBudget is the budget used to sweep the CPFP anchor.
|
||||||
|
// In addition to the htlc amount to protect we also need to include
|
||||||
|
// the anchor amount itself for the budget.
|
||||||
cpfpBudget := (htlcValue - htlcBudget).MulF64(
|
cpfpBudget := (htlcValue - htlcBudget).MulF64(
|
||||||
contractcourt.DefaultBudgetRatio,
|
contractcourt.DefaultBudgetRatio,
|
||||||
)
|
) + contractcourt.AnchorOutputValue
|
||||||
|
|
||||||
// Carol should have one incoming HTLC on channel Bob -> Carol.
|
// Carol should have one incoming HTLC on channel Bob -> Carol.
|
||||||
ht.AssertIncomingHTLCActive(carol, bcChanPoint, payHash[:])
|
ht.AssertIncomingHTLCActive(carol, bcChanPoint, payHash[:])
|
||||||
@@ -1342,9 +1346,13 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
|
|||||||
// PendingChannels RPC under the waiting close section.
|
// PendingChannels RPC under the waiting close section.
|
||||||
ht.AssertChannelWaitingClose(alice, chanPoint)
|
ht.AssertChannelWaitingClose(alice, chanPoint)
|
||||||
|
|
||||||
// We should see neither Alice or Bob has any pending sweeps as there
|
// Alice should see 2 anchor sweeps for the local and remote commitment.
|
||||||
// are no time-sensitive HTLCs.
|
// Even without HTLCs at stake the anchors are registered with the
|
||||||
ht.AssertNumPendingSweeps(alice, 0)
|
// sweeper subsytem.
|
||||||
|
ht.AssertNumPendingSweeps(alice, 2)
|
||||||
|
|
||||||
|
// Bob did not force close the channel therefore he should have no
|
||||||
|
// pending sweeps.
|
||||||
ht.AssertNumPendingSweeps(bob, 0)
|
ht.AssertNumPendingSweeps(bob, 0)
|
||||||
|
|
||||||
// Mine a block to confirm Alice's force closing tx. Once it's
|
// Mine a block to confirm Alice's force closing tx. Once it's
|
||||||
|
|||||||
Reference in new issue
Block a user