|
|
|
@ -1229,7 +1229,7 @@ namespace cryptonote
|
|
|
|
|
return reward;
|
|
|
|
|
}
|
|
|
|
|
//------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
bool core_rpc_server::fill_block_header_response(const block& blk, bool orphan_status, uint64_t height, const crypto::hash& hash, block_header_response& response)
|
|
|
|
|
bool core_rpc_server::fill_block_header_response(const block& blk, bool orphan_status, uint64_t height, const crypto::hash& hash, block_header_response& response, bool fill_pow_hash)
|
|
|
|
|
{
|
|
|
|
|
PERF_TIMER(fill_block_header_response);
|
|
|
|
|
response.major_version = blk.major_version;
|
|
|
|
@ -1245,6 +1245,7 @@ namespace cryptonote
|
|
|
|
|
response.reward = get_block_reward(blk);
|
|
|
|
|
response.block_size = m_core.get_blockchain_storage().get_db().get_block_size(height);
|
|
|
|
|
response.num_txes = blk.tx_hashes.size();
|
|
|
|
|
response.pow_hash = fill_pow_hash ? string_tools::pod_to_hex(get_block_longhash(blk, height)) : "";
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
@ -1334,7 +1335,7 @@ namespace cryptonote
|
|
|
|
|
error_resp.message = "Internal error: can't get last block.";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
bool response_filled = fill_block_header_response(last_block, false, last_block_height, last_block_hash, res.block_header);
|
|
|
|
|
bool response_filled = fill_block_header_response(last_block, false, last_block_height, last_block_hash, res.block_header, req.fill_pow_hash);
|
|
|
|
|
if (!response_filled)
|
|
|
|
|
{
|
|
|
|
|
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
|
|
|
@ -1375,7 +1376,7 @@ namespace cryptonote
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
uint64_t block_height = boost::get<txin_gen>(blk.miner_tx.vin.front()).height;
|
|
|
|
|
bool response_filled = fill_block_header_response(blk, orphan, block_height, block_hash, res.block_header);
|
|
|
|
|
bool response_filled = fill_block_header_response(blk, orphan, block_height, block_hash, res.block_header, req.fill_pow_hash);
|
|
|
|
|
if (!response_filled)
|
|
|
|
|
{
|
|
|
|
|
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
|
|
|
@ -1424,7 +1425,7 @@ namespace cryptonote
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
res.headers.push_back(block_header_response());
|
|
|
|
|
bool response_filled = fill_block_header_response(blk, false, block_height, block_hash, res.headers.back());
|
|
|
|
|
bool response_filled = fill_block_header_response(blk, false, block_height, block_hash, res.headers.back(), req.fill_pow_hash);
|
|
|
|
|
if (!response_filled)
|
|
|
|
|
{
|
|
|
|
|
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
|
|
|
@ -1457,7 +1458,7 @@ namespace cryptonote
|
|
|
|
|
error_resp.message = "Internal error: can't get block by height. Height = " + std::to_string(req.height) + '.';
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
bool response_filled = fill_block_header_response(blk, false, req.height, block_hash, res.block_header);
|
|
|
|
|
bool response_filled = fill_block_header_response(blk, false, req.height, block_hash, res.block_header, req.fill_pow_hash);
|
|
|
|
|
if (!response_filled)
|
|
|
|
|
{
|
|
|
|
|
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
|
|
|
@ -1511,7 +1512,7 @@ namespace cryptonote
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
uint64_t block_height = boost::get<txin_gen>(blk.miner_tx.vin.front()).height;
|
|
|
|
|
bool response_filled = fill_block_header_response(blk, orphan, block_height, block_hash, res.block_header);
|
|
|
|
|
bool response_filled = fill_block_header_response(blk, orphan, block_height, block_hash, res.block_header, req.fill_pow_hash);
|
|
|
|
|
if (!response_filled)
|
|
|
|
|
{
|
|
|
|
|
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
|
|
|
|