mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-26 01:33:02 +01:00
itest: simple taproot channel status
This commit is contained in:
parent
20e731b636
commit
12f23d2352
@ -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,
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user