handle errors in geth webscoket replies, save signatures

This commit is contained in:
Pavel Baykov 2022-06-07 07:23:53 -03:00
parent 1bfa8dba14
commit 4e9d5805f9
2 changed files with 8 additions and 0 deletions

View file

@ -131,6 +131,7 @@ private:
ethereum_function_call_encoder m_ethereum_function_call_encoder;
std::string signature;
std::string geth_url;
uint64_t t_id;
std::string account_address;

View file

@ -140,6 +140,12 @@ void eth_rpc_client::on_message(websocketpp::connection_hdl hdl, message_ptr msg
ilog("json reposnse: ${list}", ("list", list));
const auto& b_obj = list[0].get_object().find( "id" );
if (true == list[0].get_object().contains( "error" )){
elog("error in json reposnse: ${list}", ("list", list));
return;
}
std::string result_str = list[0].get_object().find( "result" )->value().as<std::string>(1);
uint32_t num_owners = 0;
uint32_t i = 0;
@ -167,6 +173,7 @@ void eth_rpc_client::on_message(websocketpp::connection_hdl hdl, message_ptr msg
balance = result_str;
break;
case ETH_SIGN:
signature = result_str;
break;
case ETH_COINBASE:
account_address = result_str;