From d307d97204472adf2d1d6cf5b74495f9abd0d95a Mon Sep 17 00:00:00 2001 From: cd2357 Date: Wed, 6 May 2020 20:31:03 +0200 Subject: [PATCH] Remove unused maxBlocks param from pricenode As the new fee estimation API does not require this parameter anymore, remove it and all references to it. See bisq-network/projects#27 --- pricenode/bisq-pricenode.service | 2 +- .../providers/BitcoinFeeRateProvider.java | 19 ++----------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/pricenode/bisq-pricenode.service b/pricenode/bisq-pricenode.service index 2ae96a5cd80..8123387228b 100644 --- a/pricenode/bisq-pricenode.service +++ b/pricenode/bisq-pricenode.service @@ -5,7 +5,7 @@ After=network.target [Service] SyslogIdentifier=bisq-pricenode EnvironmentFile=/etc/default/bisq-pricenode.env -ExecStart=/bisq/bisq/bisq-pricenode 2 2 +ExecStart=/bisq/bisq/bisq-pricenode 2 ExecStop=/bin/kill -TERM ${MAINPID} Restart=on-failure diff --git a/pricenode/src/main/java/bisq/price/mining/providers/BitcoinFeeRateProvider.java b/pricenode/src/main/java/bisq/price/mining/providers/BitcoinFeeRateProvider.java index e5310d867d6..4a8081dfbfb 100644 --- a/pricenode/src/main/java/bisq/price/mining/providers/BitcoinFeeRateProvider.java +++ b/pricenode/src/main/java/bisq/price/mining/providers/BitcoinFeeRateProvider.java @@ -44,20 +44,12 @@ class BitcoinFeeRateProvider extends FeeRateProvider { static final long MIN_FEE_RATE = 10; // satoshi/byte static final long MAX_FEE_RATE = 1000; - private static final int DEFAULT_MAX_BLOCKS = 2; private static final int DEFAULT_REFRESH_INTERVAL = 2; private final RestTemplate restTemplate = new RestTemplate(); - // TODO: As of the switch to the mempool.space API this field and related members are - // now dead code and should be removed, including removing the positional - // command-line argument from startup scripts. Operators need to be notified of this - // when it happens. - private final int maxBlocks; - public BitcoinFeeRateProvider(Environment env) { super(Duration.ofMinutes(refreshInterval(env))); - this.maxBlocks = maxBlocks(env); } protected FeeRate doGet() { @@ -98,17 +90,10 @@ private static Optional args(Environment env) { env.getProperty(CommandLinePropertySource.DEFAULT_NON_OPTION_ARGS_PROPERTY_NAME, String[].class)); } - private static int maxBlocks(Environment env) { + private static long refreshInterval(Environment env) { return args(env) .filter(args -> args.length >= 1) .map(args -> Integer.valueOf(args[0])) - .orElse(DEFAULT_MAX_BLOCKS); - } - - private static long refreshInterval(Environment env) { - return args(env) - .filter(args -> args.length >= 2) - .map(args -> Integer.valueOf(args[1])) .orElse(DEFAULT_REFRESH_INTERVAL); } @@ -118,7 +103,7 @@ class Controller extends PriceController { @GetMapping(path = "/getParams") public String getParams() { - return String.format("%s;%s", maxBlocks, refreshInterval.toMillis()); + return String.format("%s", refreshInterval.toMillis()); } } }