From 7700738e8c331c1d077d6ba63657cf4504a55438 Mon Sep 17 00:00:00 2001 From: Oleh Nikolaiev Date: Wed, 22 Nov 2023 16:50:56 +0000 Subject: [PATCH] #1702 change [] to at() --- libethereum/Client.cpp | 2 +- libethereum/Client.h | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index 0822ba107..00c90351c 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -1327,7 +1327,7 @@ void Client::initHistoricGroupIndex() { void Client::updateHistoricGroupIndex() { uint64_t blockTimestamp = blockInfo( hashFromNumber( number() ) ).timestamp(); - uint64_t currentFinishTs = chainParams().sChain.nodeGroups[historicGroupIndex].finishTs; + uint64_t currentFinishTs = chainParams().sChain.nodeGroups.at( historicGroupIndex ).finishTs; if ( blockTimestamp >= currentFinishTs ) ++historicGroupIndex; if ( historicGroupIndex >= chainParams().sChain.nodeGroups.size() ) { diff --git a/libethereum/Client.h b/libethereum/Client.h index 6ad196a0d..4a1b3fb8d 100644 --- a/libethereum/Client.h +++ b/libethereum/Client.h @@ -297,22 +297,25 @@ class Client : public ClientBase, protected Worker { } std::array< std::string, 4 > getIMABLSPublicKey() const { - return chainParams().sChain.nodeGroups[historicGroupIndex].blsPublicKey; + return chainParams().sChain.nodeGroups.at( historicGroupIndex ).blsPublicKey; } // get node id for historic node in chain std::string getHistoricNodeId( unsigned _id ) const { - return chainParams().sChain.nodeGroups[historicGroupIndex].nodes[_id].id.str(); + return chainParams().sChain.nodeGroups.at( historicGroupIndex ).nodes[_id].id.str(); } // get schain index for historic node in chain std::string getHistoricNodeIndex( unsigned _idx ) const { - return chainParams().sChain.nodeGroups[historicGroupIndex].nodes[_idx].schainIndex.str(); + return chainParams() + .sChain.nodeGroups.at( historicGroupIndex ) + .nodes[_idx] + .schainIndex.str(); } // get node owner for historic node in chain std::string getHistoricNodePublicKey( unsigned _idx ) const { - return chainParams().sChain.nodeGroups[historicGroupIndex].nodes[_idx].publicKey; + return chainParams().sChain.nodeGroups.at( historicGroupIndex ).nodes[_idx].publicKey; } void doStateDbCompaction() const { m_state.getOriginalDb()->doCompaction(); }