Skip to content

Commit

Permalink
Remove unused maxBlocks param from pricenode
Browse files Browse the repository at this point in the history
As the new fee estimation API does not require this parameter
anymore, remove it and all references to it.

See bisq-network/projects#27
  • Loading branch information
cd2357 committed May 6, 2020
1 parent 246d5ee commit d307d97
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pricenode/bisq-pricenode.service
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -98,17 +90,10 @@ private static Optional<String[]> 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);
}

Expand All @@ -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());
}
}
}

0 comments on commit d307d97

Please sign in to comment.