From b837c889dc082ade322abd15b583a030a0feaa34 Mon Sep 17 00:00:00 2001 From: ziggie Date: Thu, 29 May 2025 10:16:22 +0200 Subject: [PATCH] itest: add disconnect test Add a connect/disconnect test when the peers both started up with the rbf coop close feature. --- itest/list_on_test.go | 4 ++++ itest/lnd_coop_close_rbf_test.go | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/itest/list_on_test.go b/itest/list_on_test.go index 7263b2451..5dacc0b1c 100644 --- a/itest/list_on_test.go +++ b/itest/list_on_test.go @@ -699,6 +699,10 @@ var allTestCases = []*lntest.TestCase{ Name: "rbf coop close", TestFunc: testCoopCloseRbf, }, + { + Name: "rbf coop close disconnect", + TestFunc: testRBFCoopCloseDisconnect, + }, { Name: "bump fee low budget", TestFunc: testBumpFeeLowBudget, diff --git a/itest/lnd_coop_close_rbf_test.go b/itest/lnd_coop_close_rbf_test.go index 870334648..5f8b15d40 100644 --- a/itest/lnd_coop_close_rbf_test.go +++ b/itest/lnd_coop_close_rbf_test.go @@ -131,3 +131,25 @@ func testCoopCloseRbf(ht *lntest.HarnessTest) { aliceClosingTxid := ht.WaitForChannelCloseEvent(aliceCloseStream) ht.AssertTxInBlock(block, aliceClosingTxid) } + +// testRBFCoopCloseDisconnect tests that when a node disconnects that the node +// is properly disconnected. +func testRBFCoopCloseDisconnect(ht *lntest.HarnessTest) { + rbfCoopFlags := []string{"--protocol.rbf-coop-close"} + + // To kick things off, we'll create two new nodes, then fund them with + // enough coins to make a 50/50 channel. + cfgs := [][]string{rbfCoopFlags, rbfCoopFlags} + params := lntest.OpenChannelParams{ + Amt: btcutil.Amount(1000000), + PushAmt: btcutil.Amount(1000000 / 2), + } + _, nodes := ht.CreateSimpleNetwork(cfgs, params) + alice, bob := nodes[0], nodes[1] + + // Make sure the nodes are connected. + ht.AssertConnected(alice, bob) + + // Disconnect Bob from Alice. + ht.DisconnectNodes(alice, bob) +}