mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-26 22:17:51 +01:00
contractcourt+switch: keep channels with timed-out initiated htlcs.
This commit enables the user to specify he is not interested in automatically close channels with pending payments that their corresponding htlcs have timed-out. By requiring a configurable grace period uptime of our node before closing such channels, we give a chance to the other node to properly cancel the htlc and avoid unnecessary on-chain transaction. In mobile it is very important for the user experience as otherwise channels will be force closed more frequently.
This commit is contained in:
@@ -322,6 +322,10 @@ func TestSwitchForward(t *testing.T) {
|
||||
t.Fatal("wrong amount of circuits")
|
||||
}
|
||||
|
||||
if !s.IsForwardedHTLC(bobChannelLink.ShortChanID(), 0) {
|
||||
t.Fatal("htlc should be identified as forwarded")
|
||||
}
|
||||
|
||||
// Create settle request pretending that bob link handled the add htlc
|
||||
// request and sent the htlc settle request back. This request should
|
||||
// be forwarder back to Alice link.
|
||||
@@ -1892,6 +1896,9 @@ func TestSwitchSendPayment(t *testing.T) {
|
||||
t.Fatalf("unable obfuscate failure: %v", err)
|
||||
}
|
||||
|
||||
if s.IsForwardedHTLC(aliceChannelLink.ShortChanID(), update.ID) {
|
||||
t.Fatal("htlc should be identified as not forwarded")
|
||||
}
|
||||
packet := &htlcPacket{
|
||||
outgoingChanID: aliceChannelLink.ShortChanID(),
|
||||
outgoingHTLCID: 0,
|
||||
|
||||
Reference in New Issue
Block a user