multi: introduce config-level DustThreshold for defining threshold

This commit is contained in:
eugene committed 2021-09-30 13:44:35 -04:00
1 parent 3897baff0a
commit 702b3a3258
6 files changed
+23 -5

No files matched your search

+1
View File
@@ -189,6 +189,7 @@ func initSwitchWithDB(startingHeight uint32, db *channeldb.DB) (*Switch, error)
HtlcNotifier: &mockHTLCNotifier{},
Clock: clock.NewDefaultClock(),
HTLCExpiry: time.Hour,
DustThreshold: DefaultDustThreshold,
}
return New(cfg, startingHeight)
+9 -5
View File
@@ -77,9 +77,9 @@ var (
// threshold.
errDustThresholdExceeded = errors.New("dust threshold exceeded")
// defaultDustThreshold is the default threshold after which we'll fail
// payments if they are dust. This is currently set to 500k sats.
defaultDustThreshold = lnwire.MilliSatoshi(500_000_000)
// DefaultDustThreshold is the default threshold after which we'll fail
// payments if they are dust. This is currently set to 500m msats.
DefaultDustThreshold = lnwire.MilliSatoshi(500_000_000)
)
// plexPacket encapsulates switch packet and adds error channel to receive
@@ -187,6 +187,10 @@ type Config struct {
// will expiry this long after the Adds are added to a mailbox via
// AddPacket.
HTLCExpiry time.Duration
// DustThreshold is the threshold in milli-satoshis after which we'll
// fail incoming or outgoing dust payments for a particular channel.
DustThreshold lnwire.MilliSatoshi
}
// Switch is the central messaging bus for all incoming/outgoing HTLCs.
@@ -2375,7 +2379,7 @@ func (s *Switch) evaluateDustThreshold(link ChannelLink,
}
// Finally check against the defined dust threshold.
if localSum > defaultDustThreshold {
if localSum > s.cfg.DustThreshold {
return true
}
}
@@ -2393,7 +2397,7 @@ func (s *Switch) evaluateDustThreshold(link ChannelLink,
}
// Finally check against the defined dust threshold.
if remoteSum > defaultDustThreshold {
if remoteSum > s.cfg.DustThreshold {
return true
}
}