mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Adopt economyFee recommendation from mempool rate provider.
This commit is contained in:
parent
a62655c15d
commit
08570c929d
@ -26,7 +26,7 @@ import java.time.Duration;
|
||||
*/
|
||||
public abstract class FeeRateProvider extends PriceProvider<FeeRate> {
|
||||
|
||||
public static final long MIN_FEE_RATE_FOR_WITHDRAWAL = 2; // satoshi/vbyte
|
||||
public static final long MIN_FEE_RATE_FOR_WITHDRAWAL = 1; // satoshi/vbyte
|
||||
public static final long MIN_FEE_RATE_FOR_TRADING = 10; // satoshi/vbyte
|
||||
public static final long MAX_FEE_RATE = 1000;
|
||||
|
||||
|
@ -97,14 +97,13 @@ abstract class MempoolFeeRateProvider extends FeeRateProvider {
|
||||
.map(r -> Math.max(r, MIN_FEE_RATE_FOR_TRADING))
|
||||
.map(r -> Math.min(r, MAX_FEE_RATE))
|
||||
.orElse(MIN_FEE_RATE_FOR_TRADING);
|
||||
long minimumFee = feeRatePredictions.stream()
|
||||
.filter(p -> p.getKey().equalsIgnoreCase("minimumFee"))
|
||||
long economyFee = feeRatePredictions.stream()
|
||||
.filter(p -> p.getKey().equalsIgnoreCase("economyFee"))
|
||||
.map(Map.Entry::getValue)
|
||||
.findFirst()
|
||||
.map(r -> Math.multiplyExact(r, 2)) // multiply the minimumFee by 2 (per wiz)
|
||||
.orElse(MIN_FEE_RATE_FOR_WITHDRAWAL);
|
||||
log.info("Retrieved estimated mining fee of {} sat/vB and minimumFee of {} sat/vB from {}", estimatedFeeRate, minimumFee, getMempoolApiHostname());
|
||||
return new FeeRate("BTC", estimatedFeeRate, minimumFee, Instant.now().getEpochSecond());
|
||||
log.info("Retrieved estimated mining fee of {} sat/vB and economyFee of {} sat/vB from {}", estimatedFeeRate, economyFee, getMempoolApiHostname());
|
||||
return new FeeRate("BTC", estimatedFeeRate, economyFee, Instant.now().getEpochSecond());
|
||||
}
|
||||
|
||||
private Set<Map.Entry<String, Long>> getFeeRatePredictions() {
|
||||
|
Loading…
Reference in New Issue
Block a user