mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
itest+lntest: remove temporary hacks around broken coop close in itests
This commit is contained in:
parent
9e58ebd0fb
commit
07277172f8
6 changed files with 9 additions and 84 deletions
|
@ -309,15 +309,6 @@ func (m *mppTestScenario) closeChannels() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(yy): remove the sleep once the following bug is fixed. When the
|
|
||||||
// payment is reported as settled by Alice, it's expected the
|
|
||||||
// commitment dance is finished and all subsequent states have been
|
|
||||||
// updated. Yet we'd receive the error `cannot co-op close channel with
|
|
||||||
// active htlcs` or `link failed to shutdown` if we close the channel.
|
|
||||||
// We need to investigate the order of settling the payments and
|
|
||||||
// updating commitments to understand and fix .
|
|
||||||
time.Sleep(5 * time.Second)
|
|
||||||
|
|
||||||
// Close all channels without mining the closing transactions.
|
// Close all channels without mining the closing transactions.
|
||||||
m.ht.CloseChannelAssertPending(m.alice, m.channelPoints[0], false)
|
m.ht.CloseChannelAssertPending(m.alice, m.channelPoints[0], false)
|
||||||
m.ht.CloseChannelAssertPending(m.alice, m.channelPoints[1], false)
|
m.ht.CloseChannelAssertPending(m.alice, m.channelPoints[1], false)
|
||||||
|
|
|
@ -312,15 +312,6 @@ func runPsbtChanFunding(ht *lntest.HarnessTest, carol, dave *node.HarnessNode,
|
||||||
resp := dave.RPC.AddInvoice(invoice)
|
resp := dave.RPC.AddInvoice(invoice)
|
||||||
ht.CompletePaymentRequests(carol, []string{resp.PaymentRequest})
|
ht.CompletePaymentRequests(carol, []string{resp.PaymentRequest})
|
||||||
|
|
||||||
// TODO(yy): remove the sleep once the following bug is fixed. When the
|
|
||||||
// payment is reported as settled by Carol, it's expected the
|
|
||||||
// commitment dance is finished and all subsequent states have been
|
|
||||||
// updated. Yet we'd receive the error `cannot co-op close channel with
|
|
||||||
// active htlcs` or `link failed to shutdown` if we close the channel.
|
|
||||||
// We need to investigate the order of settling the payments and
|
|
||||||
// updating commitments to understand and fix .
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
|
|
||||||
// To conclude, we'll close the newly created channel between Carol and
|
// To conclude, we'll close the newly created channel between Carol and
|
||||||
// Dave. This function will also block until the channel is closed and
|
// Dave. This function will also block until the channel is closed and
|
||||||
// will additionally assert the relevant channel closing post
|
// will additionally assert the relevant channel closing post
|
||||||
|
@ -496,15 +487,6 @@ func runPsbtChanFundingExternal(ht *lntest.HarnessTest, carol,
|
||||||
resp := dave.RPC.AddInvoice(invoice)
|
resp := dave.RPC.AddInvoice(invoice)
|
||||||
ht.CompletePaymentRequests(carol, []string{resp.PaymentRequest})
|
ht.CompletePaymentRequests(carol, []string{resp.PaymentRequest})
|
||||||
|
|
||||||
// TODO(yy): remove the sleep once the following bug is fixed. When the
|
|
||||||
// payment is reported as settled by Carol, it's expected the
|
|
||||||
// commitment dance is finished and all subsequent states have been
|
|
||||||
// updated. Yet we'd receive the error `cannot co-op close channel with
|
|
||||||
// active htlcs` or `link failed to shutdown` if we close the channel.
|
|
||||||
// We need to investigate the order of settling the payments and
|
|
||||||
// updating commitments to understand and fix .
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
|
|
||||||
// To conclude, we'll close the newly created channel between Carol and
|
// To conclude, we'll close the newly created channel between Carol and
|
||||||
// Dave. This function will also block until the channels are closed and
|
// Dave. This function will also block until the channels are closed and
|
||||||
// will additionally assert the relevant channel closing post
|
// will additionally assert the relevant channel closing post
|
||||||
|
@ -656,15 +638,6 @@ func runPsbtChanFundingSingleStep(ht *lntest.HarnessTest, carol,
|
||||||
resp := dave.RPC.AddInvoice(invoice)
|
resp := dave.RPC.AddInvoice(invoice)
|
||||||
ht.CompletePaymentRequests(carol, []string{resp.PaymentRequest})
|
ht.CompletePaymentRequests(carol, []string{resp.PaymentRequest})
|
||||||
|
|
||||||
// TODO(yy): remove the sleep once the following bug is fixed. When the
|
|
||||||
// payment is reported as settled by Carol, it's expected the
|
|
||||||
// commitment dance is finished and all subsequent states have been
|
|
||||||
// updated. Yet we'd receive the error `cannot co-op close channel with
|
|
||||||
// active htlcs` or `link failed to shutdown` if we close the channel.
|
|
||||||
// We need to investigate the order of settling the payments and
|
|
||||||
// updating commitments to understand and fix .
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
|
|
||||||
// To conclude, we'll close the newly created channel between Carol and
|
// To conclude, we'll close the newly created channel between Carol and
|
||||||
// Dave. This function will also block until the channel is closed and
|
// Dave. This function will also block until the channel is closed and
|
||||||
// will additionally assert the relevant channel closing post
|
// will additionally assert the relevant channel closing post
|
||||||
|
|
|
@ -1323,15 +1323,6 @@ func testRouteFeeCutoff(ht *lntest.HarnessTest) {
|
||||||
}
|
}
|
||||||
testFeeCutoff(feeLimitFixed)
|
testFeeCutoff(feeLimitFixed)
|
||||||
|
|
||||||
// TODO(yy): remove the sleep once the following bug is fixed. When the
|
|
||||||
// payment is reported as settled by Carol, it's expected the
|
|
||||||
// commitment dance is finished and all subsequent states have been
|
|
||||||
// updated. Yet we'd receive the error `cannot co-op close channel with
|
|
||||||
// active htlcs` or `link failed to shutdown` if we close the channel.
|
|
||||||
// We need to investigate the order of settling the payments and
|
|
||||||
// updating commitments to understand and fix .
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
|
|
||||||
// Once we're done, close the channels and shut down the nodes created
|
// Once we're done, close the channels and shut down the nodes created
|
||||||
// throughout this test.
|
// throughout this test.
|
||||||
ht.CloseChannel(alice, chanPointAliceBob)
|
ht.CloseChannel(alice, chanPointAliceBob)
|
||||||
|
|
|
@ -426,15 +426,6 @@ func fundChanAndCloseFromImportedAccount(ht *lntest.HarnessTest, srcNode,
|
||||||
|
|
||||||
ht.CompletePaymentRequests(srcNode, []string{resp.PaymentRequest})
|
ht.CompletePaymentRequests(srcNode, []string{resp.PaymentRequest})
|
||||||
|
|
||||||
// TODO(yy): remove the sleep once the following bug is fixed. When the
|
|
||||||
// payment is reported as settled by srcNode, it's expected the
|
|
||||||
// commitment dance is finished and all subsequent states have been
|
|
||||||
// updated. Yet we'd receive the error `cannot co-op close channel with
|
|
||||||
// active htlcs` or `link failed to shutdown` if we close the channel.
|
|
||||||
// We need to investigate the order of settling the payments and
|
|
||||||
// updating commitments to understand and fix .
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
|
|
||||||
// Now that we've confirmed the opened channel works, we'll close it.
|
// Now that we've confirmed the opened channel works, we'll close it.
|
||||||
ht.CloseChannel(srcNode, chanPoint)
|
ht.CloseChannel(srcNode, chanPoint)
|
||||||
|
|
||||||
|
|
|
@ -865,15 +865,6 @@ func testOptionScidUpgrade(ht *lntest.HarnessTest) {
|
||||||
daveInvoice2 := dave.RPC.AddInvoice(daveParams)
|
daveInvoice2 := dave.RPC.AddInvoice(daveParams)
|
||||||
ht.CompletePaymentRequests(bob, []string{daveInvoice2.PaymentRequest})
|
ht.CompletePaymentRequests(bob, []string{daveInvoice2.PaymentRequest})
|
||||||
|
|
||||||
// TODO(yy): remove the sleep once the following bug is fixed. When
|
|
||||||
// the payment is reported as settled by Bob, it's expected the
|
|
||||||
// commitment dance is finished and all subsequent states have been
|
|
||||||
// updated. Yet we'd receive the error `cannot co-op close channel with
|
|
||||||
// active htlcs` or `link failed to shutdown` if we close the channel.
|
|
||||||
// We need to investigate the order of settling the payments and
|
|
||||||
// updating commitments to understand and fix.
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
|
|
||||||
// Close standby node's channels.
|
// Close standby node's channels.
|
||||||
ht.CloseChannel(bob, fundingPoint2)
|
ht.CloseChannel(bob, fundingPoint2)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1207,6 +1207,7 @@ func (h *HarnessTest) CloseChannelAssertPending(hn *node.HarnessNode,
|
||||||
closeReq := &lnrpc.CloseChannelRequest{
|
closeReq := &lnrpc.CloseChannelRequest{
|
||||||
ChannelPoint: cp,
|
ChannelPoint: cp,
|
||||||
Force: force,
|
Force: force,
|
||||||
|
NoWait: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -1218,28 +1219,15 @@ func (h *HarnessTest) CloseChannelAssertPending(hn *node.HarnessNode,
|
||||||
// Consume the "channel close" update in order to wait for the closing
|
// Consume the "channel close" update in order to wait for the closing
|
||||||
// transaction to be broadcast, then wait for the closing tx to be seen
|
// transaction to be broadcast, then wait for the closing tx to be seen
|
||||||
// within the network.
|
// within the network.
|
||||||
//
|
stream = hn.RPC.CloseChannel(closeReq)
|
||||||
// TODO(yy): remove the wait once the following bug is fixed.
|
_, err = h.ReceiveCloseChannelUpdate(stream)
|
||||||
// - https://github.com/lightningnetwork/lnd/issues/6039
|
require.NoError(h, err, "close channel update got error: %v", err)
|
||||||
// We may receive the error `cannot co-op close channel with active
|
|
||||||
// htlcs` or `link failed to shutdown` if we close the channel. We need
|
|
||||||
// to investigate the order of settling the payments and updating
|
|
||||||
// commitments to properly fix it.
|
|
||||||
err = wait.NoError(func() error {
|
|
||||||
stream = hn.RPC.CloseChannel(closeReq)
|
|
||||||
event, err = h.ReceiveCloseChannelUpdate(stream)
|
|
||||||
if err != nil {
|
|
||||||
h.Logf("Test: %s, close channel got error: %v",
|
|
||||||
h.manager.currentTestCase, err)
|
|
||||||
|
|
||||||
// NoError predicates every 200ms, which is too
|
event, err = h.ReceiveCloseChannelUpdate(stream)
|
||||||
// frequent for closing channels. We sleep here to
|
if err != nil {
|
||||||
// avoid trying it too much.
|
h.Logf("Test: %s, close channel got error: %v",
|
||||||
time.Sleep(2 * time.Second)
|
h.manager.currentTestCase, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
|
||||||
}, wait.ChannelCloseTimeout)
|
|
||||||
require.NoError(h, err, "retry closing channel failed")
|
require.NoError(h, err, "retry closing channel failed")
|
||||||
|
|
||||||
pendingClose, ok := event.Update.(*lnrpc.CloseStatusUpdate_ClosePending)
|
pendingClose, ok := event.Update.(*lnrpc.CloseStatusUpdate_ClosePending)
|
||||||
|
|
Loading…
Add table
Reference in a new issue