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:
1 parent
f8da26ee30
commit
0407b37fce
9 files changed
+196
-28
No files matched your search
@@ -5,12 +5,14 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/clock"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
@@ -153,6 +155,19 @@ type ChainArbitratorConfig struct {
|
||||
// OnionProcessor is used to decode onion payloads for on-chain
|
||||
// resolution.
|
||||
OnionProcessor OnionProcessor
|
||||
|
||||
// PaymentsExpirationGracePeriod indicates is a time window we let the
|
||||
// other node to cancel an outgoing htlc that our node has initiated and
|
||||
// has timed out.
|
||||
PaymentsExpirationGracePeriod time.Duration
|
||||
|
||||
// IsForwardedHTLC checks for a given htlc, identified by channel id and
|
||||
// htlcIndex, if it is a forwarded one.
|
||||
IsForwardedHTLC func(chanID lnwire.ShortChannelID, htlcIndex uint64) bool
|
||||
|
||||
// Clock is the clock implementation that ChannelArbitrator uses.
|
||||
// It is useful for testing.
|
||||
Clock clock.Clock
|
||||
}
|
||||
|
||||
// ChainArbitrator is a sub-system that oversees the on-chain resolution of all
|
||||
|
||||
Reference in new issue
Block a user