itest: simple taproot channel status

This commit is contained in:
Slyghtning 2023-10-10 19:54:26 +02:00 committed by Olaoluwa Osuntokun
parent 20e731b636
commit 12f23d2352
No known key found for this signature in database
GPG Key ID: 3BBD59E99B280306
2 changed files with 58 additions and 0 deletions

View File

@ -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,

View File

@ -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)
}