Skip to content

Commit 5613aa8

Browse files
committed
Lower minimum remote dust limit
We are slowly dropping support for non-segwit outputs, as proposed in lightning/bolts#894 We can thus safely allow dust limits all the way down to 354 satoshis.
1 parent fb0199c commit 5613aa8

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

eclair-core/src/main/scala/fr/acinq/eclair/NodeParams.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ object NodeParams extends Logging {
233233

234234
val dustLimitSatoshis = Satoshi(config.getLong("dust-limit-satoshis"))
235235
if (chainHash == Block.LivenetGenesisBlock.hash) {
236-
require(dustLimitSatoshis >= Channel.MIN_DUSTLIMIT, s"dust limit must be greater than ${Channel.MIN_DUSTLIMIT}")
236+
require(dustLimitSatoshis >= Channel.MIN_DUST_LIMIT, s"dust limit must be greater than ${Channel.MIN_DUST_LIMIT}")
237237
}
238238

239239
val htlcMinimum = MilliSatoshi(config.getInt("htlc-minimum-msat"))

eclair-core/src/main/scala/fr/acinq/eclair/channel/Channel.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ object Channel {
7878
val MAX_FUNDING: Satoshi = 16777216 sat // = 2^24
7979
val MAX_ACCEPTED_HTLCS = 483
8080

81-
// we don't want the counterparty to use a dust limit lower than that, because they wouldn't only hurt themselves we may need them to publish their commit tx in certain cases (backup/restore)
82-
val MIN_DUSTLIMIT: Satoshi = 546 sat
81+
// We may need to rely on our peer's commit tx in certain cases (backup/restore) so we must ensure their transactions
82+
// can propagate through the bitcoin network (assuming bitcoin core nodes with default policies).
83+
// The various dust limits enforced by the bitcoin network are summarized here:
84+
// https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md#dust-limits
85+
// A dust limit of 354 sat ensures all segwit outputs will relay with default relay policies.
86+
val MIN_DUST_LIMIT: Satoshi = 354 sat
8387

8488
// we won't exchange more than this many signatures when negotiating the closing fee
8589
val MAX_NEGOTIATION_ITERATIONS = 20

eclair-core/src/main/scala/fr/acinq/eclair/channel/Helpers.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ object Helpers {
138138
if (nodeParams.onChainFeeConf.feerateToleranceFor(remoteNodeId).isFeeDiffTooHigh(channelType, localFeeratePerKw, open.feeratePerKw)) return Left(FeerateTooDifferent(open.temporaryChannelId, localFeeratePerKw, open.feeratePerKw))
139139
// only enforce dust limit check on mainnet
140140
if (nodeParams.chainHash == Block.LivenetGenesisBlock.hash) {
141-
if (open.dustLimitSatoshis < Channel.MIN_DUSTLIMIT) return Left(DustLimitTooSmall(open.temporaryChannelId, open.dustLimitSatoshis, Channel.MIN_DUSTLIMIT))
141+
if (open.dustLimitSatoshis < Channel.MIN_DUST_LIMIT) return Left(DustLimitTooSmall(open.temporaryChannelId, open.dustLimitSatoshis, Channel.MIN_DUST_LIMIT))
142142
}
143143

144144
// we don't check that the funder's amount for the initial commitment transaction is sufficient for full fee payment
@@ -169,7 +169,7 @@ object Helpers {
169169
if (accept.maxAcceptedHtlcs > Channel.MAX_ACCEPTED_HTLCS) return Left(InvalidMaxAcceptedHtlcs(accept.temporaryChannelId, accept.maxAcceptedHtlcs, Channel.MAX_ACCEPTED_HTLCS))
170170
// only enforce dust limit check on mainnet
171171
if (nodeParams.chainHash == Block.LivenetGenesisBlock.hash) {
172-
if (accept.dustLimitSatoshis < Channel.MIN_DUSTLIMIT) return Left(DustLimitTooSmall(accept.temporaryChannelId, accept.dustLimitSatoshis, Channel.MIN_DUSTLIMIT))
172+
if (accept.dustLimitSatoshis < Channel.MIN_DUST_LIMIT) return Left(DustLimitTooSmall(accept.temporaryChannelId, accept.dustLimitSatoshis, Channel.MIN_DUST_LIMIT))
173173
}
174174

175175
if (accept.dustLimitSatoshis > nodeParams.maxRemoteDustLimit) return Left(DustLimitTooLarge(open.temporaryChannelId, accept.dustLimitSatoshis, nodeParams.maxRemoteDustLimit))

eclair-core/src/test/scala/fr/acinq/eclair/channel/states/a/WaitForAcceptChannelStateSpec.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,11 @@ class WaitForAcceptChannelStateSpec extends TestKitBaseClass with FixtureAnyFunS
184184
test("recv AcceptChannel (dust limit too low)", Tag("mainnet")) { f =>
185185
import f._
186186
val accept = bob2alice.expectMsgType[AcceptChannel]
187-
// we don't want their dust limit to be below 546
188-
val lowDustLimitSatoshis = 545.sat
187+
// we don't want their dust limit to be below 354
188+
val lowDustLimitSatoshis = 353.sat
189189
alice ! accept.copy(dustLimitSatoshis = lowDustLimitSatoshis)
190190
val error = alice2bob.expectMsgType[Error]
191-
assert(error === Error(accept.temporaryChannelId, DustLimitTooSmall(accept.temporaryChannelId, lowDustLimitSatoshis, Channel.MIN_DUSTLIMIT).getMessage))
191+
assert(error === Error(accept.temporaryChannelId, DustLimitTooSmall(accept.temporaryChannelId, lowDustLimitSatoshis, Channel.MIN_DUST_LIMIT).getMessage))
192192
awaitCond(alice.stateName == CLOSED)
193193
}
194194

0 commit comments

Comments
 (0)