1
0
Fork 0
forked from lthn/blockchain

fixed http state machine, fixed wallet bug with tor connectivity failure

This commit is contained in:
cryptozoidberg 2022-04-10 19:46:43 +02:00
parent 0fe6d2c526
commit dc61500a46
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
3 changed files with 9 additions and 2 deletions

View file

@ -831,7 +831,7 @@ using namespace std;
return false;
}else
{ //Apparently there are no signs of the form of transfer, will receive data until the connection is closed
m_state = reciev_machine_state_error;
m_state = reciev_machine_state_body_connection_close;
LOG_PRINT("Undefinded transfer type, consider http_body_transfer_connection_close method. header: " << m_header_cache, LOG_LEVEL_2);
return false;
}

@ -1 +1 @@
Subproject commit 93d717aebc9ef56e1a9eaefc9d137574bda0038c
Subproject commit 19c9c5d79d40b7bde08598cf994ca0599803f489

View file

@ -4612,6 +4612,7 @@ void wallet2::send_transaction_to_network(const transaction& tx)
//make few attempts
tools::levin_over_tor_client p2p_client;
p2p_client.get_transport().set_notifier(this);
bool succeseful_sent = false;
for (size_t i = 0; i != 3; i++)
{
if (!p2p_client.connect("144.76.183.143", 2121, 10000))
@ -4629,12 +4630,18 @@ void wallet2::send_transaction_to_network(const transaction& tx)
if (p2p_rsp.code == API_RETURN_CODE_OK)
{
this->notify_state_change(WALLET_LIB_SENT_SUCCESS);
succeseful_sent = true;
break;
}
this->notify_state_change(WALLET_LIB_SEND_FAILED);
//checking if transaction got relayed to other nodes and
//return;
}
if (!succeseful_sent)
{
this->notify_state_change(WALLET_LIB_SEND_FAILED);
THROW_IF_FALSE_WALLET_EX(succeseful_sent, error::no_connection_to_daemon, "Faile to build TOR stream");
}
}
else
{