Merge pull request #9872 from ziggie1984/fix-peer-connection
brontide: fix peer disconnection issue
This commit is contained in:
4 files changed
+51
-10
No files matched your search
@@ -27,6 +27,10 @@
|
|||||||
- Fixed [a case](https://github.com/lightningnetwork/lnd/pull/9854) where the
|
- Fixed [a case](https://github.com/lightningnetwork/lnd/pull/9854) where the
|
||||||
`BumpFee` doesn't give an error response.
|
`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
|
# New Features
|
||||||
|
|
||||||
## Functional Enhancements
|
## Functional Enhancements
|
||||||
@@ -83,3 +87,4 @@
|
|||||||
|
|
||||||
* Elle Mouton
|
* Elle Mouton
|
||||||
* Yong Yu
|
* Yong Yu
|
||||||
|
* Ziggie
|
||||||
@@ -699,6 +699,10 @@ var allTestCases = []*lntest.TestCase{
|
|||||||
Name: "rbf coop close",
|
Name: "rbf coop close",
|
||||||
TestFunc: testCoopCloseRbf,
|
TestFunc: testCoopCloseRbf,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "rbf coop close disconnect",
|
||||||
|
TestFunc: testRBFCoopCloseDisconnect,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "bump fee low budget",
|
Name: "bump fee low budget",
|
||||||
TestFunc: testBumpFeeLowBudget,
|
TestFunc: testBumpFeeLowBudget,
|
||||||
|
|||||||
@@ -131,3 +131,25 @@ func testCoopCloseRbf(ht *lntest.HarnessTest) {
|
|||||||
aliceClosingTxid := ht.WaitForChannelCloseEvent(aliceCloseStream)
|
aliceClosingTxid := ht.WaitForChannelCloseEvent(aliceCloseStream)
|
||||||
ht.AssertTxInBlock(block, aliceClosingTxid)
|
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)
|
||||||
|
}
|
||||||
+20
-10
@@ -3804,18 +3804,28 @@ func (p *Brontide) chanFlushEventSentinel(chanCloser *chancloser.RbfChanCloser,
|
|||||||
// We'll wait until the channel enters the ChannelFlushing state. We
|
// We'll wait until the channel enters the ChannelFlushing state. We
|
||||||
// exit after a success loop. As after the first RBF iteration, the
|
// exit after a success loop. As after the first RBF iteration, the
|
||||||
// channel will always be flushed.
|
// channel will always be flushed.
|
||||||
for newState := range newStateChan {
|
for {
|
||||||
if _, ok := newState.(*chancloser.ChannelFlushing); ok {
|
select {
|
||||||
peerLog.Infof("ChannelPoint(%v): rbf coop "+
|
case newState, ok := <-newStateChan:
|
||||||
"close is awaiting a flushed state, "+
|
if !ok {
|
||||||
"registering with link..., ",
|
return
|
||||||
channel.ChannelPoint())
|
}
|
||||||
|
|
||||||
// Request the link to send the event once the channel
|
if _, ok := newState.(*chancloser.ChannelFlushing); ok {
|
||||||
// is flushed. We only need this event sent once, so we
|
peerLog.Infof("ChannelPoint(%v): rbf coop "+
|
||||||
// can exit now.
|
"close is awaiting a flushed state, "+
|
||||||
link.OnFlushedOnce(sendChanFlushed)
|
"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
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user