Skip to content

Commit e4c40f1

Browse files
committed
itest: update testSweepCommitOutputAndAnchor
1 parent 97030a5 commit e4c40f1

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

itest/lnd_sweep_test.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,8 +1224,8 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
12241224
// 4. Alice force closes the channel.
12251225
//
12261226
// 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.
12291229
// 2. Bob would also sweep his anchor and to_local outputs separately due to
12301230
// they have different deadline heights, which means only the to_local
12311231
// sweeping tx will succeed as the anchor sweeping is not economical.
@@ -1241,10 +1241,15 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
12411241
// config.
12421242
deadline := uint32(1000)
12431243

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.
12481253
deadlineA := deadline + 1
12491254

12501255
// deadlineB is the deadline used for Bob, the actual deadline used by
@@ -1267,6 +1272,11 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
12671272
// conf target is the deadline.
12681273
ht.SetFeeEstimateWithConf(startFeeRate, deadlineB)
12691274

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+
12701280
// toLocalCSV is the CSV delay for Alice's to_local output. We use a
12711281
// small value to save us from mining blocks.
12721282
//

0 commit comments

Comments
 (0)