TransactionOutput: simplify method isDust()

Replace `if` with boolean logic and revise related comment.
This commit is contained in:
Sean Gilligan 2023-08-08 14:05:57 -07:00 committed by Andreas Schildbach
parent f907a6b86f
commit fa323f745e

View File

@ -203,9 +203,8 @@ public class TransactionOutput {
*/
public boolean isDust() {
// Transactions that are OP_RETURN can't be dust regardless of their value.
if (ScriptPattern.isOpReturn(getScriptPubKey()))
return false;
return getValue().isLessThan(getMinNonDustValue());
// If output is not OP_RETURN and value is below getMinNonDustValue() it is dust.
return !ScriptPattern.isOpReturn(getScriptPubKey()) && getValue().isLessThan(getMinNonDustValue());
}
/**