Skip to content

Commit

Permalink
feat(nspv): try to fix multithread stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Milerius committed Dec 3, 2019
1 parent 16ac3e4 commit 7437081
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ class fake_shop final : public ecs::post_update_system<fake_shop> {
// Update pending transactions count
blockchain::nspv_api::mempool_request request{user.wallet_address};

int m_tx_count = blockchain::nspv_api::mempool(nspv_system_user_.get_endpoint(currency), request).txids.size();
int m_tx_count = blockchain::nspv_api::mempool(nspv_system_user_.get_endpoint(currency),
request).txids.size();
{
std::scoped_lock st_lock(user_mutex);
mempool_transaction_count = m_tx_count;
Expand Down Expand Up @@ -233,7 +234,8 @@ class fake_shop final : public ecs::post_update_system<fake_shop> {
std::scoped_lock lck(tx_ids_mutex);
tx_ids.push_back(tx.broadcast_answer.value().broadcast);
}
std::cout << "Send complete, Transaction ID: " << tx.broadcast_answer.value().broadcast << std::endl;
std::cout << "Send complete, Transaction ID: " << tx.broadcast_answer.value().broadcast
<< std::endl;

// Check pending status
if (!application_quits)
Expand Down Expand Up @@ -386,9 +388,12 @@ class fake_shop final : public ecs::post_update_system<fake_shop> {
ImGui::Separator();

// Items
for (auto &tx_id : tx_ids) {
if (ImGui::Button(std::string(tx_id).c_str())) {
core::open_url_browser("http://" + currency_lc + "." + explorer_url + "/tx/" + tx_id);
{
std::scoped_lock lck(tx_ids_mutex);
for (auto &tx_id : tx_ids) {
if (ImGui::Button(std::string(tx_id).c_str())) {
core::open_url_browser("http://" + currency_lc + "." + explorer_url + "/tx/" + tx_id);
}
}
}

Expand All @@ -397,7 +402,7 @@ class fake_shop final : public ecs::post_update_system<fake_shop> {
}

// State
bool application_quits{false};
std::atomic<bool> application_quits{false};

// Inventories
std::mutex store_mutex;
Expand Down

0 comments on commit 7437081

Please sign in to comment.