summaryrefslogtreecommitdiff
path: root/patches/zano/0007-relax-mutex-in-invoke-call.patch
diff options
context:
space:
mode:
authorrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>2025-03-04 12:27:45 +0100
committerGitHub <noreply@github.com>2025-03-04 12:27:45 +0100
commitfdb16635cbfe1d45a3d5869c0a55ec871d912ea0 (patch)
treeec6703c28b4f09c6d10f56339db78a3cdb2c8b82 /patches/zano/0007-relax-mutex-in-invoke-call.patch
parent991a0d0c97bce6ae8671dc763dd03876dfa9ea8a (diff)
chore(deps): update zano digest to fe85ce2 (#116)
* chore(deps): update zano digest to fe85ce2 * rebase needed patches * fix integration tests, generate checksum --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
Diffstat (limited to 'patches/zano/0007-relax-mutex-in-invoke-call.patch')
-rw-r--r--patches/zano/0007-relax-mutex-in-invoke-call.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/patches/zano/0007-relax-mutex-in-invoke-call.patch b/patches/zano/0007-relax-mutex-in-invoke-call.patch
new file mode 100644
index 0000000..cb38d5f
--- /dev/null
+++ b/patches/zano/0007-relax-mutex-in-invoke-call.patch
@@ -0,0 +1,88 @@
+From af034097788cb58518b794c1312f8a8df297dda7 Mon Sep 17 00:00:00 2001
+From: Czarek Nakamoto <cyjan@mrcyjanek.net>
+Date: Tue, 18 Feb 2025 14:27:36 +0100
+Subject: [PATCH 7/7] relax mutex in invoke call
+
+---
+ src/common/error_codes.h | 1 +
+ src/wallet/wallets_manager.cpp | 37 ++++++++++++++++++++++++++++++----
+ 2 files changed, 34 insertions(+), 4 deletions(-)
+
+diff --git a/src/common/error_codes.h b/src/common/error_codes.h
+index 1e3dc2ef..4723afe4 100644
+--- a/src/common/error_codes.h
++++ b/src/common/error_codes.h
+@@ -45,3 +45,4 @@
+ #define API_RETURN_CODE_HTLC_ORIGIN_HASH_MISSMATCHED "HTLC_ORIGIN_HASH_MISSMATCHED"
+ #define API_RETURN_CODE_WRAP "WRAP"
+ #define API_RETURN_CODE_MISSING_ZC_INPUTS "MISSING_ZC_INPUTS"
++#define API_RETURN_CODE_BAD_JSON "BAD_JSON"
+\ No newline at end of file
+diff --git a/src/wallet/wallets_manager.cpp b/src/wallet/wallets_manager.cpp
+index 5c8ef5c0..4b968a18 100644
+--- a/src/wallet/wallets_manager.cpp
++++ b/src/wallet/wallets_manager.cpp
+@@ -1678,10 +1678,27 @@ std::string wallets_manager::get_wallet_status(uint64_t wallet_id)
+ return epee::serialization::store_t_to_json(wsi);
+ }
+
++struct json_just_method
++{
++ std::string method;
++ BEGIN_KV_SERIALIZE_MAP()
++ KV_SERIALIZE(method)
++ END_KV_SERIALIZE_MAP()
++};
++
+ std::string wallets_manager::invoke(uint64_t wallet_id, std::string params)
+ {
+ GET_WALLET_OPT_BY_ID(wallet_id, wo);
+
++ json_just_method req = {};
++ if (!epee::serialization::load_t_from_json(req, params))
++ {
++ epee::json_rpc::response<epee::json_rpc::dummy_result, epee::json_rpc::error> error_response = AUTO_VAL_INIT(error_response);
++ error_response.error.code = -1;
++ error_response.error.message = API_RETURN_CODE_BAD_JSON;
++ return epee::serialization::store_t_to_json(error_response);
++ }
++
+ CRITICAL_REGION_LOCAL1(wo.long_refresh_in_progress_lock);
+ if (wo.long_refresh_in_progress)
+ {
+@@ -1691,16 +1708,28 @@ std::string wallets_manager::invoke(uint64_t wallet_id, std::string params)
+ return epee::serialization::store_t_to_json(error_response);
+ }
+
+-
+- auto locker_object = wo.w.lock();
+-
+ epee::net_utils::http::http_request_info query_info = AUTO_VAL_INIT(query_info);
+ epee::net_utils::http::http_response_info response_info = AUTO_VAL_INIT(response_info);
+ epee::net_utils::connection_context_base stub_conn_context = AUTO_VAL_INIT(stub_conn_context);
+ bool call_found = false;
+ query_info.m_URI = "/json_rpc";
+ query_info.m_body = params;
+- wo.rpc_wrapper->handle_http_request_map(query_info, response_info, stub_conn_context, call_found);
++
++ if (req.method != "assets_whitelist_get" &&
++ req.method != "decrypt_data" &&
++ req.method != "encrypt_data" &&
++ req.method != "get_restore_info" &&
++ req.method != "get_seed_phrase_info" &&
++ req.method != "get_wallet_info" &&
++ req.method != "getaddress" &&
++ req.method != "getbalance" &&
++ req.method != "sign_message") {
++ auto locker_object = wo.w.lock();
++ wo.rpc_wrapper->handle_http_request_map(query_info, response_info, stub_conn_context, call_found);
++ } else {
++ wo.rpc_wrapper->handle_http_request_map(query_info, response_info, stub_conn_context, call_found);
++ }
++
+ return response_info.m_body;
+ }
+
+--
+2.48.1
+