Skip to content

Commit

Permalink
Merge pull request #2576 from Taraxa-project/fix-rpc-get-block
Browse files Browse the repository at this point in the history
hotfix: for getting block with transactions
  • Loading branch information
MatusKysel authored Sep 29, 2023
2 parents 43ab0f9 + 7f9ff22 commit d102bb5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.20)
# Set current version of the project
set(TARAXA_MAJOR_VERSION 1)
set(TARAXA_MINOR_VERSION 4)
set(TARAXA_PATCH_VERSION 5)
set(TARAXA_PATCH_VERSION 6)
set(TARAXA_VERSION ${TARAXA_MAJOR_VERSION}.${TARAXA_MINOR_VERSION}.${TARAXA_PATCH_VERSION})

# Any time a change in the network protocol is introduced this version should be increased
Expand Down
2 changes: 1 addition & 1 deletion libraries/config/src/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void ConnectionConfig::validate() const {
}

// Max enabled number of threads for processing rpc requests
constexpr uint16_t MAX_RPC_THREADS_NUM = 10;
constexpr uint16_t MAX_RPC_THREADS_NUM = 20;
if (threads_num <= 0 || threads_num > MAX_RPC_THREADS_NUM) {
throw ConfigException(std::string("threads_num must be in range (0, ") + std::to_string(MAX_RPC_THREADS_NUM) + "]");
}
Expand Down
14 changes: 6 additions & 8 deletions libraries/core_libs/consensus/src/final_chain/final_chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "final_chain/cache.hpp"
#include "final_chain/rewards_stats.hpp"
#include "final_chain/trie_common.hpp"
#include "pbft/pbft_manager.hpp"
#include "vote/vote.hpp"

namespace taraxa::final_chain {
Expand Down Expand Up @@ -457,15 +458,12 @@ class FinalChainImpl final : public FinalChain {
}

const SharedTransactions get_transactions(std::optional<EthBlockNumber> n = {}) const {
SharedTransactions ret;
auto hashes = transaction_hashes(n);
ret.reserve(hashes->size());
for (size_t i = 0; i < ret.capacity(); ++i) {
auto trx = db_->getTransaction(hashes->at(i));
assert(trx);
ret.emplace_back(trx);
if (auto trxs = db_->getPeriodTransactions(last_if_absent(n))) {
// TODO[2495]: remove after a proper fix of transactions ordering in PeriodData
PbftManager::reorderTransactions(*trxs);
return *trxs;
}
return ret;
return {};
}

std::shared_ptr<const BlockHeader> get_block_header(EthBlockNumber n) const {
Expand Down
2 changes: 1 addition & 1 deletion libraries/core_libs/network/rpc/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Json::Value Debug::trace_replayBlockTransactions(const std::string& block_num, c
res["status"] = "Block has no transactions";
return res;
}
// TODO[2495]: remove after a proper fox of transactions ordering in PeriodData
// TODO[2495]: remove after a proper fix of transactions ordering in PeriodData
PbftManager::reorderTransactions(*transactions);
std::vector<state_api::EVMTransaction> trxs;
trxs.reserve(transactions->size());
Expand Down

0 comments on commit d102bb5

Please sign in to comment.