diff options
author | Thomas Winget <tewinget@gmail.com> | 2017-09-05 12:20:40 -0400 |
---|---|---|
committer | Thomas Winget <tewinget@gmail.com> | 2017-09-05 12:20:40 -0400 |
commit | 0299cb77ca18073daf3cf371f8da013fb596ae48 (patch) | |
tree | 14aa3b3c6ddbdf064246bb3800fec3e90c9b609d /src/rpc/daemon_messages.h | |
parent | json serialization for rpc-relevant monero types (diff) | |
download | monero-0299cb77ca18073daf3cf371f8da013fb596ae48.tar.xz |
Fix various oversights/bugs in ZMQ RPC server code
- Add some RPC commands (and touch up a couple others)
- some bounds checking
- some better pointer management
- const correctness and error handling
-- Thanks @vtnerd for type help with serialization and CMake changes
Diffstat (limited to 'src/rpc/daemon_messages.h')
-rw-r--r-- | src/rpc/daemon_messages.h | 47 |
1 files changed, 16 insertions, 31 deletions
diff --git a/src/rpc/daemon_messages.h b/src/rpc/daemon_messages.h index adcd7f7c6..685f66843 100644 --- a/src/rpc/daemon_messages.h +++ b/src/rpc/daemon_messages.h @@ -89,6 +89,7 @@ BEGIN_RPC_MESSAGE_CLASS(GetBlocksFast); BEGIN_RPC_MESSAGE_REQUEST; RPC_MESSAGE_MEMBER(std::list<crypto::hash>, block_ids); RPC_MESSAGE_MEMBER(uint64_t, start_height); + RPC_MESSAGE_MEMBER(bool, prune); END_RPC_MESSAGE_REQUEST; BEGIN_RPC_MESSAGE_RESPONSE; RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::block_with_transactions>, blocks); @@ -171,10 +172,11 @@ END_RPC_MESSAGE_CLASS; BEGIN_RPC_MESSAGE_CLASS(StartMining); BEGIN_RPC_MESSAGE_REQUEST; RPC_MESSAGE_MEMBER(std::string, miner_address); - RPC_MESSAGE_MEMBER(uint64_t, thread_count); + RPC_MESSAGE_MEMBER(uint64_t, threads_count); + RPC_MESSAGE_MEMBER(bool, do_background_mining); + RPC_MESSAGE_MEMBER(bool, ignore_battery); END_RPC_MESSAGE_REQUEST; BEGIN_RPC_MESSAGE_RESPONSE; - RPC_MESSAGE_MEMBER(bool, success); END_RPC_MESSAGE_RESPONSE; END_RPC_MESSAGE_CLASS; @@ -182,19 +184,7 @@ BEGIN_RPC_MESSAGE_CLASS(GetInfo); BEGIN_RPC_MESSAGE_REQUEST; END_RPC_MESSAGE_REQUEST; BEGIN_RPC_MESSAGE_RESPONSE; - RPC_MESSAGE_MEMBER(uint64_t, height); - RPC_MESSAGE_MEMBER(uint64_t, target_height); - RPC_MESSAGE_MEMBER(uint64_t, difficulty); - RPC_MESSAGE_MEMBER(uint64_t, target); - RPC_MESSAGE_MEMBER(uint64_t, tx_count); - RPC_MESSAGE_MEMBER(uint64_t, tx_pool_size); - RPC_MESSAGE_MEMBER(uint64_t, alt_blocks_count); - RPC_MESSAGE_MEMBER(uint64_t, outgoing_connections_count); - RPC_MESSAGE_MEMBER(uint64_t, incoming_connections_count); - RPC_MESSAGE_MEMBER(uint64_t, white_peerlist_size); - RPC_MESSAGE_MEMBER(uint64_t, grey_peerlist_size); - RPC_MESSAGE_MEMBER(bool, testnet); - RPC_MESSAGE_MEMBER(crypto::hash, top_block_hash); + RPC_MESSAGE_MEMBER(DaemonInfo, info); END_RPC_MESSAGE_RESPONSE; END_RPC_MESSAGE_CLASS; @@ -202,7 +192,6 @@ BEGIN_RPC_MESSAGE_CLASS(StopMining); BEGIN_RPC_MESSAGE_REQUEST; END_RPC_MESSAGE_REQUEST; BEGIN_RPC_MESSAGE_RESPONSE; - RPC_MESSAGE_MEMBER(bool, success); END_RPC_MESSAGE_RESPONSE; END_RPC_MESSAGE_CLASS; @@ -212,8 +201,9 @@ BEGIN_RPC_MESSAGE_CLASS(MiningStatus); BEGIN_RPC_MESSAGE_RESPONSE; RPC_MESSAGE_MEMBER(bool, active); RPC_MESSAGE_MEMBER(uint64_t, speed); - RPC_MESSAGE_MEMBER(uint64_t, thread_count); + RPC_MESSAGE_MEMBER(uint64_t, threads_count); RPC_MESSAGE_MEMBER(std::string, address); + RPC_MESSAGE_MEMBER(bool, is_background_mining_enabled); END_RPC_MESSAGE_RESPONSE; END_RPC_MESSAGE_CLASS; @@ -273,6 +263,15 @@ BEGIN_RPC_MESSAGE_CLASS(GetBlockHeaderByHeight); END_RPC_MESSAGE_RESPONSE; END_RPC_MESSAGE_CLASS; +BEGIN_RPC_MESSAGE_CLASS(GetBlockHeadersByHeight); + BEGIN_RPC_MESSAGE_REQUEST; + RPC_MESSAGE_MEMBER(std::vector<uint64_t>, heights); + END_RPC_MESSAGE_REQUEST; + BEGIN_RPC_MESSAGE_RESPONSE; + RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::BlockHeaderResponse>, headers); + END_RPC_MESSAGE_RESPONSE; +END_RPC_MESSAGE_CLASS; + BEGIN_RPC_MESSAGE_CLASS(GetBlock); BEGIN_RPC_MESSAGE_REQUEST; END_RPC_MESSAGE_REQUEST; @@ -334,20 +333,6 @@ BEGIN_RPC_MESSAGE_CLASS(StopDaemon); END_RPC_MESSAGE_RESPONSE; END_RPC_MESSAGE_CLASS; -BEGIN_RPC_MESSAGE_CLASS(FastExit); - BEGIN_RPC_MESSAGE_REQUEST; - END_RPC_MESSAGE_REQUEST; - BEGIN_RPC_MESSAGE_RESPONSE; - END_RPC_MESSAGE_RESPONSE; -END_RPC_MESSAGE_CLASS; - -BEGIN_RPC_MESSAGE_CLASS(OutPeers); - BEGIN_RPC_MESSAGE_REQUEST; - END_RPC_MESSAGE_REQUEST; - BEGIN_RPC_MESSAGE_RESPONSE; - END_RPC_MESSAGE_RESPONSE; -END_RPC_MESSAGE_CLASS; - BEGIN_RPC_MESSAGE_CLASS(StartSaveGraph); BEGIN_RPC_MESSAGE_REQUEST; END_RPC_MESSAGE_REQUEST; |