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
This commit is contained in:
+16
-31
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user