@@ -1224,8 +1224,8 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
1224
1224
// 4. Alice force closes the channel.
1225
1225
//
1226
1226
// Test:
1227
- // 1. Alice's anchor sweeping is not attempted, instead, it should be swept
1228
- // together with her to_local output using the no deadline path.
1227
+ // 1. Alice's CPFP- anchor sweeping is not attempted, instead, it should be
1228
+ // swept using the no deadline path and failed due it's not economical .
1229
1229
// 2. Bob would also sweep his anchor and to_local outputs separately due to
1230
1230
// they have different deadline heights, which means only the to_local
1231
1231
// sweeping tx will succeed as the anchor sweeping is not economical.
@@ -1241,10 +1241,15 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
1241
1241
// config.
1242
1242
deadline := uint32 (1000 )
1243
1243
1244
- // deadlineA is the deadline used for Alice, since her commit output is
1245
- // offered to the sweeper at CSV-1. With a deadline of 1000, her actual
1246
- // width of her fee func is CSV+1000-1. Given we are using a CSV of 2
1247
- // here, her fee func deadline then becomes 1001.
1244
+ // deadlineA is the deadline used for Alice, given that,
1245
+ // - the force close tx is broadcast at height 445, her inputs are
1246
+ // registered at the same height, so her to_local and anchor outputs
1247
+ // have a deadline height of 1445.
1248
+ // - the force close tx is mined at 446, which means her anchor output
1249
+ // now has a deadline delta of (1445-446) = 999 blocks.
1250
+ // - for her to_local output, with a deadline of 1000, the width of the
1251
+ // fee func is CSV+1000-1. Given we are using a CSV of 2 here, her fee
1252
+ // func deadline then becomes 1001.
1248
1253
deadlineA := deadline + 1
1249
1254
1250
1255
// deadlineB is the deadline used for Bob, the actual deadline used by
@@ -1267,6 +1272,11 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
1267
1272
// conf target is the deadline.
1268
1273
ht .SetFeeEstimateWithConf (startFeeRate , deadlineB )
1269
1274
1275
+ // Set up the starting fee for Alice's anchor sweeping. With this low
1276
+ // fee rate, her anchor sweeping should be attempted and failed due to
1277
+ // dust output generated in the sweeping tx.
1278
+ ht .SetFeeEstimateWithConf (startFeeRate , deadline - 1 )
1279
+
1270
1280
// toLocalCSV is the CSV delay for Alice's to_local output. We use a
1271
1281
// small value to save us from mining blocks.
1272
1282
//
@@ -1427,10 +1437,10 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
1427
1437
// With Alice's starting fee rate being validated, we now calculate her
1428
1438
// ending fee rate and fee rate delta.
1429
1439
//
1430
- // Alice sweeps two inputs - anchor and commit , so the starting budget
1431
- // should come from the sum of these two . However, due to the value
1432
- // being too large, the actual ending fee rate used should be the
1433
- // sweeper's max fee rate configured.
1440
+ // Alice sweeps the to_local input , so the starting budget should come
1441
+ // from the to_local balance . However, due to the value being too large,
1442
+ // the actual ending fee rate used should be the sweeper's max fee rate
1443
+ // configured.
1434
1444
aliceTxWeight := uint64 (ht .CalculateTxWeight (aliceSweepTx ))
1435
1445
aliceEndingFeeRate := sweep .DefaultMaxFeeRate .FeePerKWeight ()
1436
1446
aliceFeeRateDelta := (aliceEndingFeeRate - aliceStartingFeeRate ) /
@@ -1507,10 +1517,10 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
1507
1517
}
1508
1518
1509
1519
// We should see two txns in the mempool:
1510
- // - Alice's sweeping tx, which sweeps both her anchor and
1511
- // commit outputs, using the increased fee rate.
1512
- // - Bob's previous sweeping tx, which sweeps both his anchor
1513
- // and commit outputs, at the possible increased fee rate.
1520
+ // - Alice's sweeping tx, which sweeps her commit output, using
1521
+ // the increased fee rate.
1522
+ // - Bob's previous sweeping tx, which sweeps his commit output,
1523
+ // at the possible increased fee rate.
1514
1524
txns := ht .GetNumTxsFromMempool (2 )
1515
1525
1516
1526
// Assume the first tx is Alice's sweeping tx, if the second tx
@@ -1577,6 +1587,11 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
1577
1587
// Mine a block to confirm both sweeping txns, this is needed to clean
1578
1588
// up the mempool.
1579
1589
ht .MineBlocksAndAssertNumTxes (1 , 2 )
1590
+
1591
+ // Finally, assert that both Alice and Bob still have the anchor
1592
+ // outputs, which cannot be swept due to it being uneconomical.
1593
+ ht .AssertNumPendingSweeps (alice , 1 )
1594
+ ht .AssertNumPendingSweeps (bob , 1 )
1580
1595
}
1581
1596
1582
1597
// testBumpForceCloseFee tests that when a force close transaction, in
0 commit comments