multi: coop close with active HTLCs on the channel
For the lncli cmd we now always initiate the coop close even if there are active HTLCs on the channel. In case HTLCs are on the channel and the coop close is initiated LND handles the closing flow in the background and the lncli cmd will block until the transaction is broadcasted to the mempool. In the background LND disallows any new HTLCs and waits until all HTLCs are resolved before kicking of the negotiation process. Moreover if active HTLCs are present and the no_wait param is not set the error msg is now highlightning it so the user can react accordingly.
This commit is contained in:
6 files changed
+2353
-2273
No files matched your search
@@ -93,14 +93,17 @@ func coopCloseWithHTLCs(ht *lntest.HarnessTest) {
|
||||
// closure is set up. Let's settle the invoice.
|
||||
alice.RPC.SettleInvoice(preimage[:])
|
||||
|
||||
// Pull the instant update off the wire to clear the path for the
|
||||
// close pending update.
|
||||
_, err := closeClient.Recv()
|
||||
// Pull the instant update off the wire and make sure the number of
|
||||
// pending HTLCs is as expected.
|
||||
update, err := closeClient.Recv()
|
||||
require.NoError(ht, err)
|
||||
closeInstant := update.GetCloseInstant()
|
||||
require.NotNil(ht, closeInstant)
|
||||
require.Equal(ht, closeInstant.NumPendingHtlcs, int32(1))
|
||||
|
||||
// Wait for the next channel closure update. Now that we have settled
|
||||
// the only HTLC this should be imminent.
|
||||
update, err := closeClient.Recv()
|
||||
update, err = closeClient.Recv()
|
||||
require.NoError(ht, err)
|
||||
|
||||
// This next update should be a GetClosePending as it should be the
|
||||
|
||||
Reference in new issue
Block a user