Skip to content

Commit 8a80f06

Browse files
committed
[lbry] policy: relax dust thrashold to 1000 dewies/kB
An output is considered dust if the cost to the network to spend the coins is more than 1/3 of the minimum free transaction relay fee, which has a default rate of 1000 satoshis/kb bitcoind refactored dust threshold calculation, which removed the multiply factor of 3 from the code, but increased the DUST_RELAY_TX_FEE from 1000 to 3000 (satoshi/kb). lbrycrd adopted the refactored code but also kept the rate to 1000 dewies/kB, which means: An output is considered dust if the cost to the network to spend the coins is more than the minimum free transaction relay fee.
1 parent 5d7a219 commit 8a80f06

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

mempool/policy.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func GetDustThreshold(txOut *wire.TxOut) int64 {
249249
totalSize += 107
250250
}
251251

252-
return 3 * int64(totalSize)
252+
return int64(totalSize)
253253
}
254254

255255
// IsDust returns whether or not the passed transaction output amount is
@@ -264,7 +264,7 @@ func IsDust(txOut *wire.TxOut, minRelayTxFee btcutil.Amount) bool {
264264
}
265265

266266
// The output is considered dust if the cost to the network to spend the
267-
// coins is more than 1/3 of the minimum free transaction relay fee.
267+
// coins is more than the minimum free transaction relay fee.
268268
// minFreeTxRelayFee is in Satoshi/KB, so multiply by 1000 to
269269
// convert to bytes.
270270
//
@@ -273,7 +273,7 @@ func IsDust(txOut *wire.TxOut, minRelayTxFee btcutil.Amount) bool {
273273
// fee of 1000, this equates to values less than 546 satoshi being
274274
// considered dust.
275275
//
276-
// The following is equivalent to (value/totalSize) * (1/3) * 1000
276+
// The following is equivalent to (value/totalSize) * 1000
277277
// without needing to do floating point math.
278278
if txOut.Value > dustCap {
279279
return false

mempool/policy_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,14 @@ func TestDust(t *testing.T) {
233233
true,
234234
},
235235
{
236-
"38 byte public key script with value 584",
237-
wire.TxOut{Value: 584, PkScript: pkScript},
236+
"38 byte public key script with value 194",
237+
wire.TxOut{Value: 194, PkScript: pkScript},
238238
1000,
239239
true,
240240
},
241241
{
242-
"38 byte public key script with value 585",
243-
wire.TxOut{Value: 585, PkScript: pkScript},
242+
"38 byte public key script with value 195",
243+
wire.TxOut{Value: 195, PkScript: pkScript},
244244
1000,
245245
false,
246246
},

0 commit comments

Comments
 (0)