mirror of
https://github.com/monero-project/monero.git
synced 2025-12-11 01:21:28 +09:00
Merge pull request #9901
9a45208 Daemon RPC: add max_block_count field to /getblocks.bin (j-berman)
This commit is contained in:
commit
a440e91790
@ -710,12 +710,13 @@ namespace cryptonote
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t max_blocks = COMMAND_RPC_GET_BLOCKS_FAST_MAX_BLOCK_COUNT;
|
size_t max_blocks = req.max_block_count > 0
|
||||||
|
? std::min(req.max_block_count, (uint64_t)COMMAND_RPC_GET_BLOCKS_FAST_MAX_BLOCK_COUNT)
|
||||||
|
: COMMAND_RPC_GET_BLOCKS_FAST_MAX_BLOCK_COUNT;
|
||||||
|
|
||||||
if (m_rpc_payment)
|
if (m_rpc_payment)
|
||||||
{
|
{
|
||||||
max_blocks = res.credits / COST_PER_BLOCK;
|
max_blocks = std::min((size_t)(res.credits / COST_PER_BLOCK), max_blocks);
|
||||||
if (max_blocks > COMMAND_RPC_GET_BLOCKS_FAST_MAX_BLOCK_COUNT)
|
|
||||||
max_blocks = COMMAND_RPC_GET_BLOCKS_FAST_MAX_BLOCK_COUNT;
|
|
||||||
if (max_blocks == 0)
|
if (max_blocks == 0)
|
||||||
{
|
{
|
||||||
res.status = CORE_RPC_STATUS_PAYMENT_REQUIRED;
|
res.status = CORE_RPC_STATUS_PAYMENT_REQUIRED;
|
||||||
|
|||||||
@ -88,7 +88,7 @@ namespace cryptonote
|
|||||||
// advance which version they will stop working with
|
// advance which version they will stop working with
|
||||||
// Don't go over 32767 for any of these
|
// Don't go over 32767 for any of these
|
||||||
#define CORE_RPC_VERSION_MAJOR 3
|
#define CORE_RPC_VERSION_MAJOR 3
|
||||||
#define CORE_RPC_VERSION_MINOR 14
|
#define CORE_RPC_VERSION_MINOR 15
|
||||||
#define MAKE_CORE_RPC_VERSION(major,minor) (((major)<<16)|(minor))
|
#define MAKE_CORE_RPC_VERSION(major,minor) (((major)<<16)|(minor))
|
||||||
#define CORE_RPC_VERSION MAKE_CORE_RPC_VERSION(CORE_RPC_VERSION_MAJOR, CORE_RPC_VERSION_MINOR)
|
#define CORE_RPC_VERSION MAKE_CORE_RPC_VERSION(CORE_RPC_VERSION_MAJOR, CORE_RPC_VERSION_MINOR)
|
||||||
|
|
||||||
@ -177,6 +177,8 @@ namespace cryptonote
|
|||||||
bool prune;
|
bool prune;
|
||||||
bool no_miner_tx;
|
bool no_miner_tx;
|
||||||
uint64_t pool_info_since;
|
uint64_t pool_info_since;
|
||||||
|
uint64_t max_block_count;
|
||||||
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE_PARENT(rpc_access_request_base)
|
KV_SERIALIZE_PARENT(rpc_access_request_base)
|
||||||
KV_SERIALIZE_OPT(requested_info, (uint8_t)0)
|
KV_SERIALIZE_OPT(requested_info, (uint8_t)0)
|
||||||
@ -185,6 +187,7 @@ namespace cryptonote
|
|||||||
KV_SERIALIZE(prune)
|
KV_SERIALIZE(prune)
|
||||||
KV_SERIALIZE_OPT(no_miner_tx, false)
|
KV_SERIALIZE_OPT(no_miner_tx, false)
|
||||||
KV_SERIALIZE_OPT(pool_info_since, (uint64_t)0)
|
KV_SERIALIZE_OPT(pool_info_since, (uint64_t)0)
|
||||||
|
KV_SERIALIZE_OPT(max_block_count, (uint64_t)0)
|
||||||
END_KV_SERIALIZE_MAP()
|
END_KV_SERIALIZE_MAP()
|
||||||
};
|
};
|
||||||
typedef epee::misc_utils::struct_init<request_t> request;
|
typedef epee::misc_utils::struct_init<request_t> request;
|
||||||
|
|||||||
@ -98,6 +98,7 @@ BEGIN_RPC_MESSAGE_CLASS(GetBlocksFast);
|
|||||||
RPC_MESSAGE_MEMBER(uint64_t, start_height);
|
RPC_MESSAGE_MEMBER(uint64_t, start_height);
|
||||||
RPC_MESSAGE_MEMBER(uint64_t, current_height);
|
RPC_MESSAGE_MEMBER(uint64_t, current_height);
|
||||||
RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::block_output_indices>, output_indices);
|
RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::block_output_indices>, output_indices);
|
||||||
|
RPC_MESSAGE_MEMBER(uint64_t, max_block_count);
|
||||||
END_RPC_MESSAGE_RESPONSE;
|
END_RPC_MESSAGE_RESPONSE;
|
||||||
END_RPC_MESSAGE_CLASS;
|
END_RPC_MESSAGE_CLASS;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user