aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/daemon_handler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc/daemon_handler.cpp')
-rw-r--r--src/rpc/daemon_handler.cpp47
1 files changed, 20 insertions, 27 deletions
diff --git a/src/rpc/daemon_handler.cpp b/src/rpc/daemon_handler.cpp
index 55858cc2a..26f102a8b 100644
--- a/src/rpc/daemon_handler.cpp
+++ b/src/rpc/daemon_handler.cpp
@@ -86,53 +86,45 @@ namespace rpc
res.error_details = "incorrect number of transactions retrieved for block";
return;
}
- std::vector<transaction> txs;
- for (const auto& p : it->second)
- {
- txs.resize(txs.size() + 1);
- if (!parse_and_validate_tx_from_blob(p.second, txs.back()))
- {
- res.blocks.clear();
- res.output_indices.clear();
- res.status = Message::STATUS_FAILED;
- res.error_details = "failed retrieving a requested transaction";
- return;
- }
- }
cryptonote::rpc::block_output_indices& indices = res.output_indices[block_count];
// miner tx output indices
{
cryptonote::rpc::tx_output_indices tx_indices;
- bool r = m_core.get_tx_outputs_gindexs(get_transaction_hash(bwt.block.miner_tx), tx_indices);
- if (!r)
+ if (!m_core.get_tx_outputs_gindexs(get_transaction_hash(bwt.block.miner_tx), tx_indices))
{
res.status = Message::STATUS_FAILED;
res.error_details = "core::get_tx_outputs_gindexs() returned false";
return;
}
- indices.push_back(tx_indices);
+ indices.push_back(std::move(tx_indices));
}
- // assume each block returned is returned with all its transactions
- // in the correct order.
- auto tx_it = txs.begin();
- for (const crypto::hash& h : bwt.block.tx_hashes)
+ auto hash_it = bwt.block.tx_hashes.begin();
+ bwt.transactions.reserve(it->second.size());
+ for (const auto& blob : it->second)
{
- bwt.transactions.emplace(h, *tx_it);
- tx_it++;
+ bwt.transactions.emplace_back();
+ if (!parse_and_validate_tx_from_blob(blob.second, bwt.transactions.back()))
+ {
+ res.blocks.clear();
+ res.output_indices.clear();
+ res.status = Message::STATUS_FAILED;
+ res.error_details = "failed retrieving a requested transaction";
+ return;
+ }
cryptonote::rpc::tx_output_indices tx_indices;
- bool r = m_core.get_tx_outputs_gindexs(h, tx_indices);
- if (!r)
+ if (!m_core.get_tx_outputs_gindexs(*hash_it, tx_indices))
{
res.status = Message::STATUS_FAILED;
res.error_details = "core::get_tx_outputs_gindexs() returned false";
return;
}
- indices.push_back(tx_indices);
+ indices.push_back(std::move(tx_indices));
+ ++hash_it;
}
it++;
@@ -480,7 +472,8 @@ namespace rpc
res.info.testnet = m_core.get_nettype() == TESTNET;
res.info.stagenet = m_core.get_nettype() == STAGENET;
res.info.cumulative_difficulty = m_core.get_blockchain_storage().get_db().get_block_cumulative_difficulty(res.info.height - 1);
- res.info.block_size_limit = m_core.get_blockchain_storage().get_current_cumulative_blocksize_limit();
+ res.info.block_size_limit = res.info.block_weight_limit = m_core.get_blockchain_storage().get_current_cumulative_block_weight_limit();
+ res.info.block_size_median = res.info.block_weight_median = m_core.get_blockchain_storage().get_current_cumulative_block_weight_median();
res.info.start_time = (uint64_t)m_core.get_start_time();
res.status = Message::STATUS_OK;
@@ -771,7 +764,7 @@ namespace rpc
void DaemonHandler::handle(const GetPerKBFeeEstimate::Request& req, GetPerKBFeeEstimate::Response& res)
{
- res.estimated_fee_per_kb = m_core.get_blockchain_storage().get_dynamic_per_kb_fee_estimate(req.num_grace_blocks);
+ res.estimated_fee_per_kb = m_core.get_blockchain_storage().get_dynamic_base_fee_estimate(req.num_grace_blocks);
res.status = Message::STATUS_OK;
}