Skip to content

Commit

Permalink
Minor improvements related with PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
asoto-iov committed Jan 15, 2024
1 parent 4a0e9e2 commit 098883d
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rskj-core/src/main/java/co/rsk/RskContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,8 @@ public synchronized Ethereum getRsk() {

public GasPriceTracker getGasPriceTracker() {
checkIfNotClosed();
GasCalculator.GasCalculatorType calculatorType = getRskSystemProperties().getGasCalculatorType();
if (this.gasPriceTracker == null) {
GasCalculator.GasCalculatorType calculatorType = getRskSystemProperties().getGasCalculatorType();
this.gasPriceTracker = GasPriceTracker.create(getBlockStore(), calculatorType);
}
return this.gasPriceTracker;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class RskSystemProperties extends SystemProperties {
private static final String RPC_MODULES_PATH = "rpc.modules";
private static final String RPC_ETH_GET_LOGS_MAX_BLOCKS_TO_QUERY = "rpc.logs.maxBlocksToQuery";
private static final String RPC_ETH_GET_LOGS_MAX_LOGS_TO_RETURN = "rpc.logs.maxLogsToReturn";
public static final String MINER_GAS_PRICE_CALCULATOR_TYPE = "miner.gasPriceCalculatorType";


private static final int CHUNK_SIZE = 192;

Expand Down Expand Up @@ -484,7 +486,7 @@ public double getTopBest() {
}

public GasCalculator.GasCalculatorType getGasCalculatorType() {
String value = configFromFiles.getString("miner.gasPriceCalculatorType");
String value = configFromFiles.getString(MINER_GAS_PRICE_CALCULATOR_TYPE);
if (value == null || value.isEmpty()) {
return GasCalculator.GasCalculatorType.LEGACY;
}
Expand Down
19 changes: 18 additions & 1 deletion rskj-core/src/main/java/org/ethereum/listener/GasCalculator.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* This file is part of RskJ
* Copyright (C) 2024 RSK Labs Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.ethereum.listener;

import co.rsk.core.Coin;
Expand Down Expand Up @@ -28,5 +45,5 @@ public static GasCalculatorType fromString(String type) {
}

Optional<Coin> getGasPrice();
void onBlock(Block block, List<TransactionReceipt> receipts);
void onBlock(Block block, List<TransactionReceipt> receipts);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of RskJ
* Copyright (C) 2017 RSK Labs Ltd.
* Copyright (C) 2024 RSK Labs Ltd.
* (derived from ethereumJ library, Copyright (c) 2016 <ether.camp>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This file is part of RskJ
* Copyright (C) 2024 RSK Labs Ltd.
* (derived from ethereumJ library, Copyright (c) 2016 <ether.camp>)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.ethereum.listener;

import co.rsk.core.Coin;
Expand Down

0 comments on commit 098883d

Please sign in to comment.