dogecoin / libdohj

Java library for adding altcoin support to bitcoinj
Apache License 2.0
107 stars 89 forks source link

Litecoin minNonDustOutput is wrong? #21

Open mrosseel opened 7 years ago

mrosseel commented 7 years ago

According to the following site: https://litecoin.info/Transaction_fees The minimum non-dust output of litecoin is 0.001 LTC.

In the AbstractLitecoinParams.java file this parameter is set to Coin.COIN:

@Override
public Coin getMinNonDustOutput() {
    return Coin.COIN;
}

Which is 1 LTC:

/**
 * The number of satoshis equal to one bitcoin.
 */
private static final long COIN_VALUE = LongMath.pow(10, SMALLEST_UNIT_EXPONENT);

/**
 * One Bitcoin.
 */
public static final Coin COIN = Coin.valueOf(COIN_VALUE);

Note: in Doge it's also set to 1 Doge (litecoin probably copy-pasted this), in namecoin it's set to the bitcoin default Transaction.MIN_NONDUST_OUTPUT; which is 2730 satoshi.

Proposal:

@Override
public Coin getMinNonDustOutput() {
    return Coin.valueof(100000);
}

Can anyone confirm this interpretation? Should the other values in that table be checked as well?

JeremyRand commented 7 years ago

When I created the Namecoin params, I just copied what BitcoinJ did for Bitcoin. I actually don't see the constant 2730 in either the Bitcoin Core or Namecoin Core source code. I do see this commit: https://github.com/bitcoin/bitcoin/commit/5f46a7d0689ff1457b016fdf0de89e5153058864 , which removed a constant of 2730. So maybe the Bitcoin params in upstream BitcoinJ also need fixing?