mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-23 22:46:40 +01:00
itest: flatten and fix testWatchtower
This commit is contained in:
parent
b7feeba008
commit
9c0c373b7e
2 changed files with 25 additions and 30 deletions
|
@ -550,10 +550,6 @@ var allTestCases = []*lntest.TestCase{
|
|||
Name: "lookup htlc resolution",
|
||||
TestFunc: testLookupHtlcResolution,
|
||||
},
|
||||
{
|
||||
Name: "watchtower",
|
||||
TestFunc: testWatchtower,
|
||||
},
|
||||
{
|
||||
Name: "channel fundmax",
|
||||
TestFunc: testChannelFundMax,
|
||||
|
@ -695,4 +691,5 @@ var allTestCases = []*lntest.TestCase{
|
|||
func init() {
|
||||
// Register subtests.
|
||||
allTestCases = append(allTestCases, multiHopForceCloseTestCases...)
|
||||
allTestCases = append(allTestCases, watchtowerTestCases...)
|
||||
}
|
||||
|
|
|
@ -19,22 +19,21 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// testWatchtower tests the behaviour of the watchtower client and server.
|
||||
func testWatchtower(ht *lntest.HarnessTest) {
|
||||
ht.Run("revocation", func(t *testing.T) {
|
||||
tt := ht.Subtest(t)
|
||||
testRevokedCloseRetributionAltruistWatchtower(tt)
|
||||
})
|
||||
|
||||
ht.Run("session deletion", func(t *testing.T) {
|
||||
tt := ht.Subtest(t)
|
||||
testTowerClientSessionDeletion(tt)
|
||||
})
|
||||
|
||||
ht.Run("tower and session activation", func(t *testing.T) {
|
||||
tt := ht.Subtest(t)
|
||||
testTowerClientTowerAndSessionManagement(tt)
|
||||
})
|
||||
// watchtowerTestCases defines a set of tests to check the behaviour of the
|
||||
// watchtower client and server.
|
||||
var watchtowerTestCases = []*lntest.TestCase{
|
||||
{
|
||||
Name: "watchtower revoked close retribution altruist",
|
||||
TestFunc: testRevokedCloseRetributionAltruistWatchtower,
|
||||
},
|
||||
{
|
||||
Name: "watchtower client session deletion",
|
||||
TestFunc: testTowerClientSessionDeletion,
|
||||
},
|
||||
{
|
||||
Name: "watchtower client tower and session management",
|
||||
TestFunc: testTowerClientTowerAndSessionManagement,
|
||||
},
|
||||
}
|
||||
|
||||
// testTowerClientTowerAndSessionManagement tests the various control commands
|
||||
|
@ -565,6 +564,15 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(ht *lntest.HarnessTest,
|
|||
// then been swept to his wallet by Willy.
|
||||
require.NoError(ht, restart(), "unable to restart dave")
|
||||
|
||||
// For neutrino backend, we may need to mine one more block to trigger
|
||||
// the chain watcher to act.
|
||||
//
|
||||
// TODO(yy): remove it once the blockbeat remembers the last block
|
||||
// processed.
|
||||
if ht.IsNeutrinoBackend() {
|
||||
ht.MineEmptyBlocks(1)
|
||||
}
|
||||
|
||||
err = wait.NoError(func() error {
|
||||
daveBalResp := dave.RPC.ChannelBalance()
|
||||
if daveBalResp.LocalBalance.Sat != 0 {
|
||||
|
@ -579,16 +587,6 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(ht *lntest.HarnessTest,
|
|||
|
||||
ht.AssertNumPendingForceClose(dave, 0)
|
||||
|
||||
// If this is an anchor channel, Dave would offer his sweeper the
|
||||
// anchor. However, due to no time-sensitive outputs involved, the
|
||||
// anchor sweeping won't happen as it's uneconomical.
|
||||
if lntest.CommitTypeHasAnchors(commitType) {
|
||||
ht.AssertNumPendingSweeps(dave, 1)
|
||||
|
||||
// Mine a block to trigger the sweep.
|
||||
ht.MineEmptyBlocks(1)
|
||||
}
|
||||
|
||||
// Check that Dave's wallet balance is increased.
|
||||
err = wait.NoError(func() error {
|
||||
daveBalResp := dave.RPC.WalletBalance()
|
||||
|
|
Loading…
Add table
Reference in a new issue