diff --git a/rskj-core/src/main/java/co/rsk/RskContext.java b/rskj-core/src/main/java/co/rsk/RskContext.java index 043034f1c85..8caf3b324f4 100644 --- a/rskj-core/src/main/java/co/rsk/RskContext.java +++ b/rskj-core/src/main/java/co/rsk/RskContext.java @@ -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; diff --git a/rskj-core/src/main/java/co/rsk/config/RskSystemProperties.java b/rskj-core/src/main/java/co/rsk/config/RskSystemProperties.java index 4e99eb385d9..05cac5fa073 100644 --- a/rskj-core/src/main/java/co/rsk/config/RskSystemProperties.java +++ b/rskj-core/src/main/java/co/rsk/config/RskSystemProperties.java @@ -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; @@ -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; } diff --git a/rskj-core/src/main/java/org/ethereum/listener/GasCalculator.java b/rskj-core/src/main/java/org/ethereum/listener/GasCalculator.java index ff2c0a9f107..c69502ba42e 100644 --- a/rskj-core/src/main/java/org/ethereum/listener/GasCalculator.java +++ b/rskj-core/src/main/java/org/ethereum/listener/GasCalculator.java @@ -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 . + */ package org.ethereum.listener; import co.rsk.core.Coin; @@ -28,5 +45,5 @@ public static GasCalculatorType fromString(String type) { } Optional getGasPrice(); - void onBlock(Block block, List receipts); + void onBlock(Block block, List receipts); } diff --git a/rskj-core/src/main/java/org/ethereum/listener/GasWeightedCalc.java b/rskj-core/src/main/java/org/ethereum/listener/GasWeightedCalc.java index fdfaf71e1a8..85a23ff027b 100644 --- a/rskj-core/src/main/java/org/ethereum/listener/GasWeightedCalc.java +++ b/rskj-core/src/main/java/org/ethereum/listener/GasWeightedCalc.java @@ -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 ) * * This program is free software: you can redistribute it and/or modify diff --git a/rskj-core/src/main/java/org/ethereum/listener/LegacyGasCalculator.java b/rskj-core/src/main/java/org/ethereum/listener/LegacyGasCalculator.java index 01c99fa0aa6..766accedb1d 100644 --- a/rskj-core/src/main/java/org/ethereum/listener/LegacyGasCalculator.java +++ b/rskj-core/src/main/java/org/ethereum/listener/LegacyGasCalculator.java @@ -1,3 +1,21 @@ +/* + * This file is part of RskJ + * Copyright (C) 2024 RSK Labs Ltd. + * (derived from ethereumJ library, Copyright (c) 2016 ) + * + * 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 . + */ package org.ethereum.listener; import co.rsk.core.Coin;