|
|
@ -91,8 +91,7 @@ OpenMoneroRequests::login(const shared_ptr<Session> session, const Bytes & body)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// a placeholder for exciting or new account data
|
|
|
|
// a placeholder for exciting or new account data id
|
|
|
|
|
|
|
|
|
|
|
|
uint64_t acc_id {0};
|
|
|
|
uint64_t acc_id {0};
|
|
|
|
|
|
|
|
|
|
|
|
// marks if this is new account creation or not
|
|
|
|
// marks if this is new account creation or not
|
|
|
@ -120,7 +119,7 @@ OpenMoneroRequests::login(const shared_ptr<Session> session, const Bytes & body)
|
|
|
|
// set this flag to indicate that we have just created a
|
|
|
|
// set this flag to indicate that we have just created a
|
|
|
|
// new account in mysql. this information is sent to front-end
|
|
|
|
// new account in mysql. this information is sent to front-end
|
|
|
|
// as it can disply some greeting window to new users upon
|
|
|
|
// as it can disply some greeting window to new users upon
|
|
|
|
// their first install
|
|
|
|
// their first entry
|
|
|
|
new_account_created = true;
|
|
|
|
new_account_created = true;
|
|
|
|
|
|
|
|
|
|
|
|
} // if (!acc)
|
|
|
|
} // if (!acc)
|
|
|
@ -206,8 +205,16 @@ OpenMoneroRequests::get_address_txs(
|
|
|
|
|
|
|
|
|
|
|
|
// for this to continue, search thread must have already been
|
|
|
|
// for this to continue, search thread must have already been
|
|
|
|
// created and still exisits.
|
|
|
|
// created and still exisits.
|
|
|
|
if (login_and_start_search_thread(xmr_address, view_key, acc, j_response))
|
|
|
|
if (!login_and_start_search_thread(xmr_address, view_key, acc, j_response))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
j_response = json {{"status", "error"},
|
|
|
|
|
|
|
|
{"reason", "Search thread does not exist."}};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// some error with loggin in or search thread start
|
|
|
|
|
|
|
|
session_close(session, j_response);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// before fetching txs, check if provided view key
|
|
|
|
// before fetching txs, check if provided view key
|
|
|
|
// is correct. this is simply to ensure that
|
|
|
|
// is correct. this is simply to ensure that
|
|
|
|
// we cant fetch an account's txs using only address.
|
|
|
|
// we cant fetch an account's txs using only address.
|
|
|
@ -299,17 +306,6 @@ OpenMoneroRequests::get_address_txs(
|
|
|
|
|
|
|
|
|
|
|
|
} // if (xmr_accounts->select_txs_for_ac
|
|
|
|
} // if (xmr_accounts->select_txs_for_ac
|
|
|
|
|
|
|
|
|
|
|
|
} // if (current_bc_status->search_thread_exist(xmr_address))
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
j_response = json {{"status", "error"},
|
|
|
|
|
|
|
|
{"reason", "Search thread does not exist."}};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// some error with loggin in or search thread start
|
|
|
|
|
|
|
|
session_close(session, j_response);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// append txs found in mempool to the json returned
|
|
|
|
// append txs found in mempool to the json returned
|
|
|
|
|
|
|
|
|
|
|
|
json j_mempool_tx;
|
|
|
|
json j_mempool_tx;
|
|
|
@ -363,14 +359,15 @@ OpenMoneroRequests::get_address_txs(
|
|
|
|
boost::lexical_cast<uint64_t>(
|
|
|
|
boost::lexical_cast<uint64_t>(
|
|
|
|
j_response["total_received_unlocked"].get<string>())
|
|
|
|
j_response["total_received_unlocked"].get<string>())
|
|
|
|
+ total_received_mempool - total_sent_mempool);
|
|
|
|
+ total_received_mempool - total_sent_mempool);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
} //if(!j_mempool_tx.empty())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // current_bc_status->find_txs_in_mempool
|
|
|
|
|
|
|
|
|
|
|
|
string response_body = j_response.dump();
|
|
|
|
string response_body = j_response.dump();
|
|
|
|
|
|
|
|
|
|
|
|
auto response_headers = make_headers({{ "Content-Length",
|
|
|
|
auto response_headers = make_headers(
|
|
|
|
to_string(response_body.size())}});
|
|
|
|
{{ "Content-Length", to_string(response_body.size()) }});
|
|
|
|
|
|
|
|
|
|
|
|
session->close(OK, response_body, response_headers);
|
|
|
|
session->close(OK, response_body, response_headers);
|
|
|
|
}
|
|
|
|
}
|
|
|
|