forked from Qortal/qortal
Fix Transaction.calcRecommendedFee()
This commit is contained in:
parent
d2eb8b0c2b
commit
7ded8954c6
@ -345,18 +345,10 @@ public abstract class Transaction {
|
|||||||
|
|
||||||
BigDecimal maxBytePerUnitFee = BlockChain.getInstance().getMaxBytesPerUnitFee();
|
BigDecimal maxBytePerUnitFee = BlockChain.getInstance().getMaxBytesPerUnitFee();
|
||||||
|
|
||||||
BigDecimal recommendedFee = BigDecimal.valueOf(dataLength).divide(maxBytePerUnitFee, MathContext.DECIMAL32).setScale(8);
|
BigDecimal unitFeeCount = BigDecimal.valueOf(dataLength).divide(maxBytePerUnitFee, RoundingMode.UP);
|
||||||
|
|
||||||
// security margin
|
BigDecimal recommendedFee = BlockChain.getInstance().getUnitFee().multiply(unitFeeCount).setScale(8);
|
||||||
recommendedFee = recommendedFee.add(new BigDecimal("0.00000001"));
|
return recommendedFee;
|
||||||
|
|
||||||
if (recommendedFee.compareTo(BlockChain.getInstance().getUnitFee()) <= 0) {
|
|
||||||
recommendedFee = BlockChain.getInstance().getUnitFee();
|
|
||||||
} else {
|
|
||||||
recommendedFee = recommendedFee.setScale(0, RoundingMode.CEILING);
|
|
||||||
}
|
|
||||||
|
|
||||||
return recommendedFee.setScale(8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user