Skip to content

Commit

Permalink
Fix get raw transactions height parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
aivve committed Jun 18, 2023
1 parent a72eed0 commit 7dcd900
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Rpc/RpcServer.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers
// Copyright (c) 2014-2018, The Monero Project
// Copyright (c) 2016, The Forknote developers
// Copyright (c) 2016-2022, The Karbo developers
// Copyright (c) 2018-2023 Conceal Network & Conceal Devs
// Copyright (c) 2016-2023, The Karbo developers
//
// This file is part of Karbo.
//
Expand Down Expand Up @@ -1184,6 +1185,11 @@ bool RpcServer::on_get_transactions_with_output_global_indexes_by_heights(const
}
std::vector<uint32_t> range = req.heights;

if (range.back() < range.front()) {
throw JsonRpc::JsonRpcError{CORE_RPC_ERROR_CODE_WRONG_PARAM,
std::string("Invalid heights range: ") + std::to_string(range.front()) + " must be < " + std::to_string(range.back())};
}

if (range.back() - range.front() > BLOCK_LIST_MAX_COUNT) {
throw JsonRpc::JsonRpcError{ CORE_RPC_ERROR_CODE_WRONG_PARAM,
std::string("Requested blocks count: ") + std::to_string(range.back() - range.front()) + " exceeded max limit of " + std::to_string(BLOCK_LIST_MAX_COUNT) };
Expand Down

0 comments on commit 7dcd900

Please sign in to comment.