@@ -715,30 +715,24 @@ func testRevokedCloseRetributionRemoteHodl(ht *lntest.HarnessTest) {
715715// asserts that Willy responds by broadcasting the justice transaction on
716716// Carol's behalf sweeping her funds without a reward.
717717func testRevokedCloseRetributionAltruistWatchtower (ht * lntest.HarnessTest ) {
718- testCases := []struct {
719- name string
720- anchors bool
721- }{{
722- name : "anchors" ,
723- anchors : true ,
724- }, {
725- name : "legacy" ,
726- anchors : false ,
727- }}
728-
729- for _ , tc := range testCases {
730- tc := tc
718+ for _ , commitType := range []lnrpc.CommitmentType {
719+ lnrpc .CommitmentType_LEGACY ,
720+ lnrpc .CommitmentType_ANCHORS ,
721+ lnrpc .CommitmentType_SIMPLE_TAPROOT ,
722+ } {
723+ testName := fmt .Sprintf ("%v" , commitType .String ())
724+ ct := commitType
731725 testFunc := func (ht * lntest.HarnessTest ) {
732726 testRevokedCloseRetributionAltruistWatchtowerCase (
733- ht , tc . anchors ,
727+ ht , ct ,
734728 )
735729 }
736730
737- success := ht .Run (tc . name , func (tt * testing.T ) {
731+ success := ht .Run (testName , func (tt * testing.T ) {
738732 st := ht .Subtest (tt )
739733
740734 st .RunTestCase (& lntest.TestCase {
741- Name : tc . name ,
735+ Name : testName ,
742736 TestFunc : testFunc ,
743737 })
744738 })
@@ -756,7 +750,7 @@ func testRevokedCloseRetributionAltruistWatchtower(ht *lntest.HarnessTest) {
756750}
757751
758752func testRevokedCloseRetributionAltruistWatchtowerCase (ht * lntest.HarnessTest ,
759- anchors bool ) {
753+ commitType lnrpc. CommitmentType ) {
760754
761755 const (
762756 chanAmt = funding .MaxBtcFundingAmount
@@ -767,18 +761,19 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(ht *lntest.HarnessTest,
767761
768762 // Since we'd like to test some multi-hop failure scenarios, we'll
769763 // introduce another node into our test network: Carol.
770- carolArgs := []string {"--hodl.exit-settle" }
771- if anchors {
772- carolArgs = append (carolArgs , "--protocol.anchors" )
773- }
764+ carolArgs := lntest .NodeArgsForCommitType (commitType )
765+ carolArgs = append (carolArgs , "--hodl.exit-settle" )
766+
774767 carol := ht .NewNode ("Carol" , carolArgs )
775768
776769 // Willy the watchtower will protect Dave from Carol's breach. He will
777770 // remain online in order to punish Carol on Dave's behalf, since the
778771 // breach will happen while Dave is offline.
779772 willy := ht .NewNode (
780- "Willy" , []string {"--watchtower.active" ,
781- "--watchtower.externalip=" + externalIP },
773+ "Willy" , []string {
774+ "--watchtower.active" ,
775+ "--watchtower.externalip=" + externalIP ,
776+ },
782777 )
783778
784779 willyInfo := willy .RPC .GetInfoWatchtower ()
@@ -801,13 +796,8 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(ht *lntest.HarnessTest,
801796 // Dave will be the breached party. We set --nolisten to ensure Carol
802797 // won't be able to connect to him and trigger the channel data
803798 // protection logic automatically.
804- daveArgs := []string {
805- "--nolisten" ,
806- "--wtclient.active" ,
807- }
808- if anchors {
809- daveArgs = append (daveArgs , "--protocol.anchors" )
810- }
799+ daveArgs := lntest .NodeArgsForCommitType (commitType )
800+ daveArgs = append (daveArgs , "--nolisten" , "--wtclient.active" )
811801 dave := ht .NewNode ("Dave" , daveArgs )
812802
813803 addTowerReq := & wtclientrpc.AddTowerRequest {
@@ -833,8 +823,10 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(ht *lntest.HarnessTest,
833823 // closure by Carol, we'll first open up a channel between them with a
834824 // 0.5 BTC value.
835825 params := lntest.OpenChannelParams {
836- Amt : 3 * (chanAmt / 4 ),
837- PushAmt : chanAmt / 4 ,
826+ Amt : 3 * (chanAmt / 4 ),
827+ PushAmt : chanAmt / 4 ,
828+ CommitmentType : commitType ,
829+ Private : true ,
838830 }
839831 chanPoint := ht .OpenChannel (dave , carol , params )
840832
@@ -956,7 +948,7 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(ht *lntest.HarnessTest,
956948 willyBalResp := willy .RPC .WalletBalance ()
957949
958950 if willyBalResp .ConfirmedBalance != 0 {
959- return fmt .Errorf ("Expected Willy to have no funds " +
951+ return fmt .Errorf ("expected Willy to have no funds " +
960952 "after justice transaction was mined, found %v" ,
961953 willyBalResp )
962954 }
@@ -994,7 +986,7 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(ht *lntest.HarnessTest,
994986 ht .AssertNumPendingForceClose (dave , 0 )
995987
996988 // If this is an anchor channel, Dave would sweep the anchor.
997- if anchors {
989+ if lntest . CommitTypeHasAnchors ( commitType ) {
998990 ht .MineBlocksAndAssertNumTxes (1 , 1 )
999991 }
1000992
0 commit comments