From 12f23d2352d1fe4e6e4ec64af30ab25abcb1619f Mon Sep 17 00:00:00 2001
From: Slyghtning <hieblmi@protonmail.com>
Date: Tue, 10 Oct 2023 19:54:26 +0200
Subject: [PATCH] itest: simple taproot channel status

---
 itest/list_on_test.go          |  4 +++
 itest/lnd_open_channel_test.go | 54 ++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git a/itest/list_on_test.go b/itest/list_on_test.go
index 0674d646b..9b1499bd8 100644
--- a/itest/list_on_test.go
+++ b/itest/list_on_test.go
@@ -462,6 +462,10 @@ var allTestCases = []*lntest.TestCase{
 		Name:     "taproot",
 		TestFunc: testTaproot,
 	},
+	{
+		Name:     "simple taproot channel activation",
+		TestFunc: testSimpleTaprootChannelActivation,
+	},
 	{
 		Name:     "wallet import account",
 		TestFunc: testWalletImportAccount,
diff --git a/itest/lnd_open_channel_test.go b/itest/lnd_open_channel_test.go
index 674d9a62b..d8cf66485 100644
--- a/itest/lnd_open_channel_test.go
+++ b/itest/lnd_open_channel_test.go
@@ -768,3 +768,57 @@ func testFundingExpiryBlocksOnPending(ht *lntest.HarnessTest) {
 	chanPoint := lntest.ChanPointFromPendingUpdate(update)
 	ht.CloseChannel(alice, chanPoint)
 }
+
+// testSimpleTaprootChannelActivation ensures that a simple taproot channel is
+// active if the initiator disconnects and reconnects in between channel opening
+// and channel confirmation.
+func testSimpleTaprootChannelActivation(ht *lntest.HarnessTest) {
+	simpleTaprootChanArgs := lntest.NodeArgsForCommitType(
+		lnrpc.CommitmentType_SIMPLE_TAPROOT,
+	)
+
+	// Make the new set of participants.
+	alice := ht.NewNode("alice", simpleTaprootChanArgs)
+	defer ht.Shutdown(alice)
+	bob := ht.NewNode("bob", simpleTaprootChanArgs)
+	defer ht.Shutdown(bob)
+
+	ht.FundCoins(btcutil.SatoshiPerBitcoin, alice)
+
+	// Make sure Alice and Bob are connected.
+	ht.EnsureConnected(alice, bob)
+
+	// Create simple taproot channel opening parameters.
+	params := lntest.OpenChannelParams{
+		FundMax:        true,
+		CommitmentType: lnrpc.CommitmentType_SIMPLE_TAPROOT,
+		Private:        true,
+	}
+
+	// Alice opens the channel to Bob.
+	pendingChan := ht.OpenChannelAssertPending(alice, bob, params)
+
+	// We'll create the channel point to be able to close the channel once
+	// our test is done.
+	chanPoint := &lnrpc.ChannelPoint{
+		FundingTxid: &lnrpc.ChannelPoint_FundingTxidBytes{
+			FundingTxidBytes: pendingChan.Txid,
+		},
+		OutputIndex: pendingChan.OutputIndex,
+	}
+
+	// We disconnect and reconnect Alice and Bob before the channel is
+	// confirmed. Our expectation is that the channel is active once the
+	// channel is confirmed.
+	ht.DisconnectNodes(alice, bob)
+	ht.EnsureConnected(alice, bob)
+
+	// Mine six blocks to confirm the channel funding transaction.
+	ht.MineBlocksAndAssertNumTxes(6, 1)
+
+	// Verify that Alice sees an active channel to Bob.
+	ht.AssertChannelActive(alice, chanPoint)
+
+	// Our test is done and Alice closes her channel to Bob.
+	ht.CloseChannel(alice, chanPoint)
+}