1
0
Fork 0
forked from lthn/blockchain

fixed errors in reporting state

This commit is contained in:
cryptozoidberg 2022-04-02 00:59:16 +03:00
parent ebd8a63477
commit 80197c2a26
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
3 changed files with 17 additions and 1 deletions

View file

@ -675,8 +675,15 @@ void simple_wallet::on_tor_status_change(const std::string& state)
human_message = "Successfully created stream";
else if (state == TOR_LIB_STATE_FAILED)
human_message = "Failed created stream";
else if (state == WALLET_LIB_STATE_SENDING)
human_message = "Sending transaction...";
else if (state == WALLET_LIB_SENT_SUCCESS)
human_message = "Successfully sent!";
else if (state == WALLET_LIB_SEND_FAILED)
human_message = "Sending failed";
message_writer(epee::log_space::console_color_yellow, true, std::string("TOR")) << human_message;
message_writer(epee::log_space::console_color_yellow, true, std::string("[TOR]: ")) << human_message;
}
//----------------------------------------------------------------------------------------------------
bool simple_wallet::refresh(const std::vector<std::string>& args)

View file

@ -4621,12 +4621,15 @@ void wallet2::send_transaction_to_network(const transaction& tx)
currency::NOTIFY_OR_INVOKE_NEW_TRANSACTIONS::request p2p_req = AUTO_VAL_INIT(p2p_req);
currency::NOTIFY_OR_INVOKE_NEW_TRANSACTIONS::response p2p_rsp = AUTO_VAL_INIT(p2p_rsp);
p2p_req.txs.push_back(t_serializable_object_to_blob(tx));
this->notify_state_change(WALLET_LIB_STATE_SENDING);
epee::net_utils::invoke_remote_command2(NOTIFY_OR_INVOKE_NEW_TRANSACTIONS::ID, p2p_req, p2p_rsp, p2p_client);
p2p_client.disconnect();
if (p2p_rsp.code == API_RETURN_CODE_OK)
{
this->notify_state_change(WALLET_LIB_SENT_SUCCESS);
break;
}
this->notify_state_change(WALLET_LIB_SEND_FAILED);
//checking if transaction got relayed to other nodes and
//return;
}

View file

@ -16,6 +16,12 @@
// TODO: get rid of all these types, leave only wallet_error with a string message and string/enum error designator
#define WALLET_LIB_STATE_SENDING "STATE_SENDING"
#define WALLET_LIB_SENT_SUCCESS "STATE_SENT_SUCCESS"
#define WALLET_LIB_SEND_FAILED "STATE_SEND_FAILED"
namespace tools
{
namespace error