@@ -637,8 +637,8 @@ func runChanRestoreScenarioCommitTypes(ht *lntest.HarnessTest,
637
637
minerHeight := ht .CurrentHeight ()
638
638
thawHeight := minerHeight + thawHeightDelta
639
639
640
- fundingShim , _ = deriveFundingShim (
641
- ht , dave , carol , crs .params .Amt , thawHeight , true , ct ,
640
+ fundingShim , _ = ht . DeriveFundingShim (
641
+ dave , carol , crs .params .Amt , thawHeight , true , ct ,
642
642
)
643
643
crs .params .FundingShim = fundingShim
644
644
}
@@ -1320,12 +1320,20 @@ func testDataLossProtection(ht *lntest.HarnessTest) {
1320
1320
// information Dave needs to sweep his funds.
1321
1321
require .NoError (ht , restartDave (), "unable to restart Eve" )
1322
1322
1323
+ // Mine a block to trigger Dave's chain watcher to process Carol's sweep
1324
+ // tx.
1325
+ //
1326
+ // TODO(yy): remove this block once the blockbeat starts remembering
1327
+ // its last processed block and can handle looking for spends in the
1328
+ // past blocks.
1329
+ ht .MineEmptyBlocks (1 )
1330
+
1331
+ // Make sure Dave still has the pending force close channel.
1332
+ ht .AssertNumPendingForceClose (dave , 1 )
1333
+
1323
1334
// Dave should have a pending sweep.
1324
1335
ht .AssertNumPendingSweeps (dave , 1 )
1325
1336
1326
- // Mine a block to trigger the sweep.
1327
- ht .MineBlocks (1 )
1328
-
1329
1337
// Dave should sweep his funds.
1330
1338
ht .AssertNumTxsInMempool (1 )
1331
1339
@@ -1482,7 +1490,6 @@ func assertTimeLockSwept(ht *lntest.HarnessTest, carol, dave *node.HarnessNode,
1482
1490
expectedTxes := 1
1483
1491
1484
1492
// Mine a block to trigger the sweeps.
1485
- ht .MineBlocks (1 )
1486
1493
ht .AssertNumTxsInMempool (expectedTxes )
1487
1494
1488
1495
// Carol should consider the channel pending force close (since she is
@@ -1512,7 +1519,7 @@ func assertTimeLockSwept(ht *lntest.HarnessTest, carol, dave *node.HarnessNode,
1512
1519
// The commit sweep resolver publishes the sweep tx at defaultCSV-1 and
1513
1520
// we already mined one block after the commitment was published, and
1514
1521
// one block to trigger Carol's sweeps, so take that into account.
1515
- ht .MineEmptyBlocks ( 1 )
1522
+ ht .MineBlocks ( 2 )
1516
1523
ht .AssertNumPendingSweeps (dave , 2 )
1517
1524
1518
1525
// Mine a block to trigger the sweeps.
@@ -1615,8 +1622,6 @@ func assertDLPExecuted(ht *lntest.HarnessTest,
1615
1622
// output and the other for her anchor.
1616
1623
ht .AssertNumPendingSweeps (carol , 2 )
1617
1624
1618
- // Mine a block to trigger the sweep.
1619
- ht .MineEmptyBlocks (1 )
1620
1625
ht .MineBlocksAndAssertNumTxes (1 , 1 )
1621
1626
1622
1627
// Now the channel should be fully closed also from Carol's POV.
@@ -1635,8 +1640,6 @@ func assertDLPExecuted(ht *lntest.HarnessTest,
1635
1640
// output and the other for his anchor.
1636
1641
ht .AssertNumPendingSweeps (dave , 2 )
1637
1642
1638
- // Mine a block to trigger the sweep.
1639
- ht .MineEmptyBlocks (1 )
1640
1643
ht .MineBlocksAndAssertNumTxes (1 , 1 )
1641
1644
1642
1645
// Now Dave should consider the channel fully closed.
@@ -1652,10 +1655,6 @@ func assertDLPExecuted(ht *lntest.HarnessTest,
1652
1655
ht .AssertNumPendingSweeps (dave , 1 )
1653
1656
}
1654
1657
1655
- // Mine one block to trigger the sweeper to sweep.
1656
- ht .MineEmptyBlocks (1 )
1657
- blocksMined ++
1658
-
1659
1658
// Expect one tx - the commitment sweep from Dave. For anchor
1660
1659
// channels, we expect the two anchor sweeping txns to be
1661
1660
// failed due they are uneconomical.
@@ -1673,9 +1672,6 @@ func assertDLPExecuted(ht *lntest.HarnessTest,
1673
1672
// commitmment was published, so take that into account.
1674
1673
ht .MineEmptyBlocks (int (defaultCSV - blocksMined ))
1675
1674
1676
- // Mine one block to trigger the sweeper to sweep.
1677
- ht .MineEmptyBlocks (1 )
1678
-
1679
1675
// Carol should have two pending sweeps:
1680
1676
// 1. her commit output.
1681
1677
// 2. her anchor output, if this is anchor channel.
0 commit comments