From d46c0c6611576cab0ee8d1da0ec930d278de220a Mon Sep 17 00:00:00 2001 From: aiwe Date: Sun, 5 May 2024 17:42:35 -0500 Subject: [PATCH 1/7] Fix running wallet rpc and logging in walletd can possibly delete event and dispatcher from JsonRpcServer --- src/JsonRpcServer/JsonRpcServer.cpp | 10 ---------- src/PaymentGateService/PaymentGateService.cpp | 12 +++++++++++- src/Wallet/WalletRpcServer.cpp | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/JsonRpcServer/JsonRpcServer.cpp b/src/JsonRpcServer/JsonRpcServer.cpp index a59c2efd71..687a6199d9 100755 --- a/src/JsonRpcServer/JsonRpcServer.cpp +++ b/src/JsonRpcServer/JsonRpcServer.cpp @@ -60,8 +60,6 @@ void JsonRpcServer::start(const std::string& bindAddress, uint16_t bindPort, uin } m_workers.push_back(std::thread(std::bind(&JsonRpcServer::listen, this, bindAddress, bindPort))); - - stopEvent->wait(); } void JsonRpcServer::stop() { @@ -71,14 +69,6 @@ void JsonRpcServer::stop() { http->stop(); - if (m_dispatcher != nullptr) { - m_dispatcher->remoteSpawn([&]() { - if (stopEvent != nullptr) { - stopEvent->set(); - } - }); - } - for (auto& th : m_workers) { if (th.joinable()) { th.join(); diff --git a/src/PaymentGateService/PaymentGateService.cpp b/src/PaymentGateService/PaymentGateService.cpp index 18c13c2532..a12027e27b 100755 --- a/src/PaymentGateService/PaymentGateService.cpp +++ b/src/PaymentGateService/PaymentGateService.cpp @@ -347,14 +347,24 @@ void PaymentGateService::runWalletService(const CryptoNote::Currency& currency, rpcServer.setAuth(config.gateConfiguration.m_rpcUser, config.gateConfiguration.m_rpcPassword); - Tools::SignalHandler::install([&rpcServer] { + Tools::SignalHandler::install([&] { rpcServer.stop(); + + if (dispatcher != nullptr) { + dispatcher->remoteSpawn([&]() { + if (stopEvent != nullptr) { + stopEvent->set(); + } + }); + } }); rpcServer.start(config.gateConfiguration.m_bind_address, config.gateConfiguration.m_bind_port, config.gateConfiguration.m_bind_port_ssl); + stopEvent->wait(); + Logging::LoggerRef(logger, "PaymentGateService")(Logging::INFO, Logging::BRIGHT_WHITE) << "JSON-RPC server stopped, stopping wallet service..."; try { diff --git a/src/Wallet/WalletRpcServer.cpp b/src/Wallet/WalletRpcServer.cpp index 642643e4fb..0f8fb6359c 100644 --- a/src/Wallet/WalletRpcServer.cpp +++ b/src/Wallet/WalletRpcServer.cpp @@ -91,7 +91,7 @@ wallet_rpc_server::wallet_rpc_server( //------------------------------------------------------------------------------------------------------------------------------ -wallet_rpc_server::~wallet_rpc_server() { +wallet_rpc_server::~wallet_rpc_server() { } //------------------------------------------------------------------------------------------------------------------------------ From 60bff96ef13f5c75067ea3015962001fae3bed4b Mon Sep 17 00:00:00 2001 From: aiwe Date: Thu, 23 May 2024 16:12:24 -0500 Subject: [PATCH 2/7] Don't use change_extension deprecated in some boost versions --- src/SimpleWallet/SimpleWallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SimpleWallet/SimpleWallet.cpp b/src/SimpleWallet/SimpleWallet.cpp index 63378da586..4f161a3a05 100644 --- a/src/SimpleWallet/SimpleWallet.cpp +++ b/src/SimpleWallet/SimpleWallet.cpp @@ -1450,7 +1450,7 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string { CryptoNote::WalletHelper::storeWallet(*m_wallet, m_wallet_file); //create wallet backup file - boost::filesystem::copy_file(m_wallet_file, boost::filesystem::change_extension(m_wallet_file, ".walletbak")); + boost::filesystem::copy_file(m_wallet_file, m_wallet_file.substr(0, m_wallet_file.find_last_of('.')) + ".walletbak"); } catch (std::exception& e) { From 0a0956108402539820212bb44be0074c363db424 Mon Sep 17 00:00:00 2001 From: aiwe Date: Thu, 23 May 2024 16:13:49 -0500 Subject: [PATCH 3/7] Let's try to upgrade Github Actions scripts --- .github/workflows/check.yml | 12 ++++++------ .github/workflows/release.yml | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 367517387d..4d15b5557b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -58,7 +58,7 @@ jobs: echo "artifact_path=$build_folder/src/Release/$release_name" >> $env:GITHUB_OUTPUT - name: Upload To GH Artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ steps.build.outputs.release_name }} path: ${{ steps.build.outputs.artifact_path }} @@ -112,7 +112,7 @@ jobs: mv build/src/walletd.exe build/karbo mv build/src/vanitygen.exe build/karbo - name: Upload To GH Artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ steps.setup.outputs.release_name }} path: build/karbo @@ -121,7 +121,7 @@ jobs: build-macos: name: macOS - runs-on: macos-11 + runs-on: macos-12 steps: - uses: actions/checkout@master with: @@ -155,7 +155,7 @@ jobs: echo "artifact_path=$build_folder/$release_name" >> $GITHUB_OUTPUT - name: Upload To GH Artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ steps.build.outputs.release_name }} path: ${{ steps.build.outputs.artifact_path }} @@ -191,7 +191,7 @@ jobs: echo "artifact_path=$build_folder/$release_name" >> $GITHUB_OUTPUT - name: Upload To GH Artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ steps.build.outputs.release_name }} path: ${{ steps.build.outputs.artifact_path }} @@ -227,7 +227,7 @@ jobs: echo "artifact_path=$build_folder/$release_name" >> $GITHUB_OUTPUT - name: Upload To GH Artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ steps.build.outputs.release_name }} path: ${{ steps.build.outputs.artifact_path }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b79b270b2f..bb168f70b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,7 +51,7 @@ jobs: echo "krb_ver=${krb_ver}" >> $env:GITHUB_OUTPUT - name: Create Release - uses: softprops/action-gh-release@v0.1.8 + uses: softprops/action-gh-release@v2 with: files: ${{ steps.build.outputs.asset_path }} name: Karbo CLI Suite ${{ steps.build.outputs.krb_ver }} @@ -62,7 +62,7 @@ jobs: build-macos: name: macOS - runs-on: macos-11 + runs-on: macos-12 steps: - uses: actions/checkout@master with: @@ -94,7 +94,7 @@ jobs: echo "krb_ver=${krb_ver}" >> $GITHUB_OUTPUT - name: Create Release - uses: softprops/action-gh-release@v0.1.8 + uses: softprops/action-gh-release@v2 with: files: ${{ steps.build.outputs.asset_path }} name: Karbo CLI Suite ${{ steps.build.outputs.krb_ver }} @@ -138,7 +138,7 @@ jobs: echo "krb_ver=${krb_ver}" >> $GITHUB_OUTPUT - name: Create Release - uses: softprops/action-gh-release@v0.1.8 + uses: softprops/action-gh-release@v2 with: files: ${{ steps.build.outputs.asset_path }} name: Karbo CLI Suite ${{ steps.build.outputs.krb_ver }} @@ -182,7 +182,7 @@ jobs: echo "krb_ver=${krb_ver}" >> $GITHUB_OUTPUT - name: Create Release - uses: softprops/action-gh-release@v0.1.8 + uses: softprops/action-gh-release@v2 with: files: ${{ steps.build.outputs.asset_path }} name: Karbo CLI Suite ${{ steps.build.outputs.krb_ver }} From 3a6043166442f0df187780e37f102e00398c1815 Mon Sep 17 00:00:00 2001 From: aivve Date: Mon, 2 Apr 2018 00:53:49 +0300 Subject: [PATCH 4/7] Regrow stack size for Linux --- src/Platform/Linux/System/Dispatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Platform/Linux/System/Dispatcher.cpp b/src/Platform/Linux/System/Dispatcher.cpp index 3baa58831f..fecc93154f 100644 --- a/src/Platform/Linux/System/Dispatcher.cpp +++ b/src/Platform/Linux/System/Dispatcher.cpp @@ -58,7 +58,7 @@ class MutextGuard { static_assert(Dispatcher::SIZEOF_PTHREAD_MUTEX_T == sizeof(pthread_mutex_t), "invalid pthread mutex size"); -const size_t STACK_SIZE = 64 * 1024; +const size_t STACK_SIZE = 512 * 1024; }; From 520571c762b24e80a38888642d458cce7f50ba03 Mon Sep 17 00:00:00 2001 From: aiwe Date: Thu, 27 Jun 2024 23:33:51 -0500 Subject: [PATCH 5/7] Just delete these commented out lines --- src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp b/src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp index ff36826ff2..31a0783fcd 100644 --- a/src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp +++ b/src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp @@ -1097,9 +1097,7 @@ void CryptoNoteProtocolHandler::relay_transactions(NOTIFY_NEW_TRANSACTIONS::requ if (!m_stemPool.hasTransaction(transactionHash)) { logger(Logging::DEBUGGING) << "Adding relayed transaction " << transactionHash << " to stempool"; auto txblob = *tx_blob_it; - //m_dispatcher.remoteSpawn([this, transactionHash, txblob] { m_stemPool.addTransaction(transactionHash, txblob); - //}); txHashes.push_back(transactionHash); } } From 614c2a67bb63b47a6b0fffc607140b13a263f54d Mon Sep 17 00:00:00 2001 From: aiwe Date: Fri, 28 Jun 2024 00:07:40 -0500 Subject: [PATCH 6/7] Workaround fix for sending tx via node --- src/Platform/Windows/System/Dispatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Platform/Windows/System/Dispatcher.cpp b/src/Platform/Windows/System/Dispatcher.cpp index 0dd736534e..25f3e71577 100644 --- a/src/Platform/Windows/System/Dispatcher.cpp +++ b/src/Platform/Windows/System/Dispatcher.cpp @@ -235,7 +235,7 @@ bool Dispatcher::interrupted() { } void Dispatcher::pushContext(NativeContext* context) { - assert(GetCurrentThreadId() == threadId); + //assert(GetCurrentThreadId() == threadId); assert(context != nullptr); if (context->inExecutionQueue) { From abf97f2f1ebb51e50bb55ef02834780f53cac00d Mon Sep 17 00:00:00 2001 From: aiwe Date: Sat, 29 Jun 2024 21:41:25 -0500 Subject: [PATCH 7/7] Append body in release --- .github/workflows/release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bb168f70b6..bd5543b4c0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,6 +55,7 @@ jobs: with: files: ${{ steps.build.outputs.asset_path }} name: Karbo CLI Suite ${{ steps.build.outputs.krb_ver }} + append_body: true body: | [Download for Windows](../../releases/download/${{ steps.build.outputs.krb_ver }}/${{ steps.build.outputs.release_name }}) `SHA256: ${{ steps.build.outputs.sha256 }}` env: @@ -98,6 +99,7 @@ jobs: with: files: ${{ steps.build.outputs.asset_path }} name: Karbo CLI Suite ${{ steps.build.outputs.krb_ver }} + append_body: true body: | [Download for macOS](../../releases/download/${{ steps.build.outputs.krb_ver }}/${{ steps.build.outputs.release_name }}) `SHA256: ${{ steps.build.outputs.sha256 }}` env: @@ -142,6 +144,7 @@ jobs: with: files: ${{ steps.build.outputs.asset_path }} name: Karbo CLI Suite ${{ steps.build.outputs.krb_ver }} + append_body: true body: | [Download for Ubuntu 22.04](../../releases/download/${{ steps.build.outputs.krb_ver }}/${{ steps.build.outputs.release_name }}) `SHA256: ${{ steps.build.outputs.sha256 }}` env: @@ -186,6 +189,7 @@ jobs: with: files: ${{ steps.build.outputs.asset_path }} name: Karbo CLI Suite ${{ steps.build.outputs.krb_ver }} + append_body: true body: | [Download for Ubuntu 20.04](../../releases/download/${{ steps.build.outputs.krb_ver }}/${{ steps.build.outputs.release_name }}) `SHA256: ${{ steps.build.outputs.sha256 }}` env: