Skip to content

Commit 1ba6467

Browse files
committed
contractcourt: force the sweeper to always resolve outgoing HTLCs
In this commit, we attempt to fix an issue that may lead to force closes due to small value HTLCs. The sweeper has built in a "negative yield" heuristic where it won't sweep something that'll result in paying more fees than the HTLC amount. However for HTLCs, we want to always sweep them, as we don't cancel back the HTLCs before the outgoing contract is fully resolved. In the future, we'll start to make more uneconomical decisions about if we should go to chain at all for small value HTLCs, and also do things like cancel back early if the HTLC is small and we think we might be contested by chain fees.
1 parent 9b4fce1 commit 1ba6467

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

contractcourt/htlc_timeout_resolver.go

+1
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ func (h *htlcTimeoutResolver) sweepSecondLevelTx() error {
327327
Fee: sweep.FeePreference{
328328
ConfTarget: secondLevelConfTarget,
329329
},
330+
Force: true,
330331
},
331332
)
332333

contractcourt/utxonursery.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -781,9 +781,10 @@ func (u *UtxoNursery) sweepMatureOutputs(classHeight uint32,
781781
// passed in with disastrous consequences.
782782
local := output
783783

784-
resultChan, err := u.cfg.SweepInput(
785-
&local, sweep.Params{Fee: feePref},
786-
)
784+
resultChan, err := u.cfg.SweepInput(&local, sweep.Params{
785+
Fee: feePref,
786+
Force: true,
787+
})
787788
if err != nil {
788789
return err
789790
}

0 commit comments

Comments
 (0)