[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.
This commit is contained in:
Roy Lee 2022-09-01 13:30:27 -07:00
parent 5d7a219e35
commit 8a80f0683a
2 changed files with 7 additions and 7 deletions

View file

@ -249,7 +249,7 @@ func GetDustThreshold(txOut *wire.TxOut) int64 {
totalSize += 107
}
return 3 * int64(totalSize)
return int64(totalSize)
}
// IsDust returns whether or not the passed transaction output amount is
@ -264,7 +264,7 @@ func IsDust(txOut *wire.TxOut, minRelayTxFee btcutil.Amount) bool {
}
// The 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.
// coins is more than the minimum free transaction relay fee.
// minFreeTxRelayFee is in Satoshi/KB, so multiply by 1000 to
// convert to bytes.
//
@ -273,7 +273,7 @@ func IsDust(txOut *wire.TxOut, minRelayTxFee btcutil.Amount) bool {
// fee of 1000, this equates to values less than 546 satoshi being
// considered dust.
//
// The following is equivalent to (value/totalSize) * (1/3) * 1000
// The following is equivalent to (value/totalSize) * 1000
// without needing to do floating point math.
if txOut.Value > dustCap {
return false

View file

@ -233,14 +233,14 @@ func TestDust(t *testing.T) {
true,
},
{
"38 byte public key script with value 584",
wire.TxOut{Value: 584, PkScript: pkScript},
"38 byte public key script with value 194",
wire.TxOut{Value: 194, PkScript: pkScript},
1000,
true,
},
{
"38 byte public key script with value 585",
wire.TxOut{Value: 585, PkScript: pkScript},
"38 byte public key script with value 195",
wire.TxOut{Value: 195, PkScript: pkScript},
1000,
false,
},