mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 22:21:18 +02:00
multi: replace DefaultDustLimit with script-specific DustLimitForSize
This commit updates call-sites to use the proper dust limits for various script types. This also updates the default dust limit used in the funding flow to be 354 satoshis instead of 573 satoshis.
This commit is contained in:
@@ -300,7 +300,7 @@ func TestBackupTask(t *testing.T) {
|
||||
expSweepCommitRewardLocal int64 = 197390
|
||||
expSweepCommitRewardRemote int64 = 98437
|
||||
sweepFeeRateNoRewardRemoteDust chainfee.SatPerKWeight = 227500
|
||||
sweepFeeRateRewardRemoteDust chainfee.SatPerKWeight = 175000
|
||||
sweepFeeRateRewardRemoteDust chainfee.SatPerKWeight = 175350
|
||||
)
|
||||
if chanType.HasAnchors() {
|
||||
expSweepCommitNoRewardBoth = 299236
|
||||
@@ -309,8 +309,8 @@ func TestBackupTask(t *testing.T) {
|
||||
expSweepCommitRewardBoth = 296112
|
||||
expSweepCommitRewardLocal = 197389
|
||||
expSweepCommitRewardRemote = 98433
|
||||
sweepFeeRateNoRewardRemoteDust = 225000
|
||||
sweepFeeRateRewardRemoteDust = 173750
|
||||
sweepFeeRateNoRewardRemoteDust = 225400
|
||||
sweepFeeRateRewardRemoteDust = 174100
|
||||
}
|
||||
|
||||
backupTaskTests = append(backupTaskTests, []backupTaskTest{
|
||||
|
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
"github.com/lightningnetwork/lnd/watchtower/blob"
|
||||
@@ -165,10 +166,9 @@ func (p *Policy) ComputeAltruistOutput(totalAmt btcutil.Amount,
|
||||
sweepAmt := totalAmt - txFee
|
||||
|
||||
// TODO(conner): replace w/ configurable dust limit
|
||||
dustLimit := lnwallet.DefaultDustLimit()
|
||||
|
||||
// Check that the created outputs won't be dusty.
|
||||
if sweepAmt <= dustLimit {
|
||||
// Check that the created outputs won't be dusty. The sweep pkscript is
|
||||
// currently a p2wpkh, so we'll use that script's dust limit.
|
||||
if sweepAmt < lnwallet.DustLimitForSize(input.P2WPKHSize) {
|
||||
return 0, ErrCreatesDust
|
||||
}
|
||||
|
||||
@@ -199,10 +199,9 @@ func (p *Policy) ComputeRewardOutputs(totalAmt btcutil.Amount,
|
||||
sweepAmt := totalAmt - rewardAmt - txFee
|
||||
|
||||
// TODO(conner): replace w/ configurable dust limit
|
||||
dustLimit := lnwallet.DefaultDustLimit()
|
||||
|
||||
// Check that the created outputs won't be dusty.
|
||||
if sweepAmt <= dustLimit {
|
||||
// Check that the created outputs won't be dusty. The sweep pkscript is
|
||||
// currently a p2wpkh, so we'll use that script's dust limit.
|
||||
if sweepAmt < lnwallet.DustLimitForSize(input.P2WPKHSize) {
|
||||
return 0, 0, ErrCreatesDust
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user