From 77c6e85cbbced87c2c16073e4784934742231796 Mon Sep 17 00:00:00 2001 From: Oran Juice Date: Sat, 21 Mar 2015 11:56:33 +0530 Subject: [PATCH] Get output indexes works --- src/ipc/CMakeLists.txt | 4 +++- src/ipc/daemon_ipc_handlers.cpp | 2 +- src/ipc/include/wap_client_engine.inc | 2 -- src/ipc/wap_client/wap_client.c | 5 +++-- src/wallet/wallet2.cpp | 7 ++++--- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/ipc/CMakeLists.txt b/src/ipc/CMakeLists.txt index 6e2836cb3..40c04b62d 100644 --- a/src/ipc/CMakeLists.txt +++ b/src/ipc/CMakeLists.txt @@ -47,7 +47,8 @@ bitmonero_add_library(server_ipc target_link_libraries(server_ipc LINK_PRIVATE cryptonote_core - ${ZMQ_LIB}) + ${ZMQ_LIB} + ${CZMQ_LIB}) bitmonero_add_library(client_ipc ${client_ipc_sources} @@ -55,4 +56,5 @@ bitmonero_add_library(client_ipc target_link_libraries(client_ipc LINK_PRIVATE cryptonote_core + ${ZMQ_LIB} ${CZMQ_LIB}) diff --git a/src/ipc/daemon_ipc_handlers.cpp b/src/ipc/daemon_ipc_handlers.cpp index 0c1fbe58d..a6ad9d621 100644 --- a/src/ipc/daemon_ipc_handlers.cpp +++ b/src/ipc/daemon_ipc_handlers.cpp @@ -184,7 +184,7 @@ namespace IPC uint64_t *indexes = &output_indexes[0]; zframe_t *frame = zframe_new(indexes, sizeof(uint64_t) * output_indexes.size()); wap_proto_set_o_indexes(message, &frame); - wap_proto_set_status(message, 100); + wap_proto_set_status(message, STATUS_OK); } } } diff --git a/src/ipc/include/wap_client_engine.inc b/src/ipc/include/wap_client_engine.inc index 0889a375c..388029038 100644 --- a/src/ipc/include/wap_client_engine.inc +++ b/src/ipc/include/wap_client_engine.inc @@ -1664,8 +1664,6 @@ wap_client_tx_data (wap_client_t *self) zframe_t * wap_client_o_indexes (wap_client_t *self) { -printf("here1\n"); assert (self); -printf("here2\n"); return self->o_indexes; } diff --git a/src/ipc/wap_client/wap_client.c b/src/ipc/wap_client/wap_client.c index 095c96974..c0b465a44 100644 --- a/src/ipc/wap_client/wap_client.c +++ b/src/ipc/wap_client/wap_client.c @@ -252,8 +252,9 @@ signal_have_stop_ok (client_t *self) static void signal_have_output_indexes_ok (client_t *self) { - zsock_send(self->cmdpipe, "sip", "OUTPUT INDEXES OK", wap_proto_status(self->message), - wap_proto_o_indexes(self->message)); + zsock_send (self->cmdpipe, "s8p", "OUTPUT INDEXES OK", + wap_proto_status (self->message), + wap_proto_get_o_indexes (self->message)); } // --------------------------------------------------------------------------- diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index ffe235883..8498e1742 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -194,7 +194,7 @@ void wallet2::process_new_transaction(const cryptonote::transaction& tx, uint64_ uint64_t status = wap_client_status(client); THROW_WALLET_EXCEPTION_IF(status == IPC::STATUS_CORE_BUSY, error::daemon_busy, "get_output_indexes"); THROW_WALLET_EXCEPTION_IF(status == IPC::STATUS_INTERNAL_ERROR, error::daemon_internal_error, "get_output_indexes"); - THROW_WALLET_EXCEPTION_IF(status != 100, error::get_out_indices_error, "get_output_indexes"); + THROW_WALLET_EXCEPTION_IF(status != IPC::STATUS_OK, error::get_out_indices_error, "get_output_indexes"); zframe_t *frame = wap_client_o_indexes(client); THROW_WALLET_EXCEPTION_IF(!frame, error::get_out_indices_error, "get_output_indexes"); @@ -342,7 +342,6 @@ void wallet2::get_blocks_from_zmq_msg(zmsg_t *msg, std::list(zframe_data(frame)); rapidjson::Document json; - int _i = 0; THROW_WALLET_EXCEPTION_IF(json.Parse(block_data, size).HasParseError(), error::get_blocks_error, "getblocks"); for (rapidjson::SizeType i = 0; i < json["blocks"].Size(); i++) { block_complete_entry block_entry; @@ -383,7 +382,9 @@ void wallet2::pull_blocks(uint64_t start_height, size_t& blocks_added) THROW_WALLET_EXCEPTION_IF(status == IPC::STATUS_INTERNAL_ERROR, error::daemon_internal_error, "getblocks"); THROW_WALLET_EXCEPTION_IF(status != IPC::STATUS_OK, error::get_blocks_error, "getblocks"); std::list blocks; - get_blocks_from_zmq_msg(wap_client_block_data(client), blocks); + zmsg_t *msg = wap_client_block_data(client); + get_blocks_from_zmq_msg(msg, blocks); + uint64_t current_index = wap_client_start_height(client); BOOST_FOREACH(auto& bl_entry, blocks) {