Skip to content

Commit 904f249

Browse files
committed
Transaction: introduce constant for defining dust
Dust is defined by a minimum feerate. Historically this has been based on the REFERENCE_DEFAULT_MIN_TX_FEE, however changing the dust limit changes which transactions are standard and should be done with care. Hence, we decouple the two constants.
1 parent 69208b3 commit 904f249

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

core/src/main/java/org/bitcoinj/core/Transaction.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ private static int sortableBlockHeight(Transaction tx) {
144144
*/
145145
public static final Coin REFERENCE_DEFAULT_MIN_TX_FEE = Coin.valueOf(1_000); // 0.01 mBTC
146146

147+
/**
148+
* Minimum feerate for defining dust.
149+
*/
150+
public static final Coin DUST_RELAY_TX_FEE = Coin.valueOf(3000); // per kB
151+
147152
/**
148153
* If using this feePerKb, transactions will get confirmed within the next couple of blocks.
149154
* This should be adjusted from time to time. Last adjustment: February 2017.

core/src/main/java/org/bitcoinj/core/TransactionOutput.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ else if (ScriptPattern.isP2WH(script))
241241
* and mined by default miners.
242242
*/
243243
public Coin getMinNonDustValue() {
244-
return getMinNonDustValue(Transaction.REFERENCE_DEFAULT_MIN_TX_FEE.multiply(3));
244+
return getMinNonDustValue(Transaction.DUST_RELAY_TX_FEE);
245245
}
246246

247247
/**

0 commit comments

Comments
 (0)