Skip to content

Commit b837c88

Browse files
committed
itest: add disconnect test
Add a connect/disconnect test when the peers both started up with the rbf coop close feature.
1 parent 8e96bd0 commit b837c88

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

itest/list_on_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,10 @@ var allTestCases = []*lntest.TestCase{
699699
Name: "rbf coop close",
700700
TestFunc: testCoopCloseRbf,
701701
},
702+
{
703+
Name: "rbf coop close disconnect",
704+
TestFunc: testRBFCoopCloseDisconnect,
705+
},
702706
{
703707
Name: "bump fee low budget",
704708
TestFunc: testBumpFeeLowBudget,

itest/lnd_coop_close_rbf_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,25 @@ func testCoopCloseRbf(ht *lntest.HarnessTest) {
131131
aliceClosingTxid := ht.WaitForChannelCloseEvent(aliceCloseStream)
132132
ht.AssertTxInBlock(block, aliceClosingTxid)
133133
}
134+
135+
// testRBFCoopCloseDisconnect tests that when a node disconnects that the node
136+
// is properly disconnected.
137+
func testRBFCoopCloseDisconnect(ht *lntest.HarnessTest) {
138+
rbfCoopFlags := []string{"--protocol.rbf-coop-close"}
139+
140+
// To kick things off, we'll create two new nodes, then fund them with
141+
// enough coins to make a 50/50 channel.
142+
cfgs := [][]string{rbfCoopFlags, rbfCoopFlags}
143+
params := lntest.OpenChannelParams{
144+
Amt: btcutil.Amount(1000000),
145+
PushAmt: btcutil.Amount(1000000 / 2),
146+
}
147+
_, nodes := ht.CreateSimpleNetwork(cfgs, params)
148+
alice, bob := nodes[0], nodes[1]
149+
150+
// Make sure the nodes are connected.
151+
ht.AssertConnected(alice, bob)
152+
153+
// Disconnect Bob from Alice.
154+
ht.DisconnectNodes(alice, bob)
155+
}

0 commit comments

Comments
 (0)