Get output indexes works

This commit is contained in:
Oran Juice 2015-03-21 11:56:33 +05:30
parent a3ea924f89
commit 77c6e85cbb
No known key found for this signature in database
GPG Key ID: 71C5AF46CCB28124
5 changed files with 11 additions and 9 deletions

View File

@ -47,7 +47,8 @@ bitmonero_add_library(server_ipc
target_link_libraries(server_ipc target_link_libraries(server_ipc
LINK_PRIVATE LINK_PRIVATE
cryptonote_core cryptonote_core
${ZMQ_LIB}) ${ZMQ_LIB}
${CZMQ_LIB})
bitmonero_add_library(client_ipc bitmonero_add_library(client_ipc
${client_ipc_sources} ${client_ipc_sources}
@ -55,4 +56,5 @@ bitmonero_add_library(client_ipc
target_link_libraries(client_ipc target_link_libraries(client_ipc
LINK_PRIVATE LINK_PRIVATE
cryptonote_core cryptonote_core
${ZMQ_LIB}
${CZMQ_LIB}) ${CZMQ_LIB})

View File

@ -184,7 +184,7 @@ namespace IPC
uint64_t *indexes = &output_indexes[0]; uint64_t *indexes = &output_indexes[0];
zframe_t *frame = zframe_new(indexes, sizeof(uint64_t) * output_indexes.size()); zframe_t *frame = zframe_new(indexes, sizeof(uint64_t) * output_indexes.size());
wap_proto_set_o_indexes(message, &frame); wap_proto_set_o_indexes(message, &frame);
wap_proto_set_status(message, 100); wap_proto_set_status(message, STATUS_OK);
} }
} }
} }

View File

@ -1664,8 +1664,6 @@ wap_client_tx_data (wap_client_t *self)
zframe_t * zframe_t *
wap_client_o_indexes (wap_client_t *self) wap_client_o_indexes (wap_client_t *self)
{ {
printf("here1\n");
assert (self); assert (self);
printf("here2\n");
return self->o_indexes; return self->o_indexes;
} }

View File

@ -252,8 +252,9 @@ signal_have_stop_ok (client_t *self)
static void static void
signal_have_output_indexes_ok (client_t *self) signal_have_output_indexes_ok (client_t *self)
{ {
zsock_send(self->cmdpipe, "sip", "OUTPUT INDEXES OK", wap_proto_status(self->message), zsock_send (self->cmdpipe, "s8p", "OUTPUT INDEXES OK",
wap_proto_o_indexes(self->message)); wap_proto_status (self->message),
wap_proto_get_o_indexes (self->message));
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@ -194,7 +194,7 @@ void wallet2::process_new_transaction(const cryptonote::transaction& tx, uint64_
uint64_t status = wap_client_status(client); 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_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 == 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); zframe_t *frame = wap_client_o_indexes(client);
THROW_WALLET_EXCEPTION_IF(!frame, error::get_out_indices_error, "get_output_indexes"); 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<cryptonote::block_c
char *block_data = reinterpret_cast<char*>(zframe_data(frame)); char *block_data = reinterpret_cast<char*>(zframe_data(frame));
rapidjson::Document json; rapidjson::Document json;
int _i = 0;
THROW_WALLET_EXCEPTION_IF(json.Parse(block_data, size).HasParseError(), error::get_blocks_error, "getblocks"); 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++) { for (rapidjson::SizeType i = 0; i < json["blocks"].Size(); i++) {
block_complete_entry block_entry; 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_INTERNAL_ERROR, error::daemon_internal_error, "getblocks");
THROW_WALLET_EXCEPTION_IF(status != IPC::STATUS_OK, error::get_blocks_error, "getblocks"); THROW_WALLET_EXCEPTION_IF(status != IPC::STATUS_OK, error::get_blocks_error, "getblocks");
std::list<block_complete_entry> blocks; std::list<block_complete_entry> 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); uint64_t current_index = wap_client_start_height(client);
BOOST_FOREACH(auto& bl_entry, blocks) BOOST_FOREACH(auto& bl_entry, blocks)
{ {