diff --git a/html/js/config.js b/html/js/config.js index 784a9c304..0ec452b15 100755 --- a/html/js/config.js +++ b/html/js/config.js @@ -1,5 +1,6 @@ var config = { - apiUrl: "http://127.0.0.1:1984/", + apiUrl: "http://0.0.0.0:1984/", + //apiUrl: "http://127.0.0.1:1984/", mainnetExplorerUrl: "https://xmrchain.com/", testnetExplorerUrl: "https://testnet.xmrchain.com/", stagenetExplorerUrl: "http://139.162.60.17:8082/", diff --git a/src/CurrentBlockchainStatus.cpp b/src/CurrentBlockchainStatus.cpp index cd33609e9..f3d2d3f9c 100755 --- a/src/CurrentBlockchainStatus.cpp +++ b/src/CurrentBlockchainStatus.cpp @@ -822,7 +822,10 @@ CurrentBlockchainStatus::start_tx_search_thread( } catch (const std::exception& e) { - OMERROR << "Faild created a search thread: " << e.what(); + OMERROR << acc.address.substr(0,6) + << ": Faild created a search thread: " + << e.what(); + return false; } diff --git a/src/OpenMoneroRequests.cpp b/src/OpenMoneroRequests.cpp index dab313106..57431f3c9 100755 --- a/src/OpenMoneroRequests.cpp +++ b/src/OpenMoneroRequests.cpp @@ -135,15 +135,19 @@ OpenMoneroRequests::login(const shared_ptr session, const Bytes & body) if (login_and_start_search_thread(xmr_address, view_key, *acc, j_response)) { // if successfuly logged in and created search thread - j_response["status"] = "success"; + j_response["status"] = "success"; - // we overwrite what ever was sent in login_and_start_search_thread + // we overwrite what ever was sent in login_and_start_search_thread // for the j_response["new_address"]. - j_response["new_address"] = new_account_created; + j_response["new_address"] = new_account_created; } else { // some error with loggin in or search thread start + OMERROR << xmr_address.substr(0,6) << ": " + << "login_and_start_search_thread failed. " + << j_response.dump(); + session_close(session, j_response); return; @@ -206,12 +210,7 @@ OpenMoneroRequests::ping(const shared_ptr session, const Bytes & body) j_response["status"] = "success"; - string response_body = j_response.dump(); - - auto response_headers = make_headers({{ "Content-Length", - to_string(response_body.size())}}); - - session->close(OK, response_body, response_headers); + session_close(session, j_response); } void @@ -2145,8 +2144,13 @@ OpenMoneroRequests::create_account( if (xmr_accounts->select(xmr_address, *acc)) { // if acc already exist, just return - // existing one - return acc; + // existing oneo + + OMINFO << xmr_address.substr(0,6) + << ": account already exists. " + << "Return existing account"; + + return *acc; } uint64_t current_blockchain_height = get_current_blockchain_height(); @@ -2215,7 +2219,9 @@ OpenMoneroRequests::create_account( if ((acc_id = xmr_accounts->insert(*acc)) == 0) { // if creating account failed - OMERROR << xmr_address.substr(0,6) + ": account creation failed"; + OMERROR << xmr_address.substr(0,6) + << ": account creation failed: " + << (*acc) ; return {}; } @@ -2244,16 +2250,27 @@ OpenMoneroRequests::select_account( ": address does not exists"; if (!create_if_notfound) + { + OMINFO << "create_if_notfound is false"; return {}; + } // for this address if (!(acc = create_account(xmr_address, view_key))) + { + OMERROR << xmr_address.substr(0,6) + << ": create_account failed"; return {}; + } // once account has been created // make and start a search thread for it if (!make_search_thread(*acc)) + { + OMERROR << xmr_address.substr(0,6) + << ": make_search_thread failed"; return {}; + } } // also need to check if view key matches diff --git a/src/TxSearch.cpp b/src/TxSearch.cpp index a03bbd191..bfb9fd95d 100755 --- a/src/TxSearch.cpp +++ b/src/TxSearch.cpp @@ -391,7 +391,11 @@ for (auto const& tx_tuple: txs_data) if (no_rows_inserted == 0) { - throw TxSearchException("no_rows_inserted is zero!"); + OMERROR << address_prefix + << ": insert outputs_found: no_rows_inserted is zero!" + << outputs_found; + + throw TxSearchException("insert output_found: no_rows_inserted is zero!"); } } // if (!found_mine_outputs.empty()) @@ -572,11 +576,15 @@ for (auto const& tx_tuple: txs_data) uint64_t no_rows_inserted = xmr_accounts->insert(inputs_found); - + if (no_rows_inserted == 0) { + OMERROR << address_prefix + << ": insert inputs_found: no_rows_inserted is zero!" + << inputs_found; + throw TxSearchException( - "no_rows_inserted is zero!"); + "insert inputs_found: no_rows_inserted is zero!"); } } // if (!inputs_found.empty())