Skip to content

Commit

Permalink
lnwallet: remove local output below dustlimit on cooperative close
Browse files Browse the repository at this point in the history
  • Loading branch information
JssDWt committed May 20, 2024
1 parent ab5b2ea commit e13b31e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lnwallet/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -8364,6 +8364,14 @@ func CreateCooperativeCloseTx(fundingTxIn wire.TxIn,
closeTx := wire.NewMsgTx(2)
closeTx.AddTxIn(&fundingTxIn)

// It is possible this is a zero reserve channel. In that case the local
// dust limit will be below the 'real' dust limit, namely 0. Creating a
// transaction with an output below their dust limit would fail, so
// remove our output if it falls below their dust limit.
if localDust < remoteDust {
localDust = remoteDust
}

// Create both cooperative closure outputs, properly respecting the
// dust limits of both parties.
if ourBalance >= localDust {
Expand Down

0 comments on commit e13b31e

Please sign in to comment.