From e1cd7e10d8ea6dfb1d3abd38c79203e6128181dd Mon Sep 17 00:00:00 2001 From: sowle Date: Sat, 8 Aug 2020 15:12:21 +0300 Subject: [PATCH] find_key_image improved --- src/daemon/daemon_commands_handler.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/daemon/daemon_commands_handler.h b/src/daemon/daemon_commands_handler.h index 844da14f..b6ede7e7 100644 --- a/src/daemon/daemon_commands_handler.h +++ b/src/daemon/daemon_commands_handler.h @@ -317,21 +317,24 @@ private: std::cout << "specified key_image parameter '" << args[0] << "' is wrong" << ENDL; return false; } + + currency::blockchain_storage& bcs = m_srv.get_payload_object().get_core().get_blockchain_storage(); + std::list res_list; crypto::hash tx_id = currency::null_hash; - auto tx_chain_entry = m_srv.get_payload_object().get_core().get_blockchain_storage().find_key_image_and_related_tx(ki, tx_id); + auto tx_chain_entry = bcs.find_key_image_and_related_tx(ki, tx_id); if (tx_chain_entry) { - LOG_PRINT_L0("Found tx: " << ENDL << obj_to_json_str(tx_chain_entry->tx) << ENDL << "height: " << tx_chain_entry->m_keeper_block_height); - } - if (tx_id == currency::null_hash) - { - LOG_PRINT_L0("Not found any related tx."); + currency::block_extended_info bei = AUTO_VAL_INIT(bei); + CHECK_AND_ASSERT_MES(bcs.get_block_extended_info_by_height(tx_chain_entry->m_keeper_block_height, bei), false, "cannot find block by height " << tx_chain_entry->m_keeper_block_height); + + LOG_PRINT_L0("Key image found in tx: " << tx_id << " height " << tx_chain_entry->m_keeper_block_height << " (ts: " << epee::misc_utils::get_time_str_v2(currency::get_actual_timestamp(bei.bl)) << ")" << ENDL + << obj_to_json_str(tx_chain_entry->tx)); } else { - LOG_PRINT_L0("TxID: " << tx_id); + LOG_PRINT_L0("Not found any related tx."); } return true; }