rpc: add current block size to the getinfo call

This commit is contained in:
moneromooo-monero 2017-01-06 19:26:47 +00:00
parent dd580d7bc7
commit 9188b3468c
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
2 changed files with 5 additions and 1 deletions

View file

@ -143,6 +143,7 @@ namespace cryptonote
res.grey_peerlist_size = m_p2p.get_peerlist_manager().get_gray_peers_count(); res.grey_peerlist_size = m_p2p.get_peerlist_manager().get_gray_peers_count();
res.testnet = m_testnet; res.testnet = m_testnet;
res.cumulative_difficulty = m_core.get_blockchain_storage().get_db().get_block_cumulative_difficulty(res.height - 1); res.cumulative_difficulty = m_core.get_blockchain_storage().get_db().get_block_cumulative_difficulty(res.height - 1);
res.block_size_limit = m_core.get_blockchain_storage().get_current_cumulative_blocksize_limit();
res.status = CORE_RPC_STATUS_OK; res.status = CORE_RPC_STATUS_OK;
return true; return true;
} }
@ -1161,6 +1162,7 @@ namespace cryptonote
res.grey_peerlist_size = m_p2p.get_peerlist_manager().get_gray_peers_count(); res.grey_peerlist_size = m_p2p.get_peerlist_manager().get_gray_peers_count();
res.testnet = m_testnet; res.testnet = m_testnet;
res.cumulative_difficulty = m_core.get_blockchain_storage().get_db().get_block_cumulative_difficulty(res.height - 1); res.cumulative_difficulty = m_core.get_blockchain_storage().get_db().get_block_cumulative_difficulty(res.height - 1);
res.block_size_limit = m_core.get_blockchain_storage().get_current_cumulative_blocksize_limit();
res.status = CORE_RPC_STATUS_OK; res.status = CORE_RPC_STATUS_OK;
return true; return true;
} }

View file

@ -49,7 +49,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 1 #define CORE_RPC_VERSION_MAJOR 1
#define CORE_RPC_VERSION_MINOR 0 #define CORE_RPC_VERSION_MINOR 1
#define CORE_RPC_VERSION (((CORE_RPC_VERSION_MAJOR)<<16)|(CORE_RPC_VERSION_MINOR)) #define CORE_RPC_VERSION (((CORE_RPC_VERSION_MAJOR)<<16)|(CORE_RPC_VERSION_MINOR))
struct COMMAND_RPC_GET_HEIGHT struct COMMAND_RPC_GET_HEIGHT
@ -512,6 +512,7 @@ namespace cryptonote
bool testnet; bool testnet;
std::string top_block_hash; std::string top_block_hash;
uint64_t cumulative_difficulty; uint64_t cumulative_difficulty;
uint64_t block_size_limit;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(status) KV_SERIALIZE(status)
@ -529,6 +530,7 @@ namespace cryptonote
KV_SERIALIZE(testnet) KV_SERIALIZE(testnet)
KV_SERIALIZE(top_block_hash) KV_SERIALIZE(top_block_hash)
KV_SERIALIZE(cumulative_difficulty) KV_SERIALIZE(cumulative_difficulty)
KV_SERIALIZE(block_size_limit)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
}; };