mirror of
https://github.com/monero-project/monero.git
synced 2025-01-03 17:40:06 +00:00
rpc: make fill_pow restricted
It's slow work, so let's not expose it
This commit is contained in:
parent
48f721748a
commit
20f732cd86
1 changed files with 10 additions and 5 deletions
|
@ -1347,7 +1347,8 @@ namespace cryptonote
|
||||||
error_resp.message = "Internal error: can't get last block.";
|
error_resp.message = "Internal error: can't get last block.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool response_filled = fill_block_header_response(last_block, false, last_block_height, last_block_hash, res.block_header, req.fill_pow_hash);
|
const bool restricted = m_restricted && ctx;
|
||||||
|
bool response_filled = fill_block_header_response(last_block, false, last_block_height, last_block_hash, res.block_header, req.fill_pow_hash && !restricted);
|
||||||
if (!response_filled)
|
if (!response_filled)
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||||
|
@ -1388,7 +1389,8 @@ namespace cryptonote
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint64_t block_height = boost::get<txin_gen>(blk.miner_tx.vin.front()).height;
|
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, req.fill_pow_hash);
|
const bool restricted = m_restricted && ctx;
|
||||||
|
bool response_filled = fill_block_header_response(blk, orphan, block_height, block_hash, res.block_header, req.fill_pow_hash && !restricted);
|
||||||
if (!response_filled)
|
if (!response_filled)
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||||
|
@ -1437,7 +1439,8 @@ namespace cryptonote
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
res.headers.push_back(block_header_response());
|
res.headers.push_back(block_header_response());
|
||||||
bool response_filled = fill_block_header_response(blk, false, block_height, block_hash, res.headers.back(), req.fill_pow_hash);
|
const bool restricted = m_restricted && ctx;
|
||||||
|
bool response_filled = fill_block_header_response(blk, false, block_height, block_hash, res.headers.back(), req.fill_pow_hash && !restricted);
|
||||||
if (!response_filled)
|
if (!response_filled)
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||||
|
@ -1470,7 +1473,8 @@ namespace cryptonote
|
||||||
error_resp.message = "Internal error: can't get block by height. Height = " + std::to_string(req.height) + '.';
|
error_resp.message = "Internal error: can't get block by height. Height = " + std::to_string(req.height) + '.';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool response_filled = fill_block_header_response(blk, false, req.height, block_hash, res.block_header, req.fill_pow_hash);
|
const bool restricted = m_restricted && ctx;
|
||||||
|
bool response_filled = fill_block_header_response(blk, false, req.height, block_hash, res.block_header, req.fill_pow_hash && !restricted);
|
||||||
if (!response_filled)
|
if (!response_filled)
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||||
|
@ -1524,7 +1528,8 @@ namespace cryptonote
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint64_t block_height = boost::get<txin_gen>(blk.miner_tx.vin.front()).height;
|
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, req.fill_pow_hash);
|
const bool restricted = m_restricted && ctx;
|
||||||
|
bool response_filled = fill_block_header_response(blk, orphan, block_height, block_hash, res.block_header, req.fill_pow_hash && !restricted);
|
||||||
if (!response_filled)
|
if (!response_filled)
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||||
|
|
Loading…
Reference in a new issue