mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Merge pull request #5643 from jmacxx/prevent_negative_mining_display
Prevent negative suggested mining fee when burning BSQ for fees
This commit is contained in:
commit
374e76a4fe
@ -611,10 +611,14 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs
|
||||
}
|
||||
|
||||
public Coin getTxFee() {
|
||||
if (isCurrencyForMakerFeeBtc())
|
||||
if (isCurrencyForMakerFeeBtc()) {
|
||||
return txFeeFromFeeService;
|
||||
else
|
||||
return txFeeFromFeeService.subtract(getMakerFee());
|
||||
} else {
|
||||
// when BSQ is burnt to pay the Bisq maker fee, it has the benefit of those sats also going to the miners.
|
||||
// so that reduces the explicit mining fee for the maker transaction
|
||||
Coin makerFee = getMakerFee() != null ? getMakerFee() : Coin.ZERO;
|
||||
return txFeeFromFeeService.isGreaterThan(makerFee) ? txFeeFromFeeService.subtract(makerFee) : Coin.ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
void swapTradeToSavings() {
|
||||
|
@ -621,10 +621,14 @@ class TakeOfferDataModel extends OfferDataModel {
|
||||
|
||||
public Coin getTotalTxFee() {
|
||||
Coin totalTxFees = txFeeFromFeeService.add(getTxFeeForDepositTx()).add(getTxFeeForPayoutTx());
|
||||
if (isCurrencyForTakerFeeBtc())
|
||||
if (isCurrencyForTakerFeeBtc()) {
|
||||
return totalTxFees;
|
||||
else
|
||||
return totalTxFees.subtract(getTakerFee() != null ? getTakerFee() : Coin.ZERO);
|
||||
} else {
|
||||
// when BSQ is burnt to pay the Bisq taker fee, it has the benefit of those sats also going to the miners.
|
||||
// so that reduces the explicit mining fee for the taker transaction
|
||||
Coin takerFee = getTakerFee() != null ? getTakerFee() : Coin.ZERO;
|
||||
return totalTxFees.subtract(Coin.valueOf(Math.min(takerFee.longValue(), txFeeFromFeeService.longValue())));
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
Loading…
Reference in New Issue
Block a user