From 8df5de3e438ea337194c80f095450ea6e1e9f03c Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Mon, 16 Jan 2023 07:28:23 +0800 Subject: [PATCH] lntest+itest: make sure mempool is cleaned in watcher tower test This commit adds the missing check for anchor sweep in test `revoked_uncooperative_close_retribution_altruist_watchtower`, also change the mempool check a bit so it's easier to track. --- lntemp/harness.go | 9 +++------ lntest/itest/lnd_revocation_test.go | 5 +++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lntemp/harness.go b/lntemp/harness.go index 1d0001d02..c8d4d8c0b 100644 --- a/lntemp/harness.go +++ b/lntemp/harness.go @@ -349,10 +349,6 @@ func (h *HarnessTest) Subtest(t *testing.T) *HarnessTest { return } - // We require the mempool to be cleaned from the test. - require.Empty(st, st.Miner.GetRawMempool(), "mempool not "+ - "cleaned, please mine blocks to clean them all.") - // When we finish the test, reset the nodes' configs and take a // snapshot of each of the nodes' internal states. for _, node := range st.manager.standbyNodes { @@ -362,8 +358,9 @@ func (h *HarnessTest) Subtest(t *testing.T) *HarnessTest { // If found running nodes, shut them down. st.shutdownNonStandbyNodes() - // Assert that mempool is cleaned - st.Miner.AssertNumTxsInMempool(0) + // We require the mempool to be cleaned from the test. + require.Empty(st, st.Miner.GetRawMempool(), "mempool not "+ + "cleaned, please mine blocks to clean them all.") // Finally, cancel the run context. We have to do it here // because we need to keep the context alive for the above diff --git a/lntest/itest/lnd_revocation_test.go b/lntest/itest/lnd_revocation_test.go index 20561c039..47da07f74 100644 --- a/lntest/itest/lnd_revocation_test.go +++ b/lntest/itest/lnd_revocation_test.go @@ -849,6 +849,11 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(ht *lntemp.HarnessTest, ht.AssertNumPendingForceClose(dave, 0) + // If this is an anchor channel, Dave would sweep the anchor. + if anchors { + ht.MineBlocksAndAssertNumTxes(1, 1) + } + // Check that Dave's wallet balance is increased. err = wait.NoError(func() error { daveBalResp := dave.RPC.WalletBalance()