Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/release-notes/release-notes-0.19.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
- Fixed [a case](https://github.com/lightningnetwork/lnd/pull/9854) where the
`BumpFee` doesn't give an error response.

- Fixed [a case](https://github.com/lightningnetwork/lnd/pull/9872) where a
peer would not disconnect properly when both peers supported the new
"rbf-coop-close" feature leaving the peer connection in a borked state.

# New Features

## Functional Enhancements
Expand Down Expand Up @@ -83,3 +87,4 @@

* Elle Mouton
* Yong Yu
* Ziggie
4 changes: 4 additions & 0 deletions itest/list_on_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
22 changes: 22 additions & 0 deletions itest/lnd_coop_close_rbf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add this test in a separate commit so we could run this test to see it fail?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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)
}
32 changes: 21 additions & 11 deletions peer/brontide.go
Original file line number Diff line number Diff line change
Expand Up @@ -3804,18 +3804,28 @@ func (p *Brontide) chanFlushEventSentinel(chanCloser *chancloser.RbfChanCloser,
// We'll wait until the channel enters the ChannelFlushing state. We
// exit after a success loop. As after the first RBF iteration, the
// channel will always be flushed.
for newState := range newStateChan {
if _, ok := newState.(*chancloser.ChannelFlushing); ok {
peerLog.Infof("ChannelPoint(%v): rbf coop "+
"close is awaiting a flushed state, "+
"registering with link..., ",
channel.ChannelPoint())

// Request the link to send the event once the channel
// is flushed. We only need this event sent once, so we
// can exit now.
link.OnFlushedOnce(sendChanFlushed)
for {
select {
case newState, ok := <-newStateChan:
if !ok {
return
}

if _, ok := newState.(*chancloser.ChannelFlushing); ok {
peerLog.Infof("ChannelPoint(%v): rbf coop "+
"close is awaiting a flushed state, "+
"registering with link..., ",
channel.ChannelPoint())

// Request the link to send the event once the
// channel is flushed. We only need this event
// sent once, so we can exit now.
link.OnFlushedOnce(sendChanFlushed)

return
}

case <-p.cg.Done():
return
}
}
Expand Down
Loading