diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index cc9c6649..dea6aea5 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -8,14 +8,14 @@ on: jobs: build-appimage: name: AppImage - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@master - name: Install dependencies run: | sudo apt update -y - sudo apt install -y qt5-default qttools5-dev qttools5-dev-tools libqt5charts5-dev libboost-all-dev + sudo apt install -y qt5-default qttools5-dev qttools5-dev-tools libqt5charts5-dev libboost-all-dev openssl - name: Clone conceal-core run: | diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 7ed6248d..c356929c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,20 +11,27 @@ on: jobs: build-windows: name: Windows - runs-on: windows-2019 + runs-on: windows-2022 env: - BOOST_ROOT: C:/tools/boost/x86_64 + BOOST_ROOT: C:/local/boost_1_83_0 steps: - uses: actions/checkout@master - name: Setup msbuild uses: microsoft/setup-msbuild@v1.1.3 + - name: Restore Boost + uses: actions/cache@v3 + id: restore-boost + with: + path: ${{env.BOOST_ROOT}} + key: boost_1_83_0-msvc-14.3-64 + - name: Install Boost + if: steps.restore-boost.outputs.cache-hit != 'true' shell: powershell run: | - echo "${env:BOOST_ROOT}" - $Url = "https://sourceforge.net/projects/boost/files/boost-binaries/1.72.0/boost_1_72_0-msvc-14.2-64.exe" + $Url = "https://sourceforge.net/projects/boost/files/boost-binaries/1.83.0/boost_1_83_0-msvc-14.3-64.exe" (New-Object System.Net.WebClient).DownloadFile($Url, "$env:TEMP\boost.exe") Start-Process -Wait -FilePath "$env:TEMP\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=${env:BOOST_ROOT}" @@ -78,7 +85,7 @@ jobs: New-Item "$build_folder\$release_folder" -ItemType Directory cd "$build_folder" - cmake -G "Visual Studio 16 2019" .. + cmake -G "Visual Studio 17 2022" .. msbuild conceal-desktop.sln /p:Configuration=Release /m:2 echo "build_folder=${build_folder}" >> $env:GITHUB_OUTPUT @@ -95,9 +102,8 @@ jobs: cd "$build_folder/$release_folder" mkdir "Final" - choco install openssl -y - cp "C:\Program Files\OpenSSL-Win64\libcrypto*.dll" "Final/" - cp "C:\Program Files\OpenSSL-Win64\libssl*.dll" "Final/" + cp "C:\Program Files\OpenSSL\libcrypto*.dll" "Final/" + cp "C:\Program Files\OpenSSL\libssl*.dll" "Final/" windeployqt --release conceal-desktop.exe --dir "Final/" --no-translations --no-opengl-sw mv Final ../../installer/windows/build @@ -118,14 +124,14 @@ jobs: build-appimage: name: AppImage - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@master - name: Install dependencies run: | sudo apt-get update -y - sudo apt-get install -y qt5-default qttools5-dev qttools5-dev-tools libqt5charts5-dev libboost-all-dev + sudo apt-get install -y qt5-default qttools5-dev qttools5-dev-tools libqt5charts5-dev libboost-all-dev openssl - name: Clone conceal-core run: | @@ -166,47 +172,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - build-ubuntu18: - name: Ubuntu 18.04 - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@master - - - name: Install dependencies - run: | - sudo apt-get update -y - sudo apt-get install -y qt5-default qttools5-dev qttools5-dev-tools libqt5charts5-dev libboost-all-dev - - - name: Clone conceal-core - run: | - rm -rf cryptonote - git clone https://github.com/ConcealNetwork/conceal-core.git cryptonote - ./.github/checkout.sh - - - name: Build - id: build - run: | - ccx_version=${GITHUB_SHA::7} - release_name=ccx-desktop-ubuntu-1804-dev-"$ccx_version" - - lrelease src/languages/*.ts - make -j2 build-release - mkdir $release_name - mkdir -p $release_name/icon - mv build/release/conceal-desktop $release_name - cp conceal-desktop.desktop $release_name - cp src/images/conceal.png $release_name/icon - - echo "release_name=${release_name}" >> $GITHUB_OUTPUT - - - name: Upload To GH Artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ steps.build.outputs.release_name }} - path: ${{ steps.build.outputs.release_name }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - build-ubuntu20: name: Ubuntu 20.04 runs-on: ubuntu-20.04 @@ -291,7 +256,7 @@ jobs: build-macos: name: macOS - runs-on: macos-11 + runs-on: macos-12 steps: - uses: actions/checkout@master diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index 1eac3646..8dab9185 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -8,7 +8,7 @@ on: jobs: build-macos: name: macOS - runs-on: macos-11 + runs-on: macos-12 steps: - uses: actions/checkout@master diff --git a/.github/workflows/ubuntu18.yml b/.github/workflows/ubuntu18.yml deleted file mode 100644 index 61bee4d3..00000000 --- a/.github/workflows/ubuntu18.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Ubuntu 18.04 - -on: - push: - tags: - - "*" - -jobs: - build-ubuntu18: - name: Ubuntu 18.04 - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@master - - - name: Install dependencies - run: | - sudo apt update -y - sudo apt install -y qt5-default qttools5-dev qttools5-dev-tools libqt5charts5-dev libboost-all-dev - - - name: Clone conceal-core - run: | - rm -rf cryptonote - git clone https://github.com/ConcealNetwork/conceal-core.git cryptonote - - - name: Build - id: build - run: | - ccx_version=$(echo "$GITHUB_REF" | sed 's|refs/tags/||') - release_name=ccx-desktop-ubuntu-1804-v"$ccx_version" - build_folder="build/release" - - lrelease src/languages/*.ts - make -j4 build-release - mkdir $release_name - mkdir -p $release_name/icon - mv $build_folder/conceal-desktop $release_name - cp conceal-desktop.desktop $release_name - cp src/images/conceal.png $release_name/icon - tar -czf "$release_name".tar.gz "$release_name" - sha256=$(shasum -a 256 "$release_name".tar.gz | awk '{print toupper($1)}') - - echo "sha256=${sha256}" >> $GITHUB_OUTPUT - echo "release_name=${release_name}.tar.gz" >> $GITHUB_OUTPUT - echo "ccx_version=${ccx_version}" >> $GITHUB_OUTPUT - - - name: Create Release - uses: softprops/action-gh-release@v0.1.15 - with: - files: ${{ steps.build.outputs.release_name }} - name: Conceal Desktop v${{ steps.build.outputs.ccx_version }} - body: | - [Download for Ubuntu 18.04](../../releases/download/${{ steps.build.outputs.ccx_version }}/${{ steps.build.outputs.release_name }}) **${{ steps.build.outputs.release_name }}** - `SHA256 : ${{ steps.build.outputs.sha256 }}` - append_body: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 2edb33fa..d7dad46d 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -8,20 +8,27 @@ on: jobs: build-windows: name: Windows - runs-on: windows-2019 + runs-on: windows-2022 env: - BOOST_ROOT: C:/tools/boost/x86_64 + BOOST_ROOT: C:/local/boost_1_83_0 steps: - uses: actions/checkout@master - name: Setup msbuild uses: microsoft/setup-msbuild@v1.1.3 + - name: Restore Boost + uses: actions/cache@v3 + id: restore-boost + with: + path: ${{env.BOOST_ROOT}} + key: boost_1_83_0-msvc-14.3-64 + - name: Install Boost + if: steps.restore-boost.outputs.cache-hit != 'true' shell: powershell run: | - echo "${env:BOOST_ROOT}" - $Url = "https://sourceforge.net/projects/boost/files/boost-binaries/1.72.0/boost_1_72_0-msvc-14.2-64.exe" + $Url = "https://sourceforge.net/projects/boost/files/boost-binaries/1.83.0/boost_1_83_0-msvc-14.3-64.exe" (New-Object System.Net.WebClient).DownloadFile($Url, "$env:TEMP\boost.exe") Start-Process -Wait -FilePath "$env:TEMP\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=${env:BOOST_ROOT}" @@ -73,7 +80,7 @@ jobs: New-Item "$build_folder\$release_folder" -ItemType Directory cd "$build_folder" - cmake -G "Visual Studio 16 2019" .. + cmake -G "Visual Studio 17 2022" .. msbuild conceal-desktop.sln /p:Configuration=Release /m:2 echo "build_folder=${build_folder}" >> $env:GITHUB_OUTPUT @@ -91,9 +98,8 @@ jobs: cd "$build_folder/$release_folder" mkdir "Final" - choco install openssl -y - cp "C:\Program Files\OpenSSL-Win64\libcrypto*.dll" "Final/" - cp "C:\Program Files\OpenSSL-Win64\libssl*.dll" "Final/" + cp "C:\Program Files\OpenSSL\libcrypto*.dll" "Final/" + cp "C:\Program Files\OpenSSL\libssl*.dll" "Final/" windeployqt --release conceal-desktop.exe --dir "Final/" --no-translations --no-opengl-sw mv Final ../../installer/windows/build diff --git a/CMakeLists.txt b/CMakeLists.txt index be12fa60..3fada542 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,6 +78,7 @@ set(CRYPTONOTE_SOURCES cryptonote/src/Common/MemoryInputStream.cpp cryptonote/src/Common/PathTools.cpp cryptonote/src/Common/DnsTools.cpp + cryptonote/src/Common/ScopeExit.cpp cryptonote/src/Common/StdInputStream.cpp cryptonote/src/Common/StdOutputStream.cpp cryptonote/src/Common/StreamTools.cpp @@ -150,12 +151,13 @@ set(CRYPTONOTE_SOURCES cryptonote/src/Wallet/LegacyKeysImporter.cpp cryptonote/src/Wallet/WalletAsyncContextCounter.cpp cryptonote/src/Wallet/WalletErrors.cpp + cryptonote/src/Wallet/WalletGreen.cpp + cryptonote/src/Wallet/WalletSerializationV1.cpp + cryptonote/src/Wallet/WalletSerializationV2.cpp + cryptonote/src/Wallet/WalletUtils.cpp cryptonote/src/WalletLegacy/KeysStorage.cpp - cryptonote/src/WalletLegacy/WalletLegacy.cpp - cryptonote/src/WalletLegacy/WalletHelper.cpp cryptonote/src/WalletLegacy/WalletLegacySerializer.cpp cryptonote/src/WalletLegacy/WalletLegacySerialization.cpp - cryptonote/src/WalletLegacy/WalletTransactionSender.cpp cryptonote/src/WalletLegacy/WalletUnconfirmedTransactions.cpp cryptonote/src/WalletLegacy/WalletUserTransactionsCache.cpp cryptonote/src/System/ContextGroup.cpp diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..b2ba9048 --- /dev/null +++ b/COPYING @@ -0,0 +1,31 @@ +COPYRIGHT + + © 2018-2023 Conceal Network & Conceal Devs + © 2017-2018 The Circle Foundation & Conceal Devs + © 2011-2017 The Cryptonote developers + +LICENSE + + MIT + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + Distributed under the MIT/X11 software license http://www.opensource.org/licenses/mit-license.php diff --git a/COPYRIGHT b/COPYRIGHT index 0a8738f2..b2ba9048 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,12 +1,10 @@ -Copyright: +COPYRIGHT - © 2011-2017 The Cryptonote developers - © 2014-2016 XDN developers - © 2016-2017 Karbowanec developers - © 2017-2018 The Circle Foundation & Conceal Devs - © 2018-2022 Conceal Network & Conceal Devs + © 2018-2023 Conceal Network & Conceal Devs + © 2017-2018 The Circle Foundation & Conceal Devs + © 2011-2017 The Cryptonote developers -License: +LICENSE MIT @@ -29,3 +27,5 @@ License: WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Distributed under the MIT/X11 software license http://www.opensource.org/licenses/mit-license.php diff --git a/CryptoNoteWallet.cmake b/CryptoNoteWallet.cmake index 9eabffc1..c57ba09f 100644 --- a/CryptoNoteWallet.cmake +++ b/CryptoNoteWallet.cmake @@ -2,4 +2,4 @@ set(CN_PROJECT_NAME "conceal-desktop") set(CN_CURRENCY_DISPLAY_NAME "Conceal") set(CN_CURRENCY_TICKER "CCX") -set(CN_VERSION 6.7.1) +set(CN_VERSION 6.7.3) diff --git a/LICENSE b/LICENSE index 0a8738f2..b2ba9048 100644 --- a/LICENSE +++ b/LICENSE @@ -1,12 +1,10 @@ -Copyright: +COPYRIGHT - © 2011-2017 The Cryptonote developers - © 2014-2016 XDN developers - © 2016-2017 Karbowanec developers - © 2017-2018 The Circle Foundation & Conceal Devs - © 2018-2022 Conceal Network & Conceal Devs + © 2018-2023 Conceal Network & Conceal Devs + © 2017-2018 The Circle Foundation & Conceal Devs + © 2011-2017 The Cryptonote developers -License: +LICENSE MIT @@ -29,3 +27,5 @@ License: WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Distributed under the MIT/X11 software license http://www.opensource.org/licenses/mit-license.php diff --git a/README.md b/README.md index 111187ac..b628ca82 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # Conceal Desktop (GUI Wallet) -Latest Release: v6.7.1 +Latest Release: v6.7.3 Maintained by Conceal Devs. @@ -140,3 +140,9 @@ cpack ## Special Thanks Special thanks goes out to the developers from Cryptonote, Bytecoin, Monero, Forknote, TurtleCoin, and Masari. + +## Copyright + +© 2018-2023 Conceal Network & Conceal Devs +© 2017-2018 The Circle Foundation & Conceal Devs +© 2011-2017 The Cryptonote developers \ No newline at end of file diff --git a/appimage/create-appimage.sh b/appimage/create-appimage.sh index 05a57a92..e69d6947 100755 --- a/appimage/create-appimage.sh +++ b/appimage/create-appimage.sh @@ -8,7 +8,7 @@ if ! test -f "linuxdeploy-plugin-qt-x86_64.AppImage"; then fi chmod u+x ./*.AppImage cp ../build/release/conceal-desktop . -mkdir -p usr/share/icons mkdir -p usr/lib -cp ../src/images/conceal.png usr/share/icons -./linuxdeploy-x86_64.AppImage --executable ./conceal-desktop --desktop-file conceal-desktop.desktop --appdir . --output appimage --plugin qt +cp /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 usr/lib +cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 usr/lib +./linuxdeploy-x86_64.AppImage --executable ./conceal-desktop --desktop-file conceal-desktop.desktop --appdir . --output appimage --plugin qt --icon-file ../src/images/conceal.png diff --git a/conceal-desktop.pro b/conceal-desktop.pro index 005eae5a..8ca47a27 100644 --- a/conceal-desktop.pro +++ b/conceal-desktop.pro @@ -57,9 +57,7 @@ HEADERS += libqrencode/bitstream.h \ cryptonote/include/ITransfersContainer.h \ cryptonote/include/ITransfersSynchronizer.h \ cryptonote/include/IWallet.h \ - cryptonote/include/IWalletLegacy.h \ cryptonote/src/CryptoNoteConfig.h \ - cryptonote/tests/Io.h \ libqrencode/tests/common.h \ libqrencode/tests/datachunk.h \ libqrencode/tests/decoder.h \ @@ -105,7 +103,6 @@ HEADERS += libqrencode/bitstream.h \ src/gui/VisibleMessagesModel.h \ src/gui/WalletEvents.h \ src/gui/WelcomeFrame.h \ - cryptonote/external/google/type_traits.h \ cryptonote/external/miniupnpc/bsdqueue.h \ cryptonote/external/miniupnpc/codelength.h \ cryptonote/external/miniupnpc/connecthostport.h \ @@ -352,93 +349,8 @@ HEADERS += libqrencode/bitstream.h \ cryptonote/src/Wallet/WalletSerializationV1.h \ cryptonote/src/Wallet/WalletSerializationV2.h \ cryptonote/src/Wallet/WalletUtils.h \ - cryptonote/src/WalletLegacy/KeysStorage.h \ - cryptonote/src/WalletLegacy/WalletDepositInfo.h \ - cryptonote/src/WalletLegacy/WalletHelper.h \ - cryptonote/src/WalletLegacy/WalletLegacy.h \ - cryptonote/src/WalletLegacy/WalletLegacyEvent.h \ cryptonote/src/WalletLegacy/WalletLegacySerialization.h \ cryptonote/src/WalletLegacy/WalletLegacySerializer.h \ - cryptonote/src/WalletLegacy/WalletRequest.h \ - cryptonote/src/WalletLegacy/WalletSendTransactionContext.h \ - cryptonote/src/WalletLegacy/WalletTransactionSender.h \ - cryptonote/src/WalletLegacy/WalletUnconfirmedTransactions.h \ - cryptonote/src/WalletLegacy/WalletUserTransactionsCache.h \ - cryptonote/src/WalletLegacy/WalletUtils.h \ - cryptonote/tests/CoreTests/AccountBoostSerialization.h \ - cryptonote/tests/CoreTests/BlockReward.h \ - cryptonote/tests/CoreTests/BlockValidation.h \ - cryptonote/tests/CoreTests/BoostSerializationHelper.h \ - cryptonote/tests/CoreTests/Chaingen.h \ - cryptonote/tests/CoreTests/Chaingen001.h \ - cryptonote/tests/CoreTests/ChainSplit1.h \ - cryptonote/tests/CoreTests/ChainSwitch1.h \ - cryptonote/tests/CoreTests/CryptoNoteBoostSerialization.h \ - cryptonote/tests/CoreTests/Deposit.h \ - cryptonote/tests/CoreTests/DoubleSpend.h \ - cryptonote/tests/CoreTests/IntegerOverflow.h \ - cryptonote/tests/CoreTests/RandomOuts.h \ - cryptonote/tests/CoreTests/RingSignature.h \ - cryptonote/tests/CoreTests/TestGenerator.h \ - cryptonote/tests/CoreTests/TransactionBuilder.h \ - cryptonote/tests/CoreTests/TransactionTests.h \ - cryptonote/tests/CoreTests/TransactionValidation.h \ - cryptonote/tests/CoreTests/UnorderedContainersBoostSerialization.h \ - cryptonote/tests/CoreTests/Upgrade.h \ - cryptonote/tests/crypto/crypto-tests.h \ - cryptonote/tests/IntegrationTestLib/BaseFunctionalTests.h \ - cryptonote/tests/IntegrationTestLib/InProcTestNode.h \ - cryptonote/tests/IntegrationTestLib/Logger.h \ - cryptonote/tests/IntegrationTestLib/NetworkConfiguration.h \ - cryptonote/tests/IntegrationTestLib/NodeCallback.h \ - cryptonote/tests/IntegrationTestLib/NodeObserver.h \ - cryptonote/tests/IntegrationTestLib/ObservableValue.h \ - cryptonote/tests/IntegrationTestLib/Process.h \ - cryptonote/tests/IntegrationTestLib/RPCTestNode.h \ - cryptonote/tests/IntegrationTestLib/TestNetwork.h \ - cryptonote/tests/IntegrationTestLib/TestNode.h \ - cryptonote/tests/IntegrationTestLib/TestWalletLegacy.h \ - cryptonote/tests/IntegrationTests/BaseTests.h \ - cryptonote/tests/IntegrationTests/WalletLegacyObserver.h \ - cryptonote/tests/PerformanceTests/CheckRingSignature.h \ - cryptonote/tests/PerformanceTests/ConstructTransaction.h \ - cryptonote/tests/PerformanceTests/CryptoNoteSlowHash.h \ - cryptonote/tests/PerformanceTests/DerivePublicKey.h \ - cryptonote/tests/PerformanceTests/DeriveSecretKey.h \ - cryptonote/tests/PerformanceTests/GenerateKeyDerivation.h \ - cryptonote/tests/PerformanceTests/GenerateKeyImage.h \ - cryptonote/tests/PerformanceTests/GenerateKeyImageHelper.h \ - cryptonote/tests/PerformanceTests/IsOutToAccount.h \ - cryptonote/tests/PerformanceTests/MultiTransactionTestBase.h \ - cryptonote/tests/PerformanceTests/PerformanceTests.h \ - cryptonote/tests/PerformanceTests/PerformanceUtils.h \ - cryptonote/tests/PerformanceTests/SingleTransactionTestBase.h \ - cryptonote/tests/TestGenerator/TestGenerator.h \ - cryptonote/tests/TransfersTests/Globals.h \ - cryptonote/tests/UnitTests/EventWaiter.h \ - cryptonote/tests/UnitTests/ICoreStub.h \ - cryptonote/tests/UnitTests/ICryptoNoteProtocolQueryStub.h \ - cryptonote/tests/UnitTests/INodeStubs.h \ - cryptonote/tests/UnitTests/TestBlockchainGenerator.h \ - cryptonote/tests/UnitTests/TransactionApiHelpers.h \ - cryptonote/tests/UnitTests/TransfersObserver.h \ - cryptonote/tests/UnitTests/UnitTestsUtils.h \ - cryptonote/external/google/sparsehash/densehashtable.h \ - cryptonote/external/google/sparsehash/hashtable-common.h \ - cryptonote/external/google/sparsehash/libc_allocator_with_realloc.h \ - cryptonote/external/google/sparsehash/os_config.h \ - cryptonote/external/google/sparsehash/sparseconfig.h \ - cryptonote/external/google/sparsehash/sparseconfig_win.h \ - cryptonote/external/google/sparsehash/sparsehashtable.h \ - cryptonote/external/gtest/samples/prime_tables.h \ - cryptonote/external/gtest/samples/sample1.h \ - cryptonote/external/gtest/samples/sample2.h \ - cryptonote/external/gtest/samples/sample3-inl.h \ - cryptonote/external/gtest/samples/sample4.h \ - cryptonote/external/gtest/src/gtest-internal-inl.h \ - cryptonote/external/gtest/test/gtest-param-test_test.h \ - cryptonote/external/gtest/test/gtest-typed-test_test.h \ - cryptonote/external/gtest/test/production.h \ cryptonote/src/crypto/pow_hash/arm8_neon.hpp \ cryptonote/src/crypto/pow_hash/arm_vfp.hpp \ cryptonote/src/crypto/pow_hash/aux_hash.h \ @@ -447,16 +359,6 @@ HEADERS += libqrencode/bitstream.h \ cryptonote/src/Platform/mingw/alloca.h \ cryptonote/src/Platform/msc/alloca.h \ cryptonote/src/Platform/msc/stdbool.h \ - cryptonote/external/gtest/include/gtest/gtest-death-test.h \ - cryptonote/external/gtest/include/gtest/gtest-message.h \ - cryptonote/external/gtest/include/gtest/gtest-param-test.h \ - cryptonote/external/gtest/include/gtest/gtest-printers.h \ - cryptonote/external/gtest/include/gtest/gtest-spi.h \ - cryptonote/external/gtest/include/gtest/gtest-test-part.h \ - cryptonote/external/gtest/include/gtest/gtest-typed-test.h \ - cryptonote/external/gtest/include/gtest/gtest.h \ - cryptonote/external/gtest/include/gtest/gtest_pred_impl.h \ - cryptonote/external/gtest/include/gtest/gtest_prod.h \ cryptonote/src/Platform/Linux/System/Dispatcher.h \ cryptonote/src/Platform/Linux/System/ErrorMessage.h \ cryptonote/src/Platform/Linux/System/Future.h \ @@ -485,22 +387,7 @@ HEADERS += libqrencode/bitstream.h \ cryptonote/src/Platform/Windows/System/TcpConnection.h \ cryptonote/src/Platform/Windows/System/TcpConnector.h \ cryptonote/src/Platform/Windows/System/TcpListener.h \ - cryptonote/src/Platform/Windows/System/Timer.h \ - cryptonote/external/gtest/include/gtest/internal/gtest-death-test-internal.h \ - cryptonote/external/gtest/include/gtest/internal/gtest-filepath.h \ - cryptonote/external/gtest/include/gtest/internal/gtest-internal.h \ - cryptonote/external/gtest/include/gtest/internal/gtest-linked_ptr.h \ - cryptonote/external/gtest/include/gtest/internal/gtest-param-util-generated.h \ - cryptonote/external/gtest/include/gtest/internal/gtest-param-util.h \ - cryptonote/external/gtest/include/gtest/internal/gtest-port-arch.h \ - cryptonote/external/gtest/include/gtest/internal/gtest-port.h \ - cryptonote/external/gtest/include/gtest/internal/gtest-string.h \ - cryptonote/external/gtest/include/gtest/internal/gtest-tuple.h \ - cryptonote/external/gtest/include/gtest/internal/gtest-type-util.h \ - cryptonote/external/gtest/xcode/Samples/FrameworkSample/widget.h \ - cryptonote/external/gtest/include/gtest/internal/custom/gtest-port.h \ - cryptonote/external/gtest/include/gtest/internal/custom/gtest-printers.h \ - cryptonote/external/gtest/include/gtest/internal/custom/gtest.h + cryptonote/src/Platform/Windows/System/Timer.h FORMS += src/gui/ui/addressbookdialog.ui \ src/gui/ui/changepassworddialog.ui \ src/gui/ui/contactdialog.ui \ @@ -549,7 +436,6 @@ SOURCES += libqrencode/bitstream.c \ src/TranslatorManager.cpp \ src/UpdateManager.cpp \ src/WalletAdapter.cpp \ - cryptonote/tests/HashTarget.cpp \ libqrencode/tests/common.c \ libqrencode/tests/create_frame_pattern.c \ libqrencode/tests/create_mqr_frame_pattern.c \ @@ -786,188 +672,8 @@ SOURCES += libqrencode/bitstream.c \ cryptonote/src/Wallet/WalletSerializationV1.cpp \ cryptonote/src/Wallet/WalletSerializationV2.cpp \ cryptonote/src/Wallet/WalletUtils.cpp \ - cryptonote/src/WalletLegacy/KeysStorage.cpp \ - cryptonote/src/WalletLegacy/WalletHelper.cpp \ - cryptonote/src/WalletLegacy/WalletLegacy.cpp \ cryptonote/src/WalletLegacy/WalletLegacySerialization.cpp \ cryptonote/src/WalletLegacy/WalletLegacySerializer.cpp \ - cryptonote/src/WalletLegacy/WalletTransactionSender.cpp \ - cryptonote/src/WalletLegacy/WalletUnconfirmedTransactions.cpp \ - cryptonote/src/WalletLegacy/WalletUserTransactionsCache.cpp \ - cryptonote/tests/CoreTests/BlockReward.cpp \ - cryptonote/tests/CoreTests/BlockValidation.cpp \ - cryptonote/tests/CoreTests/Chaingen.cpp \ - cryptonote/tests/CoreTests/Chaingen001.cpp \ - cryptonote/tests/CoreTests/ChaingenMain.cpp \ - cryptonote/tests/CoreTests/ChainSplit1.cpp \ - cryptonote/tests/CoreTests/ChainSwitch1.cpp \ - cryptonote/tests/CoreTests/Deposit.cpp \ - cryptonote/tests/CoreTests/DoubleSpend.cpp \ - cryptonote/tests/CoreTests/IntegerOverflow.cpp \ - cryptonote/tests/CoreTests/RandomOuts.cpp \ - cryptonote/tests/CoreTests/RingSignature.cpp \ - cryptonote/tests/CoreTests/TransactionBuilder.cpp \ - cryptonote/tests/CoreTests/TransactionTests.cpp \ - cryptonote/tests/CoreTests/TransactionValidation.cpp \ - cryptonote/tests/CoreTests/Upgrade.cpp \ - cryptonote/tests/crypto/crypto-ops-data.c \ - cryptonote/tests/crypto/crypto-ops.c \ - cryptonote/tests/crypto/crypto.cpp \ - cryptonote/tests/crypto/hash.c \ - cryptonote/tests/crypto/main.cpp \ - cryptonote/tests/crypto/random.c \ - cryptonote/tests/Difficulty/Difficulty.cpp \ - cryptonote/tests/Hash/main.cpp \ - cryptonote/tests/IntegrationTestLib/BaseFunctionalTests.cpp \ - cryptonote/tests/IntegrationTestLib/InProcTestNode.cpp \ - cryptonote/tests/IntegrationTestLib/Logger.cpp \ - cryptonote/tests/IntegrationTestLib/Process.cpp \ - cryptonote/tests/IntegrationTestLib/RPCTestNode.cpp \ - cryptonote/tests/IntegrationTestLib/TestNetwork.cpp \ - cryptonote/tests/IntegrationTestLib/TestWalletLegacy.cpp \ - cryptonote/tests/IntegrationTests/IntegrationTests.cpp \ - cryptonote/tests/IntegrationTests/main.cpp \ - cryptonote/tests/IntegrationTests/MultiVersion.cpp \ - cryptonote/tests/IntegrationTests/Node.cpp \ - cryptonote/tests/IntegrationTests/WalletLegacyTests.cpp \ - cryptonote/tests/NodeRpcProxyTests/NodeRpcProxyTests.cpp \ - cryptonote/tests/PerformanceTests/main.cpp \ - cryptonote/tests/System/ContextGroupTests.cpp \ - cryptonote/tests/System/ContextGroupTimeoutTests.cpp \ - cryptonote/tests/System/ContextTests.cpp \ - cryptonote/tests/System/DispatcherTests.cpp \ - cryptonote/tests/System/ErrorMessageTests.cpp \ - cryptonote/tests/System/EventLockTests.cpp \ - cryptonote/tests/System/EventTests.cpp \ - cryptonote/tests/System/Ipv4AddressTests.cpp \ - cryptonote/tests/System/Ipv4ResolverTests.cpp \ - cryptonote/tests/System/main.cpp \ - cryptonote/tests/System/OperationTimeoutTests.cpp \ - cryptonote/tests/System/RemoteContextTests.cpp \ - cryptonote/tests/System/TcpConnectionTests.cpp \ - cryptonote/tests/System/TcpConnectorTests.cpp \ - cryptonote/tests/System/TcpListenerTests.cpp \ - cryptonote/tests/System/TimerTests.cpp \ - cryptonote/tests/TestGenerator/TestGenerator.cpp \ - cryptonote/tests/TransfersTests/main.cpp \ - cryptonote/tests/TransfersTests/TestNodeRpcProxy.cpp \ - cryptonote/tests/TransfersTests/Tests.cpp \ - cryptonote/tests/TransfersTests/TestTxPoolSync.cpp \ - cryptonote/tests/UnitTests/ArrayRefTests.cpp \ - cryptonote/tests/UnitTests/ArrayViewTests.cpp \ - cryptonote/tests/UnitTests/Base58.cpp \ - cryptonote/tests/UnitTests/BlockingQueue.cpp \ - cryptonote/tests/UnitTests/BlockReward.cpp \ - cryptonote/tests/UnitTests/Chacha8.cpp \ - cryptonote/tests/UnitTests/Checkpoints.cpp \ - cryptonote/tests/UnitTests/DecomposeAmountIntoDigits.cpp \ - cryptonote/tests/UnitTests/EventWaiter.cpp \ - cryptonote/tests/UnitTests/ICoreStub.cpp \ - cryptonote/tests/UnitTests/ICryptoNoteProtocolQueryStub.cpp \ - cryptonote/tests/UnitTests/INodeStubs.cpp \ - cryptonote/tests/UnitTests/main.cpp \ - cryptonote/tests/UnitTests/MulDiv.cpp \ - cryptonote/tests/UnitTests/ParseAmount.cpp \ - cryptonote/tests/UnitTests/PaymentGateTests.cpp \ - cryptonote/tests/UnitTests/Serialization.cpp \ - cryptonote/tests/UnitTests/SerializationKV.cpp \ - cryptonote/tests/UnitTests/Shuffle.cpp \ - cryptonote/tests/UnitTests/StringBufferTests.cpp \ - cryptonote/tests/UnitTests/StringViewTests.cpp \ - cryptonote/tests/UnitTests/TestBcS.cpp \ - cryptonote/tests/UnitTests/TestBlockchainExplorer.cpp \ - cryptonote/tests/UnitTests/TestBlockchainGenerator.cpp \ - cryptonote/tests/UnitTests/TestCryptonoteBasic.cpp \ - cryptonote/tests/UnitTests/TestCurrency.cpp \ - cryptonote/tests/UnitTests/TestDepositIndex.cpp \ - cryptonote/tests/UnitTests/TestFormatUtils.cpp \ - cryptonote/tests/UnitTests/TestInprocessNode.cpp \ - cryptonote/tests/UnitTests/TestJsonValue.cpp \ - cryptonote/tests/UnitTests/TestMessageQueue.cpp \ - cryptonote/tests/UnitTests/TestPath.cpp \ - cryptonote/tests/UnitTests/TestPeerlist.cpp \ - cryptonote/tests/UnitTests/TestProtocolPack.cpp \ - cryptonote/tests/UnitTests/TestTransactionPoolDetach.cpp \ - cryptonote/tests/UnitTests/TestTransfers.cpp \ - cryptonote/tests/UnitTests/TestTransfersConsumer.cpp \ - cryptonote/tests/UnitTests/TestTransfersContainer.cpp \ - cryptonote/tests/UnitTests/TestTransfersContainerKeyImage.cpp \ - cryptonote/tests/UnitTests/TestTransfersSubscription.cpp \ - cryptonote/tests/UnitTests/TestUpgradeDetector.cpp \ - cryptonote/tests/UnitTests/TestWallet.cpp \ - cryptonote/tests/UnitTests/TestWalletLegacy.cpp \ - cryptonote/tests/UnitTests/TestWalletService.cpp \ - cryptonote/tests/UnitTests/TestWalletUserTransactionsCache.cpp \ - cryptonote/tests/UnitTests/TransactionApi.cpp \ - cryptonote/tests/UnitTests/TransactionApiHelpers.cpp \ - cryptonote/tests/UnitTests/TransactionPool.cpp \ - cryptonote/external/gtest/codegear/gtest_all.cc \ - cryptonote/external/gtest/codegear/gtest_link.cc \ - cryptonote/external/gtest/samples/sample1.cc \ - cryptonote/external/gtest/samples/sample10_unittest.cc \ - cryptonote/external/gtest/samples/sample1_unittest.cc \ - cryptonote/external/gtest/samples/sample2.cc \ - cryptonote/external/gtest/samples/sample2_unittest.cc \ - cryptonote/external/gtest/samples/sample3_unittest.cc \ - cryptonote/external/gtest/samples/sample4.cc \ - cryptonote/external/gtest/samples/sample4_unittest.cc \ - cryptonote/external/gtest/samples/sample5_unittest.cc \ - cryptonote/external/gtest/samples/sample6_unittest.cc \ - cryptonote/external/gtest/samples/sample7_unittest.cc \ - cryptonote/external/gtest/samples/sample8_unittest.cc \ - cryptonote/external/gtest/samples/sample9_unittest.cc \ - cryptonote/external/gtest/src/gtest-all.cc \ - cryptonote/external/gtest/src/gtest-death-test.cc \ - cryptonote/external/gtest/src/gtest-filepath.cc \ - cryptonote/external/gtest/src/gtest-port.cc \ - cryptonote/external/gtest/src/gtest-printers.cc \ - cryptonote/external/gtest/src/gtest-test-part.cc \ - cryptonote/external/gtest/src/gtest-typed-test.cc \ - cryptonote/external/gtest/src/gtest.cc \ - cryptonote/external/gtest/src/gtest_main.cc \ - cryptonote/external/gtest/test/gtest-death-test_ex_test.cc \ - cryptonote/external/gtest/test/gtest-death-test_test.cc \ - cryptonote/external/gtest/test/gtest-filepath_test.cc \ - cryptonote/external/gtest/test/gtest-linked_ptr_test.cc \ - cryptonote/external/gtest/test/gtest-listener_test.cc \ - cryptonote/external/gtest/test/gtest-message_test.cc \ - cryptonote/external/gtest/test/gtest-options_test.cc \ - cryptonote/external/gtest/test/gtest-param-test2_test.cc \ - cryptonote/external/gtest/test/gtest-param-test_test.cc \ - cryptonote/external/gtest/test/gtest-port_test.cc \ - cryptonote/external/gtest/test/gtest-printers_test.cc \ - cryptonote/external/gtest/test/gtest-test-part_test.cc \ - cryptonote/external/gtest/test/gtest-tuple_test.cc \ - cryptonote/external/gtest/test/gtest-typed-test2_test.cc \ - cryptonote/external/gtest/test/gtest-typed-test_test.cc \ - cryptonote/external/gtest/test/gtest-unittest-api_test.cc \ - cryptonote/external/gtest/test/gtest_all_test.cc \ - cryptonote/external/gtest/test/gtest_break_on_failure_unittest_.cc \ - cryptonote/external/gtest/test/gtest_catch_exceptions_test_.cc \ - cryptonote/external/gtest/test/gtest_color_test_.cc \ - cryptonote/external/gtest/test/gtest_env_var_test_.cc \ - cryptonote/external/gtest/test/gtest_environment_test.cc \ - cryptonote/external/gtest/test/gtest_filter_unittest_.cc \ - cryptonote/external/gtest/test/gtest_help_test_.cc \ - cryptonote/external/gtest/test/gtest_list_tests_unittest_.cc \ - cryptonote/external/gtest/test/gtest_main_unittest.cc \ - cryptonote/external/gtest/test/gtest_no_test_unittest.cc \ - cryptonote/external/gtest/test/gtest_output_test_.cc \ - cryptonote/external/gtest/test/gtest_pred_impl_unittest.cc \ - cryptonote/external/gtest/test/gtest_premature_exit_test.cc \ - cryptonote/external/gtest/test/gtest_prod_test.cc \ - cryptonote/external/gtest/test/gtest_repeat_test.cc \ - cryptonote/external/gtest/test/gtest_shuffle_test_.cc \ - cryptonote/external/gtest/test/gtest_sole_header_test.cc \ - cryptonote/external/gtest/test/gtest_stress_test.cc \ - cryptonote/external/gtest/test/gtest_throw_on_failure_ex_test.cc \ - cryptonote/external/gtest/test/gtest_throw_on_failure_test_.cc \ - cryptonote/external/gtest/test/gtest_uninitialized_test_.cc \ - cryptonote/external/gtest/test/gtest_unittest.cc \ - cryptonote/external/gtest/test/gtest_xml_outfile1_test_.cc \ - cryptonote/external/gtest/test/gtest_xml_outfile2_test_.cc \ - cryptonote/external/gtest/test/gtest_xml_output_unittest_.cc \ - cryptonote/external/gtest/test/production.cc \ cryptonote/src/crypto/pow_hash/aux_hash.c \ cryptonote/src/crypto/pow_hash/cn_slow_hash_hard_arm.cpp \ cryptonote/src/crypto/pow_hash/cn_slow_hash_hard_intel.cpp \ @@ -997,9 +703,7 @@ SOURCES += libqrencode/bitstream.c \ cryptonote/src/Platform/Windows/System/TcpConnection.cpp \ cryptonote/src/Platform/Windows/System/TcpConnector.cpp \ cryptonote/src/Platform/Windows/System/TcpListener.cpp \ - cryptonote/src/Platform/Windows/System/Timer.cpp \ - cryptonote/external/gtest/xcode/Samples/FrameworkSample/widget.cc \ - cryptonote/external/gtest/xcode/Samples/FrameworkSample/widget_test.cc + cryptonote/src/Platform/Windows/System/Timer.cpp RESOURCES += src/resources.qrc TRANSLATIONS += src/languages/cn.ts \ src/languages/en.ts \ diff --git a/src/AddressProvider.cpp b/src/AddressProvider.cpp index a519fcb6..0c239dd6 100644 --- a/src/AddressProvider.cpp +++ b/src/AddressProvider.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/AddressProvider.h b/src/AddressProvider.h index fb76b190..f777b774 100644 --- a/src/AddressProvider.h +++ b/src/AddressProvider.h @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/AliasProvider.cpp b/src/AliasProvider.cpp index ce2f6c20..22cdca5f 100644 --- a/src/AliasProvider.cpp +++ b/src/AliasProvider.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/AliasProvider.h b/src/AliasProvider.h index bc393882..1bc80046 100644 --- a/src/AliasProvider.h +++ b/src/AliasProvider.h @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/CommandLineParser.cpp b/src/CommandLineParser.cpp index 57b34fe9..9bb319a6 100644 --- a/src/CommandLineParser.cpp +++ b/src/CommandLineParser.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/CommandLineParser.h b/src/CommandLineParser.h index 380ed2d6..04533ff3 100644 --- a/src/CommandLineParser.h +++ b/src/CommandLineParser.h @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/CryptoNoteWalletConfig.h.in b/src/CryptoNoteWalletConfig.h.in index 0aeb49b5..022c4fb8 100644 --- a/src/CryptoNoteWalletConfig.h.in +++ b/src/CryptoNoteWalletConfig.h.in @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/CryptoNoteWrapper.cpp b/src/CryptoNoteWrapper.cpp index 325e573f..1ff438fd 100644 --- a/src/CryptoNoteWrapper.cpp +++ b/src/CryptoNoteWrapper.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -11,18 +11,23 @@ #include "CryptoNoteCore/CryptoNoteBasicImpl.h" #include "CryptoNoteCore/CryptoNoteFormatUtils.h" #include "CryptoNoteCore/Currency.h" +#include "CryptoNoteCore/TransactionExtra.h" #include "NodeRpcProxy/NodeRpcProxy.h" #include "CryptoNoteCore/CoreConfig.h" #include "P2p/NetNodeConfig.h" #include "CryptoNoteCore/Core.h" #include "CryptoNoteProtocol/CryptoNoteProtocolHandler.h" #include "InProcessNode/InProcessNode.h" +#include "InProcessNode/InProcessNodeErrors.h" #include "P2p/NetNode.h" -#include "WalletLegacy/WalletLegacy.h" +#include "Wallet/WalletGreen.h" #include "Logging/LoggerManager.h" #include "System/Dispatcher.h" #include "Settings.h" +#include +#include + namespace WalletGui { namespace { @@ -60,11 +65,16 @@ std::string extractPaymentId(const std::string& extra) { std::vector extraVector; std::copy(extra.begin(), extra.end(), std::back_inserter(extraVector)); - if (!cn::parseTransactionExtra(extraVector, extraFields)) { - throw std::runtime_error("Can't parse extra"); + std::string result; + + try { + if (!cn::parseTransactionExtra(extraVector, extraFields)) { + throw std::runtime_error("Can't parse extra"); + } + } catch (...){ + return result; } - std::string result; cn::TransactionExtraNonce extraNonce; if (cn::findTransactionExtraFieldByType(extraFields, extraNonce)) { crypto::Hash paymentIdHash; @@ -83,28 +93,30 @@ std::string extractPaymentId(const std::string& extra) { } -Node::~Node() { -} -class RpcNode : cn::INodeObserver, public Node { +class RpcNode : public cn::INodeObserver, public Node { public: - RpcNode(const cn::Currency& currency, logging::LoggerManager& logManager, INodeCallback& callback, const std::string& nodeHost, unsigned short nodePort) : - m_callback(callback), - m_currency(currency), - m_logger(logManager), - m_node(nodeHost, nodePort) { + RpcNode(const cn::Currency& currency, logging::LoggerManager& logManager, INodeCallback& callback, + const std::string& nodeHost, unsigned short nodePort) + : m_callback(callback), + m_currency(currency), + m_stopEvent(m_dispatcher), + m_node(nodeHost, nodePort), + m_logger(logManager) { m_node.addObserver(this); } - ~RpcNode() override { - } + ~RpcNode() override = default; void init(const std::function& callback) override { m_node.init(callback); + m_stopEvent.wait(); } void deinit() override { - /* nothing to be done here */ + m_dispatcher.remoteSpawn([this] { + m_stopEvent.set(); + }); } std::string convertPaymentId(const std::string& paymentIdString) override { @@ -131,37 +143,40 @@ class RpcNode : cn::INodeObserver, public Node { return m_node.getPeerCount(); } - cn::IWalletLegacy* createWallet() override { - return new cn::WalletLegacy(m_currency, m_node, m_logger, Settings::instance().isTestnet()); + std::unique_ptr createWallet() override { + return std::unique_ptr( + new cn::WalletGreen(m_dispatcher, m_currency, m_node, m_logger)); } private: INodeCallback& m_callback; const cn::Currency& m_currency; + platform_system::Dispatcher m_dispatcher; + platform_system::Event m_stopEvent; cn::NodeRpcProxy m_node; logging::LoggerManager& m_logger; - void peerCountUpdated(size_t count) { + void peerCountUpdated(size_t count) override { m_callback.peerCountUpdated(*this, count); } - void localBlockchainUpdated(uint64_t height) { + void localBlockchainUpdated(uint32_t height) override { m_callback.localBlockchainUpdated(*this, height); } - void lastKnownBlockHeightUpdated(uint64_t height) { + void lastKnownBlockHeightUpdated(uint32_t height) override { m_callback.lastKnownBlockHeightUpdated(*this, height); } }; -class InprocessNode : cn::INodeObserver, public Node { +class InprocessNode : public cn::INodeObserver, public Node { public: InprocessNode(const cn::Currency& currency, logging::LoggerManager& logManager, const cn::CoreConfig& coreConfig, const cn::NetNodeConfig& netNodeConfig, INodeCallback& callback) : - m_currency(currency), - m_dispatcher(), - m_loggerManager(logManager), m_callback(callback), + m_currency(currency), + m_stopEvent(m_dispatcher), + m_loggerManager(logManager), m_coreConfig(coreConfig), m_netNodeConfig(netNodeConfig), m_protocolHandler(currency, m_dispatcher, m_core, nullptr, logManager), @@ -178,9 +193,7 @@ class InprocessNode : cn::INodeObserver, public Node { m_protocolHandler.set_p2p_endpoint(&m_nodeServer); } - ~InprocessNode() override { - - } + ~InprocessNode() override = default; void init(const std::function& callback) override { try { @@ -237,33 +250,34 @@ class InprocessNode : cn::INodeObserver, public Node { return m_node.getPeerCount(); } - cn::IWalletLegacy* createWallet() override { - return new cn::WalletLegacy(m_currency, m_node, m_loggerManager, Settings::instance().isTestnet()); + std::unique_ptr createWallet() override { + return std::unique_ptr( + new cn::WalletGreen(m_dispatcher, m_currency, m_node, m_loggerManager)); } private: INodeCallback& m_callback; const cn::Currency& m_currency; platform_system::Dispatcher m_dispatcher; + platform_system::Event m_stopEvent; logging::LoggerManager& m_loggerManager; cn::CoreConfig m_coreConfig; cn::NetNodeConfig m_netNodeConfig; - cn::core m_core; cn::CryptoNoteProtocolHandler m_protocolHandler; + cn::core m_core; cn::NodeServer m_nodeServer; cn::InProcessNode m_node; std::future m_nodeServerFuture; - - void peerCountUpdated(size_t count) { + void peerCountUpdated(size_t count) override { m_callback.peerCountUpdated(*this, count); } - void localBlockchainUpdated(uint64_t height) { + void localBlockchainUpdated(uint32_t height) override { m_callback.localBlockchainUpdated(*this, height); } - void lastKnownBlockHeightUpdated(uint64_t height) { + void lastKnownBlockHeightUpdated(uint32_t height) override { m_callback.lastKnownBlockHeightUpdated(*this, height); } }; diff --git a/src/CryptoNoteWrapper.h b/src/CryptoNoteWrapper.h index e1fde58c..514d84ce 100644 --- a/src/CryptoNoteWrapper.h +++ b/src/CryptoNoteWrapper.h @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -17,7 +17,7 @@ namespace cn { class INode; -class IWalletLegacy; +class IWallet; class Currency; class CoreConfig; class NetNodeConfig; @@ -32,7 +32,7 @@ namespace WalletGui { class Node { public: - virtual ~Node() = 0; + virtual ~Node() = default; virtual void init(const std::function& callback) = 0; virtual void deinit() = 0; @@ -43,11 +43,12 @@ class Node { virtual uint64_t getLastLocalBlockTimestamp() const = 0; virtual uint64_t getPeerCount() const = 0; - virtual cn::IWalletLegacy* createWallet() = 0; + virtual std::unique_ptr createWallet() = 0; }; class INodeCallback { public: + virtual ~INodeCallback() = default; virtual void peerCountUpdated(Node& node, size_t count) = 0; virtual void localBlockchainUpdated(Node& node, uint64_t height) = 0; virtual void lastKnownBlockHeightUpdated(Node& node, uint64_t height) = 0; diff --git a/src/CurrencyAdapter.cpp b/src/CurrencyAdapter.cpp index 4da04ea7..7a7e2ba7 100644 --- a/src/CurrencyAdapter.cpp +++ b/src/CurrencyAdapter.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/CurrencyAdapter.h b/src/CurrencyAdapter.h index 0fb83913..4215f89b 100644 --- a/src/CurrencyAdapter.h +++ b/src/CurrencyAdapter.h @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/ExchangeProvider.cpp b/src/ExchangeProvider.cpp index 33b726b6..f5e38078 100644 --- a/src/ExchangeProvider.cpp +++ b/src/ExchangeProvider.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/ExchangeProvider.h b/src/ExchangeProvider.h index 19c1ecfe..aeca2234 100644 --- a/src/ExchangeProvider.h +++ b/src/ExchangeProvider.h @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/LogFileWatcher.cpp b/src/LogFileWatcher.cpp index a8f29a6c..1676ba8e 100644 --- a/src/LogFileWatcher.cpp +++ b/src/LogFileWatcher.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/LogFileWatcher.h b/src/LogFileWatcher.h index ba5de0f8..a410bf77 100644 --- a/src/LogFileWatcher.h +++ b/src/LogFileWatcher.h @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/LoggerAdapter.cpp b/src/LoggerAdapter.cpp index 22d1ea53..57f7eda1 100644 --- a/src/LoggerAdapter.cpp +++ b/src/LoggerAdapter.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/LoggerAdapter.h b/src/LoggerAdapter.h index 818bee11..5fb76e97 100644 --- a/src/LoggerAdapter.h +++ b/src/LoggerAdapter.h @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/NodeAdapter.cpp b/src/NodeAdapter.cpp index 21ce7c1e..4eb0fe35 100644 --- a/src/NodeAdapter.cpp +++ b/src/NodeAdapter.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -59,9 +59,7 @@ class InProcessNodeInitializer : public QObject { } - ~InProcessNodeInitializer() - { - } + ~InProcessNodeInitializer() override = default; void start(Node **_node, const cn::Currency *currency, INodeCallback *_callback, logging::LoggerManager *_loggerManager, const cn::CoreConfig &_coreConfig, const cn::NetNodeConfig &_netNodeConfig) @@ -81,7 +79,7 @@ class InProcessNodeInitializer : public QObject QCoreApplication::processEvents(); }); } - catch (std::exception) + catch (std::exception&) { Q_EMIT nodeInitFailedSignal(cn::error::INTERNAL_WALLET_ERROR); QCoreApplication::processEvents(); @@ -93,7 +91,61 @@ class InProcessNodeInitializer : public QObject Q_EMIT nodeDeinitCompletedSignal(); } - void stop(Node **_node) + void stop(Node **_node) const + { + Q_CHECK_PTR(_node); + (*_node)->deinit(); + } +}; + +class RpcNodeInitializer : public QObject +{ + Q_OBJECT + Q_DISABLE_COPY(RpcNodeInitializer) + +Q_SIGNALS: + void nodeInitCompletedSignal(); + void nodeInitFailedSignal(int _errorCode); + void nodeDeinitCompletedSignal(); + +public: + explicit RpcNodeInitializer(QObject *_parent = nullptr) + { + } + + ~RpcNodeInitializer() override = default; + + void start(Node **_node, const cn::Currency *currency, INodeCallback *_callback, logging::LoggerManager *_loggerManager, + const std::string& _nodeHost, const unsigned short &_nodePort) + { + (*_node) = createRpcNode(*currency, *_loggerManager, *_callback, _nodeHost, _nodePort); + try + { + (*_node)->init([this](std::error_code _err) { + if (_err) + { + Q_EMIT nodeInitFailedSignal(_err.value()); + QCoreApplication::processEvents(); + return; + } + + Q_EMIT nodeInitCompletedSignal(); + QCoreApplication::processEvents(); + }); + } + catch (std::exception&) + { + Q_EMIT nodeInitFailedSignal(cn::error::INTERNAL_WALLET_ERROR); + QCoreApplication::processEvents(); + return; + } + + delete *_node; + *_node = nullptr; + Q_EMIT nodeDeinitCompletedSignal(); + } + + void stop(Node **_node) const { Q_CHECK_PTR(_node); (*_node)->deinit(); @@ -106,20 +158,22 @@ NodeAdapter &NodeAdapter::instance() return inst; } -NodeAdapter::NodeAdapter() : QObject(), m_node(nullptr), m_nodeInitializerThread(), m_nodeInitializer(new InProcessNodeInitializer) +NodeAdapter::NodeAdapter() : QObject(), m_inProcessNodeInitializer(new InProcessNodeInitializer), m_rpcNodeInitializer(new RpcNodeInitializer) { - m_nodeInitializer->moveToThread(&m_nodeInitializerThread); + m_inProcessNodeInitializer->moveToThread(&m_inProcessNodeInitializerThread); + m_rpcNodeInitializer->moveToThread(&m_rpcNodeInitializerThread); qRegisterMetaType("cn::CoreConfig"); qRegisterMetaType("cn::NetNodeConfig"); + qRegisterMetaType("std::string"); - connect(m_nodeInitializer, &InProcessNodeInitializer::nodeInitCompletedSignal, this, &NodeAdapter::nodeInitCompletedSignal, Qt::QueuedConnection); - connect(this, &NodeAdapter::initNodeSignal, m_nodeInitializer, &InProcessNodeInitializer::start, Qt::QueuedConnection); - connect(this, &NodeAdapter::deinitNodeSignal, m_nodeInitializer, &InProcessNodeInitializer::stop, Qt::QueuedConnection); -} + connect(m_inProcessNodeInitializer, &InProcessNodeInitializer::nodeInitCompletedSignal, this, &NodeAdapter::nodeInitCompletedSignal, Qt::QueuedConnection); + connect(this, &NodeAdapter::initInProcessNodeSignal, m_inProcessNodeInitializer, &InProcessNodeInitializer::start, Qt::QueuedConnection); + connect(this, &NodeAdapter::deinitInProcessNodeSignal, m_inProcessNodeInitializer, &InProcessNodeInitializer::stop, Qt::QueuedConnection); -NodeAdapter::~NodeAdapter() -{ + connect(m_rpcNodeInitializer, &RpcNodeInitializer::nodeInitCompletedSignal, this, &NodeAdapter::nodeInitCompletedSignal, Qt::QueuedConnection); + connect(this, &NodeAdapter::initRpcNodeSignal, m_rpcNodeInitializer, &RpcNodeInitializer::start, Qt::QueuedConnection); + connect(this, &NodeAdapter::deinitRpcNodeSignal, m_rpcNodeInitializer, &RpcNodeInitializer::stop, Qt::QueuedConnection); } quintptr NodeAdapter::getPeerCount() const @@ -140,7 +194,7 @@ QString NodeAdapter::extractPaymentId(const std::string &_extra) const return QString::fromStdString(m_node->extractPaymentId(_extra)); } -cn::IWalletLegacy *NodeAdapter::createWallet() const +std::unique_ptr NodeAdapter::createWallet() const { Q_CHECK_PTR(m_node); return m_node->createWallet(); @@ -149,7 +203,6 @@ cn::IWalletLegacy *NodeAdapter::createWallet() const bool NodeAdapter::init() { Q_ASSERT(m_node == nullptr); - bool isAutoRemote = false; /* First get the connection type */ QString connection = Settings::instance().getConnection(); @@ -158,7 +211,6 @@ bool NodeAdapter::init() from the node pool on the explorer. */ if (connection.compare("autoremote") == 0) { - isAutoRemote = true; /* Pull a random node from the node pool list */ auto *nam = new QNetworkAccessManager(this); connect(nam, &QNetworkAccessManager::finished, this, &NodeAdapter::downloadFinished); @@ -171,78 +223,11 @@ bool NodeAdapter::init() the wallet creates a local node and starts the sync process. */ if (connection.compare("embedded") == 0 || Settings::instance().getCurrentRemoteNode() == "") { - QUrl localNodeUrl = QUrl::fromUserInput(QString("127.0.0.1:%1").arg(cn::RPC_DEFAULT_PORT)); - m_node = createRpcNode(CurrencyAdapter::instance().getCurrency(), LoggerAdapter::instance().getLoggerManager(), *this, localNodeUrl.host().toStdString(), localNodeUrl.port()); - - QTimer initTimer; - initTimer.setInterval(3000); - initTimer.setSingleShot(true); - initTimer.start(); - bool initCompleted = false; - m_node->init([this](std::error_code _err) { - Q_UNUSED(_err); - }); - - QEventLoop waitLoop; - connect(&initTimer, &QTimer::timeout, &waitLoop, &QEventLoop::quit); - connect(this, &NodeAdapter::peerCountUpdatedSignal, [&initCompleted]() { - initCompleted = true; - }); - - connect(this, &NodeAdapter::localBlockchainUpdatedSignal, [&initCompleted]() { - initCompleted = true; - }); - - connect(this, &NodeAdapter::peerCountUpdatedSignal, &waitLoop, &QEventLoop::quit); - connect(this, &NodeAdapter::localBlockchainUpdatedSignal, &waitLoop, &QEventLoop::quit); - - waitLoop.exec(); - if (initTimer.isActive() && !initCompleted) - { - return false; - } - - if (initTimer.isActive()) - { - - initTimer.stop(); - Q_EMIT nodeInitCompletedSignal(); - return true; - } - delete m_node; - m_node = nullptr; return initInProcessNode(); } else { - QUrl remoteNodeUrl = QUrl::fromUserInput(Settings::instance().getCurrentRemoteNode()); - Q_ASSERT(m_node == nullptr); - m_node = createRpcNode(CurrencyAdapter::instance().getCurrency(), - LoggerAdapter::instance().getLoggerManager(), - *this, - remoteNodeUrl.host().toStdString(), - remoteNodeUrl.port()); - QTimer initTimer; - initTimer.setInterval(3000); - initTimer.setSingleShot(true); - initTimer.start(); - - m_node->init([this](std::error_code _err) { - Q_UNUSED(_err); - }); - - QEventLoop waitLoop; - connect(&initTimer, &QTimer::timeout, &waitLoop, &QEventLoop::quit); - connect(this, &NodeAdapter::peerCountUpdatedSignal, &waitLoop, &QEventLoop::quit); - connect(this, &NodeAdapter::localBlockchainUpdatedSignal, &waitLoop, &QEventLoop::quit); - waitLoop.exec(); - if (initTimer.isActive()) - { - - initTimer.stop(); - Q_EMIT nodeInitCompletedSignal(); - } - return true; + return initRpcNode(); } } @@ -301,20 +286,47 @@ void NodeAdapter::downloadFinished(QNetworkReply *reply) bool NodeAdapter::initInProcessNode() { Q_ASSERT(m_node == nullptr); - m_nodeInitializerThread.start(); + m_inProcessNodeInitializerThread.start(); cn::CoreConfig coreConfig = makeCoreConfig(); cn::NetNodeConfig netNodeConfig = makeNetNodeConfig(); - Q_EMIT initNodeSignal(&m_node, &CurrencyAdapter::instance().getCurrency(), this, &LoggerAdapter::instance().getLoggerManager(), coreConfig, netNodeConfig); + Q_EMIT initInProcessNodeSignal(&m_node, &CurrencyAdapter::instance().getCurrency(), this, &LoggerAdapter::instance().getLoggerManager(), coreConfig, netNodeConfig); + QEventLoop waitLoop; + bool initCompleted = false; + connect(m_inProcessNodeInitializer, &InProcessNodeInitializer::nodeInitCompletedSignal, [&initCompleted]() { + initCompleted = true; + }); + connect(m_inProcessNodeInitializer, &InProcessNodeInitializer::nodeInitFailedSignal, [&initCompleted]() { + initCompleted = false; + }); + connect(m_inProcessNodeInitializer, &InProcessNodeInitializer::nodeInitCompletedSignal, &waitLoop, &QEventLoop::quit); + connect(m_inProcessNodeInitializer, &InProcessNodeInitializer::nodeInitFailedSignal, &waitLoop, &QEventLoop::exit); + + if (waitLoop.exec() != 0 || !initCompleted) + { + return false; + } + + Q_EMIT localBlockchainUpdatedSignal(getLastLocalBlockHeight()); + Q_EMIT lastKnownBlockHeightUpdatedSignal(getLastKnownBlockHeight()); + return true; +} + +bool NodeAdapter::initRpcNode() +{ + Q_ASSERT(m_node == nullptr); + m_rpcNodeInitializerThread.start(); + QUrl remoteNodeUrl = QUrl::fromUserInput(Settings::instance().getCurrentRemoteNode()); + Q_EMIT initRpcNodeSignal(&m_node, &CurrencyAdapter::instance().getCurrency(), this, &LoggerAdapter::instance().getLoggerManager(), remoteNodeUrl.host().toStdString(), remoteNodeUrl.port()); QEventLoop waitLoop; bool initCompleted = false; - connect(m_nodeInitializer, &InProcessNodeInitializer::nodeInitCompletedSignal, [&initCompleted]() { + connect(m_rpcNodeInitializer, &RpcNodeInitializer::nodeInitCompletedSignal, [&initCompleted]() { initCompleted = true; }); - connect(m_nodeInitializer, &InProcessNodeInitializer::nodeInitFailedSignal, [&initCompleted]() { + connect(m_rpcNodeInitializer, &RpcNodeInitializer::nodeInitFailedSignal, [&initCompleted]() { initCompleted = false; }); - connect(m_nodeInitializer, &InProcessNodeInitializer::nodeInitCompletedSignal, &waitLoop, &QEventLoop::quit); - connect(m_nodeInitializer, &InProcessNodeInitializer::nodeInitFailedSignal, &waitLoop, &QEventLoop::exit); + connect(m_rpcNodeInitializer, &RpcNodeInitializer::nodeInitCompletedSignal, &waitLoop, &QEventLoop::quit); + connect(m_rpcNodeInitializer, &RpcNodeInitializer::nodeInitFailedSignal, &waitLoop, &QEventLoop::exit); if (waitLoop.exec() != 0 || !initCompleted) { @@ -330,15 +342,24 @@ void NodeAdapter::deinit() { if (m_node != nullptr) { - if (m_nodeInitializerThread.isRunning()) + if (m_inProcessNodeInitializerThread.isRunning()) { - m_nodeInitializer->stop(&m_node); + m_inProcessNodeInitializer->stop(&m_node); QEventLoop waitLoop; - connect(m_nodeInitializer, &InProcessNodeInitializer::nodeDeinitCompletedSignal, &waitLoop, &QEventLoop::quit, Qt::QueuedConnection); + connect(m_inProcessNodeInitializer, &InProcessNodeInitializer::nodeDeinitCompletedSignal, &waitLoop, &QEventLoop::quit, Qt::QueuedConnection); waitLoop.exec(); - m_nodeInitializerThread.quit(); - m_nodeInitializerThread.wait(); + m_inProcessNodeInitializerThread.quit(); + m_inProcessNodeInitializerThread.wait(); } + else if (m_rpcNodeInitializerThread.isRunning()) + { + m_rpcNodeInitializer->stop(&m_node); + QEventLoop waitLoop; + connect(m_rpcNodeInitializer, &RpcNodeInitializer::nodeDeinitCompletedSignal, &waitLoop, &QEventLoop::quit, Qt::QueuedConnection); + waitLoop.exec(); + m_rpcNodeInitializerThread.quit(); + m_rpcNodeInitializerThread.wait(); + } else { delete m_node; @@ -364,8 +385,8 @@ cn::NetNodeConfig NodeAdapter::makeNetNodeConfig() const cn::NetNodeConfig config; boost::program_options::variables_map options; boost::any p2pBindIp = Settings::instance().getP2pBindIp().toStdString(); - boost::any p2pBindPort = static_cast(Settings::instance().getP2pBindPort()); - boost::any p2pExternalPort = static_cast(Settings::instance().getP2pExternalPort()); + boost::any p2pBindPort = Settings::instance().getP2pBindPort(); + boost::any p2pExternalPort = Settings::instance().getP2pExternalPort(); boost::any p2pAllowLocalIp = Settings::instance().hasAllowLocalIpOption(); boost::any dataDir = Settings::instance().getDataDir().absolutePath().toStdString(); boost::any hideMyPort = Settings::instance().hasHideMyPortOption(); @@ -401,7 +422,6 @@ cn::NetNodeConfig NodeAdapter::makeNetNodeConfig() const options.insert(std::make_pair("hide-my-port", boost::program_options::variable_value(hideMyPort, false))); options.insert(std::make_pair("data-dir", boost::program_options::variable_value(dataDir, false))); - int size = (int)options.size(); config.init(options); config.setTestnet(Settings::instance().isTestnet()); return config; diff --git a/src/NodeAdapter.h b/src/NodeAdapter.h index 70b08449..4b0210bb 100644 --- a/src/NodeAdapter.h +++ b/src/NodeAdapter.h @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include "CryptoNoteWrapper.h" @@ -30,6 +30,7 @@ namespace logging { namespace WalletGui { class InProcessNodeInitializer; +class RpcNodeInitializer; class NodeAdapter : public QObject, public INodeCallback { Q_OBJECT @@ -41,7 +42,7 @@ class NodeAdapter : public QObject, public INodeCallback { quintptr getPeerCount() const; std::string convertPaymentId(const QString& _payment_id_string) const; QString extractPaymentId(const std::string& _extra) const; - cn::IWalletLegacy* createWallet() const; + std::unique_ptr createWallet() const; bool init(); void deinit(); @@ -54,14 +55,17 @@ class NodeAdapter : public QObject, public INodeCallback { private: Node* m_node; - QThread m_nodeInitializerThread; - InProcessNodeInitializer* m_nodeInitializer; + QThread m_inProcessNodeInitializerThread; + QThread m_rpcNodeInitializerThread; + InProcessNodeInitializer* m_inProcessNodeInitializer; + RpcNodeInitializer* m_rpcNodeInitializer; void downloadFinished(QNetworkReply *reply); NodeAdapter(); - ~NodeAdapter(); + ~NodeAdapter() override = default; bool initInProcessNode(); + bool initRpcNode(); cn::CoreConfig makeCoreConfig() const; cn::NetNodeConfig makeNetNodeConfig() const; @@ -70,9 +74,13 @@ class NodeAdapter : public QObject, public INodeCallback { void lastKnownBlockHeightUpdatedSignal(quint64 _height); void nodeInitCompletedSignal(); void peerCountUpdatedSignal(quintptr _count); - void initNodeSignal(Node** _node, const cn::Currency* currency, INodeCallback* _callback, logging::LoggerManager* _loggerManager, + void initInProcessNodeSignal(Node** _node, const cn::Currency* currency, INodeCallback* _callback, logging::LoggerManager* _loggerManager, const cn::CoreConfig& _coreConfig, const cn::NetNodeConfig& _netNodeConfig); - void deinitNodeSignal(Node** _node); + void deinitInProcessNodeSignal(Node** _node); + void initRpcNodeSignal(Node** _node, const cn::Currency* currency, INodeCallback* _callback, + logging::LoggerManager* _loggerManager, const std::string& _nodeHost, + const unsigned short& _nodePort); + void deinitRpcNodeSignal(Node** _node); }; } diff --git a/src/OptimizationManager.cpp b/src/OptimizationManager.cpp index e0195977..29697232 100644 --- a/src/OptimizationManager.cpp +++ b/src/OptimizationManager.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/OptimizationManager.h b/src/OptimizationManager.h index 248a107a..749c7895 100644 --- a/src/OptimizationManager.h +++ b/src/OptimizationManager.h @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/PriceProvider.cpp b/src/PriceProvider.cpp index 00145c42..cd83908b 100644 --- a/src/PriceProvider.cpp +++ b/src/PriceProvider.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/PriceProvider.h b/src/PriceProvider.h index 75f1c751..1c0f694a 100644 --- a/src/PriceProvider.h +++ b/src/PriceProvider.h @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/Settings.cpp b/src/Settings.cpp index 31c24af3..defae348 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/Settings.h b/src/Settings.h index 75772c9a..f7789ec8 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/SignalHandler.cpp b/src/SignalHandler.cpp index 4db38764..08ba1a03 100644 --- a/src/SignalHandler.cpp +++ b/src/SignalHandler.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/SignalHandler.h b/src/SignalHandler.h index 92b08654..169566fb 100644 --- a/src/SignalHandler.h +++ b/src/SignalHandler.h @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/TranslatorManager.cpp b/src/TranslatorManager.cpp index de60c9e2..4192fa7d 100644 --- a/src/TranslatorManager.cpp +++ b/src/TranslatorManager.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/TranslatorManager.h b/src/TranslatorManager.h index 3e51ee6c..926aff46 100644 --- a/src/TranslatorManager.h +++ b/src/TranslatorManager.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/UpdateManager.cpp b/src/UpdateManager.cpp index a8c800d4..d300c3e1 100644 --- a/src/UpdateManager.cpp +++ b/src/UpdateManager.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/UpdateManager.h b/src/UpdateManager.h index 6147d3e2..09a1bc76 100644 --- a/src/UpdateManager.h +++ b/src/UpdateManager.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/WalletAdapter.cpp b/src/WalletAdapter.cpp index 04ed5375..8546015d 100644 --- a/src/WalletAdapter.cpp +++ b/src/WalletAdapter.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -11,6 +11,7 @@ #include "LoggerAdapter.h" #include +#include #include #include #include @@ -39,8 +40,8 @@ WalletAdapter& WalletAdapter::instance() { WalletAdapter::WalletAdapter() : QObject(), m_wallet(nullptr), m_mutex(), m_isBackupInProgress(false), m_isSynchronized(false), m_newTransactionsNotificationTimer(), m_lastWalletTransactionId(std::numeric_limits::max()), - m_sentTransactionId(cn::WALLET_LEGACY_INVALID_TRANSACTION_ID), m_sentMessageId(cn::WALLET_LEGACY_INVALID_TRANSACTION_ID), - m_depositId(cn::WALLET_LEGACY_INVALID_TRANSACTION_ID), m_depositWithdrawalId(cn::WALLET_LEGACY_INVALID_TRANSACTION_ID) { + m_sentTransactionId(cn::WALLET_INVALID_TRANSACTION_ID), m_sentMessageId(cn::WALLET_INVALID_TRANSACTION_ID), + m_depositId(cn::WALLET_INVALID_TRANSACTION_ID), m_depositWithdrawalId(cn::WALLET_INVALID_TRANSACTION_ID) { connect(this, &WalletAdapter::walletInitCompletedSignal, this, &WalletAdapter::onWalletInitCompleted, Qt::QueuedConnection); connect(this, &WalletAdapter::walletSendTransactionCompletedSignal, this, &WalletAdapter::onWalletSendTransactionCompleted, Qt::QueuedConnection); connect(this, &WalletAdapter::updateBlockStatusTextSignal, this, &WalletAdapter::updateBlockStatusText, Qt::QueuedConnection); @@ -65,7 +66,7 @@ WalletAdapter::~WalletAdapter() { QString WalletAdapter::getAddress() const { try { - return m_wallet == nullptr ? QString() : QString::fromStdString(m_wallet->getAddress()); + return m_wallet ? QString::fromStdString(m_wallet->getAddress(0)) : QString(); } catch (std::system_error&) { return QString(); } @@ -73,7 +74,7 @@ QString WalletAdapter::getAddress() const { quint64 WalletAdapter::getActualBalance() const { try { - return m_wallet == nullptr ? 0 : m_wallet->actualBalance(); + return m_wallet ? m_wallet->getActualBalance() : 0; } catch (std::system_error&) { return 0; } @@ -81,7 +82,7 @@ quint64 WalletAdapter::getActualBalance() const { quint64 WalletAdapter::getPendingBalance() const { try { - return m_wallet == nullptr ? 0 : m_wallet->pendingBalance(); + return m_wallet ? m_wallet->getPendingBalance() : 0; } catch (std::system_error&) { return 0; } @@ -89,18 +90,14 @@ quint64 WalletAdapter::getPendingBalance() const { quint64 WalletAdapter::getActualDepositBalance() const { try { - return m_wallet == nullptr ? 0 : m_wallet->actualDepositBalance(); + return m_wallet ? m_wallet->getUnlockedDepositBalance() : 0; } catch (std::system_error&) { return 0; } } quint64 WalletAdapter::getActualInvestmentBalance() const { - try { - return m_wallet == nullptr ? 0 : m_wallet->actualInvestmentBalance(); - } catch (std::system_error&) { - return 0; - } + return 0; } /* Get the current maximum we can send because of dust outputs without optimizing the wallet */ @@ -108,7 +105,7 @@ quint64 WalletAdapter::getWalletMaximum() const { try { - return m_wallet == nullptr ? 0 : m_wallet->getWalletMaximum(); + return m_wallet ? m_wallet->getActualBalance() : 0; } catch (std::system_error&) { @@ -117,24 +114,18 @@ quint64 WalletAdapter::getWalletMaximum() const } quint64 WalletAdapter::getPendingInvestmentBalance() const { - try { - return m_wallet == nullptr ? 0 : m_wallet->pendingInvestmentBalance(); - } catch (std::system_error&) { - return 0; - } + return 0; } quint64 WalletAdapter::getPendingDepositBalance() const { try { - return m_wallet == nullptr ? 0 : m_wallet->pendingDepositBalance(); + return m_wallet ? m_wallet->getLockedDepositBalance() : 0; } catch (std::system_error&) { return 0; } } void WalletAdapter::open(const QString& _password) { - - Q_ASSERT(m_wallet == nullptr); Settings::instance().setEncrypted(!_password.isEmpty()); Q_EMIT walletStateChangedSignal(tr("Opening wallet"),""); @@ -148,50 +139,60 @@ void WalletAdapter::open(const QString& _password) { } } - if (openFile(Settings::instance().getWalletFile(), true)) { - try { - m_wallet->initAndLoad(m_file, _password.toStdString()); - } catch (std::system_error&) { - closeFile(); - delete m_wallet; - m_wallet = nullptr; - } + try { + m_wallet->load(Settings::instance().getWalletFile().toStdString(), _password.toStdString()); + LoggerAdapter::instance().log("loaded"); + } catch (std::system_error&) { + Q_EMIT openWalletWithPasswordSignal(!_password.isEmpty()); } - } else {} + } } void WalletAdapter::createWallet() { - - Q_ASSERT(m_wallet == nullptr); Settings::instance().setEncrypted(false); Q_EMIT walletStateChangedSignal(tr("Creating wallet"), ""); m_wallet = NodeAdapter::instance().createWallet(); try { - m_wallet->initAndGenerate(""); + crypto::SecretKey private_view_key; + cn::KeyPair spendKey; + + crypto::generate_keys(spendKey.publicKey, spendKey.secretKey); + + crypto::PublicKey unused; + + cn::AccountBase::generateViewFromSpend(spendKey.secretKey, private_view_key, unused); + + m_wallet->initializeWithViewKey(Settings::instance().getWalletFile().toStdString(), "", private_view_key); + m_wallet->createAddress(spendKey.secretKey); + m_wallet->save(cn::WalletSaveLevel::SAVE_KEYS_ONLY); } catch (std::system_error&) { - delete m_wallet; - m_wallet = nullptr; + m_wallet.reset(); } } void WalletAdapter::addObserver() { - Q_CHECK_PTR(m_wallet); m_wallet->addObserver(this); } void WalletAdapter::createWithKeys(const cn::AccountKeys& _keys) { m_wallet = NodeAdapter::instance().createWallet(); - m_wallet->addObserver(this); Settings::instance().setEncrypted(false); Q_EMIT walletStateChangedSignal(tr("Importing keys"),""); - m_wallet->initWithKeys(_keys, ""); + m_wallet->initializeWithViewKey(Settings::instance().getWalletFile().toStdString(), "", _keys.viewSecretKey); + if (_keys.spendSecretKey != cn::NULL_SECRET_KEY) { + m_wallet->createAddress(_keys.spendSecretKey); + } else { + m_wallet->createAddress(_keys.address.spendPublicKey); + } + m_wallet->reset(0); + addObserver(); } bool WalletAdapter::isOpen() const { - return m_wallet != nullptr; + return m_wallet.get() != nullptr; } bool WalletAdapter::importLegacyWallet(const QString &_password) { @@ -199,44 +200,33 @@ bool WalletAdapter::importLegacyWallet(const QString &_password) { Settings::instance().setEncrypted(!_password.isEmpty()); try { fileName.replace(fileName.lastIndexOf(".keys"), 5, ".wallet"); - if (!openFile(fileName, false)) { - delete m_wallet; - m_wallet = nullptr; + + m_wallet.reset(); return false; - } - - cn::importLegacyKeys(Settings::instance().getWalletFile().toStdString(), _password.toStdString(), m_file); - closeFile(); Settings::instance().setWalletFile(fileName); return true; } catch (std::system_error& _err) { - closeFile(); if (_err.code().value() == cn::error::WRONG_PASSWORD) { Settings::instance().setEncrypted(true); Q_EMIT openWalletWithPasswordSignal(!_password.isEmpty()); } } catch (std::runtime_error&) { - closeFile(); } - delete m_wallet; - m_wallet = nullptr; + m_wallet.reset(); return false; } void WalletAdapter::close() { - Q_CHECK_PTR(m_wallet); + QMutexLocker locker(&m_mutex); save(true, true); - lock(); m_wallet->removeObserver(this); m_isSynchronized = false; m_newTransactionsNotificationTimer.stop(); m_lastWalletTransactionId = std::numeric_limits::max(); Q_EMIT walletCloseCompletedSignal(); QCoreApplication::processEvents(); - delete m_wallet; - m_wallet = nullptr; - unlock(); + m_wallet.reset(); } bool WalletAdapter::save(bool _details, bool _cache) { @@ -244,46 +234,28 @@ bool WalletAdapter::save(bool _details, bool _cache) { } bool WalletAdapter::save(const QString& _file, bool _details, bool _cache) { - Q_CHECK_PTR(m_wallet); - if (openFile(_file, false)) { - try { - m_wallet->save(m_file, _details, _cache); - } catch (std::system_error&) { - closeFile(); - return false; - } - Q_EMIT walletStateChangedSignal(tr("Saving data"),""); - } else { + try { + cn::WalletSaveLevel level = _details ? cn::WalletSaveLevel::SAVE_ALL : cn::WalletSaveLevel::SAVE_KEYS_ONLY; + m_wallet->save(level); + } catch (std::system_error&) { return false; } + Q_EMIT walletStateChangedSignal(tr("Saving data"), ""); return true; } void WalletAdapter::backup(const QString& _file) { - if (save(_file.endsWith(".wallet") ? _file : _file + ".wallet", true, false)) { - m_isBackupInProgress = true; - } + m_wallet->exportWallet(_file.toStdString(), cn::WalletSaveLevel::SAVE_ALL); } void WalletAdapter::reset() { - Q_CHECK_PTR(m_wallet); - save(false, false); - lock(); - m_wallet->removeObserver(this); - m_isSynchronized = false; - m_newTransactionsNotificationTimer.stop(); - m_lastWalletTransactionId = std::numeric_limits::max(); - Q_EMIT walletCloseCompletedSignal(); - QCoreApplication::processEvents(); - delete m_wallet; - m_wallet = nullptr; - unlock(); + QMutexLocker locker(&m_mutex); + m_wallet->reset(0); } quint64 WalletAdapter::getTransactionCount() const { - Q_CHECK_PTR(m_wallet); try { return m_wallet->getTransactionCount(); @@ -296,10 +268,9 @@ quint64 WalletAdapter::getTransactionCount() const quint64 WalletAdapter::getTransferCount() const { - Q_CHECK_PTR(m_wallet); try { - return m_wallet->getTransferCount(); + return 0; } catch (std::system_error&) { @@ -309,10 +280,9 @@ quint64 WalletAdapter::getTransferCount() const quint64 WalletAdapter::getDepositCount() const { - Q_CHECK_PTR(m_wallet); try { - return m_wallet->getDepositCount(); + return m_wallet->getWalletDepositCount(); } catch (std::system_error&) { @@ -320,12 +290,12 @@ quint64 WalletAdapter::getDepositCount() const } } -bool WalletAdapter::getTransaction(cn::TransactionId _id, cn::WalletLegacyTransaction& _transaction) +bool WalletAdapter::getTransaction(cn::TransactionId _id, cn::WalletTransaction& _transaction) const { - Q_CHECK_PTR(m_wallet); try { - return m_wallet->getTransaction(_id, _transaction); + _transaction= m_wallet->getTransaction(_id); + return true; } catch (std::system_error&) { @@ -333,12 +303,12 @@ bool WalletAdapter::getTransaction(cn::TransactionId _id, cn::WalletLegacyTransa } } -bool WalletAdapter::getTransfer(cn::TransferId _id, cn::WalletLegacyTransfer& _transfer) +bool WalletAdapter::getTransfer(size_t transactionIndex, size_t transferIndex, cn::WalletTransfer& transfer) const { - Q_CHECK_PTR(m_wallet); try { - return m_wallet->getTransfer(_id, _transfer); + transfer = m_wallet->getTransactionTransfer(transactionIndex, transferIndex); + return true; } catch (std::system_error&) { @@ -347,10 +317,10 @@ bool WalletAdapter::getTransfer(cn::TransferId _id, cn::WalletLegacyTransfer& _t } bool WalletAdapter::getDeposit(cn::DepositId _id, cn::Deposit& _deposit) { - Q_CHECK_PTR(m_wallet); try { - return m_wallet->getDeposit(_id, _deposit); + _deposit = m_wallet->getDeposit(_id); + return true; } catch (std::system_error&) { @@ -360,10 +330,14 @@ bool WalletAdapter::getDeposit(cn::DepositId _id, cn::Deposit& _deposit) { bool WalletAdapter::getAccountKeys(cn::AccountKeys& _keys) { - Q_CHECK_PTR(m_wallet); try { - m_wallet->getAccountKeys(_keys); + cn::KeyPair viewKey = m_wallet->getViewKey(); + cn::KeyPair spendKey = m_wallet->getAddressSpendKey(0); + _keys.address.spendPublicKey = spendKey.publicKey; + _keys.address.viewPublicKey = viewKey.publicKey; + _keys.spendSecretKey = spendKey.secretKey; + _keys.viewSecretKey = viewKey.secretKey; return true; } catch (std::system_error&) @@ -395,117 +369,107 @@ bool WalletAdapter::getMnemonicSeed(std::string& _seed) } } -void WalletAdapter::sendTransaction(QVector& _transfers, +void WalletAdapter::sendTransaction(QVector& _transfers, quint64 _fee, const QString& _paymentId, - const QVector& _messages, + const QVector& _messages, quint64 _mixin) { - Q_CHECK_PTR(m_wallet); + QMutexLocker locker(&m_mutex); try { - LoggerAdapter::instance().log("lock"); - lock(); - LoggerAdapter::instance().log("locked"); crypto::SecretKey _transactionsk; - std::vector transfers = _transfers.toStdVector(); - LoggerAdapter::instance().log("Sending transaction to WalletLegacy"); - m_sentTransactionId = - m_wallet->sendTransaction(_transactionsk, - transfers, - _fee, - NodeAdapter::instance().convertPaymentId(_paymentId), - _mixin, - 0, - _messages.toStdVector()); + std::vector transfers = _transfers.toStdVector(); + LoggerAdapter::instance().log("Sending transaction to WalletGreen"); + cn::TransactionParameters sendParams; + sendParams.destinations = transfers; + sendParams.messages = _messages.toStdVector(); + sendParams.unlockTimestamp = 0; + sendParams.changeDestination = m_wallet->getAddress(0); + + if (!_paymentId.isEmpty()) { + cn::addPaymentIdToExtra(NodeAdapter::instance().convertPaymentId(_paymentId), sendParams.extra); + } + + m_sentTransactionId = m_wallet->transfer(sendParams, _transactionsk); Q_EMIT walletStateChangedSignal(tr("Sending transaction"), ""); - LoggerAdapter::instance().log("Transaction sent by WalletLegacy"); + LoggerAdapter::instance().log("Transaction sent by WalletGreen"); } catch (std::system_error&) { - unlock(); - LoggerAdapter::instance().log("unlocked"); } } quint64 WalletAdapter::getNumUnlockedOutputs() const { - Q_CHECK_PTR(m_wallet); - return m_wallet->getNumUnlockedOutputs(); -} + return m_wallet->getUnspentOutputsCount(); +} + +quint64 WalletAdapter::getTransferCount(cn::TransactionId id) const { + return m_wallet->getTransactionTransferCount(id); +} void WalletAdapter::optimizeWallet() { - Q_CHECK_PTR(m_wallet); - std::vector transfers; - std::vector messages; - std::string extraString; - uint64_t fee = cn::parameters::MINIMUM_FEE; - uint64_t mixIn = 0; - uint64_t unlockTimestamp = 0; - uint64_t ttl = 0; - crypto::SecretKey transactionSK; + QMutexLocker locker(&m_mutex); try { - lock(); - m_sentTransactionId = m_wallet->sendTransaction(transactionSK, transfers, fee, extraString, mixIn, unlockTimestamp, messages, ttl); + m_sentTransactionId = m_wallet->createOptimizationTransaction(m_wallet->getAddress(0)); Q_EMIT walletStateChangedSignal(tr("Optimizing wallet"), ""); } catch (std::system_error&) { - unlock(); } } -void WalletAdapter::sendMessage(QVector& _transfers, +void WalletAdapter::sendMessage(QVector& _transfers, quint64 _fee, - const QVector& _messages, + const QVector& _messages, quint64 _ttl, quint64 _mixin) { - Q_CHECK_PTR(m_wallet); + QMutexLocker locker(&m_mutex); crypto::SecretKey _transactionsk; try { - lock(); - std::vector transfers = _transfers.toStdVector(); - m_sentMessageId = m_wallet->sendTransaction( - _transactionsk, transfers, _fee, "", _mixin, 0, _messages.toStdVector(), _ttl); + std::vector transfers = _transfers.toStdVector(); + cn::TransactionParameters sendParams; + sendParams.destinations = transfers; + sendParams.messages = _messages.toStdVector(); + sendParams.unlockTimestamp = 0; + sendParams.changeDestination = m_wallet->getAddress(0); + m_sentMessageId = m_wallet->transfer(sendParams, _transactionsk); Q_EMIT walletStateChangedSignal(tr("Sending message"), ""); } catch (std::system_error&) { - unlock(); } } void WalletAdapter::deposit(quint32 _term, quint64 _amount, quint64 _fee, quint64 _mixIn) { - Q_CHECK_PTR(m_wallet); + QMutexLocker locker(&m_mutex); try { - lock(); - m_depositId = m_wallet->deposit(_term, _amount, _fee, _mixIn); + std::string address = m_wallet->getAddress(0); + std::string tx_hash; + m_wallet->createDeposit(_amount, _term, address, address, tx_hash); Q_EMIT walletStateChangedSignal(tr("Creating deposit"), ""); } catch (std::system_error&) { - unlock(); } } void WalletAdapter::withdrawUnlockedDeposits(QVector _depositIds, quint64 _fee) { - Q_CHECK_PTR(m_wallet); + QMutexLocker locker(&m_mutex); try { - lock(); - m_depositWithdrawalId = m_wallet->withdrawDeposits(_depositIds.toStdVector(), _fee); + std::string tx_hash; + m_wallet->withdrawDeposit(_depositIds.toStdVector()[0], tx_hash); Q_EMIT walletStateChangedSignal(tr("Withdrawing deposit"), ""); } catch (std::system_error&) { - unlock(); } } bool WalletAdapter::changePassword(const QString& _oldPassword, const QString& _newPassword) { - Q_CHECK_PTR(m_wallet); try { - if (m_wallet->changePassword(_oldPassword.toStdString(), _newPassword.toStdString()).value() == cn::error::WRONG_PASSWORD) { - return false; - } + m_wallet->changePassword(_oldPassword.toStdString(), _newPassword.toStdString()); + return true; } catch (std::system_error&) { return false; } @@ -515,28 +479,23 @@ bool WalletAdapter::changePassword(const QString& _oldPassword, const QString& _ } void WalletAdapter::setWalletFile(const QString& _path) { - Q_ASSERT(m_wallet == nullptr); Settings::instance().setWalletFile(_path); } void WalletAdapter::initCompleted(std::error_code _error) { - if (m_file.is_open()) { - closeFile(); - } - Q_EMIT walletInitCompletedSignal(_error.value(), QString::fromStdString(_error.message())); } void WalletAdapter::onWalletInitCompleted(int _error, const QString& _errorText) { switch(_error) { case 0: { - Q_EMIT walletActualBalanceUpdatedSignal(m_wallet->actualBalance()); - Q_EMIT walletPendingBalanceUpdatedSignal(m_wallet->pendingBalance()); - Q_EMIT walletActualDepositBalanceUpdatedSignal(m_wallet->actualDepositBalance()); - Q_EMIT walletPendingDepositBalanceUpdatedSignal(m_wallet->pendingDepositBalance()); - Q_EMIT walletActualInvestmentBalanceUpdatedSignal(m_wallet->actualInvestmentBalance()); - Q_EMIT walletPendingInvestmentBalanceUpdatedSignal(m_wallet->pendingInvestmentBalance()); - Q_EMIT updateWalletAddressSignal(QString::fromStdString(m_wallet->getAddress())); + Q_EMIT walletActualBalanceUpdatedSignal(m_wallet->getActualBalance()); + Q_EMIT walletPendingBalanceUpdatedSignal(m_wallet->getPendingBalance()); + Q_EMIT walletActualDepositBalanceUpdatedSignal(m_wallet->getLockedDepositBalance()); + Q_EMIT walletPendingDepositBalanceUpdatedSignal(m_wallet->getUnlockedDepositBalance()); + Q_EMIT walletActualInvestmentBalanceUpdatedSignal(0); + Q_EMIT walletPendingInvestmentBalanceUpdatedSignal(0); + Q_EMIT updateWalletAddressSignal(QString::fromStdString(m_wallet->getAddress(0))); Q_EMIT reloadWalletTransactionsSignal(); Q_EMIT walletStateChangedSignal(tr("Ready"),""); QTimer::singleShot(5000, this, SLOT(updateBlockStatusText())); @@ -549,12 +508,10 @@ void WalletAdapter::onWalletInitCompleted(int _error, const QString& _errorText) case cn::error::WRONG_PASSWORD: Q_EMIT openWalletWithPasswordSignal(Settings::instance().isEncrypted()); Settings::instance().setEncrypted(true); - delete m_wallet; - m_wallet = nullptr; + m_wallet.reset(); break; default: { - delete m_wallet; - m_wallet = nullptr; + m_wallet.reset(); break; } } @@ -562,15 +519,10 @@ void WalletAdapter::onWalletInitCompleted(int _error, const QString& _errorText) void WalletAdapter::saveCompleted(std::error_code _error) { if (!_error && !m_isBackupInProgress) { - closeFile(); - renameFile(Settings::instance().getWalletFile() + ".temp", Settings::instance().getWalletFile()); Q_EMIT walletStateChangedSignal(tr("Ready"),""); Q_EMIT updateBlockStatusTextWithDelaySignal(); } else if (m_isBackupInProgress) { m_isBackupInProgress = false; - closeFile(); - } else { - closeFile(); } Q_EMIT walletSaveCompletedSignal(_error.value(), QString::fromStdString(_error.message())); @@ -629,26 +581,25 @@ void WalletAdapter::externalTransactionCreated(cn::TransactionId _transactionId) void WalletAdapter::sendTransactionCompleted(cn::TransactionId _transactionId, std::error_code _error) { Q_ASSERT(_transactionId == m_sentTransactionId || _transactionId == m_sentMessageId || _transactionId == m_depositId || _transactionId == m_depositWithdrawalId); - unlock(); Q_EMIT walletSendTransactionCompletedSignal(_transactionId, _error.value(), QString::fromStdString(_error.message())); if (_transactionId == m_sentTransactionId) { - m_sentTransactionId = cn::WALLET_LEGACY_INVALID_TRANSACTION_ID; + m_sentTransactionId = cn::WALLET_INVALID_TRANSACTION_ID; } else if (_transactionId == m_sentMessageId) { Q_EMIT walletSendMessageCompletedSignal(_transactionId, _error.value(), QString::fromStdString(_error.message())); - m_sentMessageId = cn::WALLET_LEGACY_INVALID_TRANSACTION_ID; + m_sentMessageId = cn::WALLET_INVALID_TRANSACTION_ID; } else if (_transactionId == m_depositId) { Q_EMIT walletCreateDepositCompletedSignal(_transactionId, _error.value(), QString::fromStdString(_error.message())); - m_depositId = cn::WALLET_LEGACY_INVALID_TRANSACTION_ID; + m_depositId = cn::WALLET_INVALID_TRANSACTION_ID; } else if (_transactionId == m_depositWithdrawalId) { Q_EMIT walletWithdrawDepositCompletedSignal(_transactionId, _error.value(), QString::fromStdString(_error.message())); - m_depositWithdrawalId = cn::WALLET_LEGACY_INVALID_TRANSACTION_ID; + m_depositWithdrawalId = cn::WALLET_INVALID_TRANSACTION_ID; } Q_EMIT updateBlockStatusTextWithDelaySignal(); } void WalletAdapter::onWalletSendTransactionCompleted(cn::TransactionId _transactionId, int _error, const QString& _errorText) { - cn::WalletLegacyTransaction transaction; + cn::WalletTransaction transaction; if (!this->getTransaction(_transactionId, transaction)) { return; } @@ -662,40 +613,12 @@ void WalletAdapter::transactionUpdated(cn::TransactionId _transactionId) { Q_EMIT walletTransactionUpdatedSignal(_transactionId); } -void WalletAdapter::depositsUpdated(const std::vector& _depositIds) { - Q_EMIT walletDepositsUpdatedSignal(QVector::fromStdVector(_depositIds)); -} - -void WalletAdapter::lock() { - m_mutex.lock(); +void WalletAdapter::depositUpdated(cn::DepositId depositId) { + Q_EMIT walletDepositsUpdatedSignal(QVector(1, depositId)); } -void WalletAdapter::unlock() { - m_mutex.unlock(); -} - -bool WalletAdapter::openFile(const QString& _file, bool _readOnly) -{ - lock(); -#ifdef Q_OS_WIN - const wchar_t* cwc = reinterpret_cast(_file.utf16()); - m_file.open(cwc, - std::ios::binary | (_readOnly ? std::ios::in : (std::ios::out | std::ios::trunc))); -#else - m_file.open(_file.toStdString(), - std::ios::binary | (_readOnly ? std::ios::in : (std::ios::out | std::ios::trunc))); -#endif - if (!m_file.is_open()) - { - unlock(); - } - - return m_file.is_open(); -} - -void WalletAdapter::closeFile() { - m_file.close(); - unlock(); +void WalletAdapter::depositsUpdated(const std::vector& _depositIds) { + Q_EMIT walletDepositsUpdatedSignal(QVector::fromStdVector(_depositIds)); } void WalletAdapter::notifyAboutLastTransaction() { @@ -712,7 +635,7 @@ void WalletAdapter::renameFile(const QString& _oldName, const QString& _newName) } void WalletAdapter::updateBlockStatusText() { - if (m_wallet == nullptr) { + if (!m_wallet) { return; } @@ -743,32 +666,18 @@ void WalletAdapter::updateBlockStatusTextWithDelay() { } bool WalletAdapter::checkWalletPassword(const QString& _password) { - Q_ASSERT(m_wallet != nullptr); - if (Settings::instance().getWalletFile().endsWith(".wallet")) { - if (openFile(Settings::instance().getWalletFile(), true)) { - try { - if (m_wallet->checkWalletPassword(m_file, _password.toStdString())) { - closeFile(); - return true; - } - else { - closeFile(); - return false; - } - } - catch (std::system_error&) { - closeFile(); - return false; - } - } + try { + std::string password = _password.toStdString(); + m_wallet->changePassword(password, password); + } catch (std::system_error&) { + return false; } - return false; + return true; } crypto::SecretKey WalletAdapter::getTxKey(crypto::Hash& txid) { - Q_ASSERT(m_wallet != nullptr); - return m_wallet->getTxKey(txid); + return m_wallet->getTransactionDeterministicSecretKey(txid); } /* Check if the entered payment ID is valid */ diff --git a/src/WalletAdapter.h b/src/WalletAdapter.h index bbcdce58..9f38bfa8 100644 --- a/src/WalletAdapter.h +++ b/src/WalletAdapter.h @@ -2,24 +2,27 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #pragma once -#include +#include +#include +#include #include #include #include #include #include +#include namespace WalletGui { -class WalletAdapter : public QObject, public cn::IWalletLegacyObserver { +class WalletAdapter : public QObject, public cn::IWalletObserver { Q_OBJECT Q_DISABLE_COPY(WalletAdapter) @@ -47,21 +50,22 @@ class WalletAdapter : public QObject, public cn::IWalletLegacyObserver { quint64 getTransferCount() const; quint64 getDepositCount() const; quint64 getNumUnlockedOutputs() const; - bool getTransaction(cn::TransactionId _id, cn::WalletLegacyTransaction& _transaction); - bool getTransfer(cn::TransferId _id, cn::WalletLegacyTransfer& _transfer); + quint64 getTransferCount(cn::TransactionId id) const; + bool getTransaction(cn::TransactionId _id, cn::WalletTransaction& _transaction) const; + bool getTransfer(size_t transactionIndex, size_t transferIndex, cn::WalletTransfer& transfer) const; bool getDeposit(cn::DepositId _id, cn::Deposit& _deposit); bool getAccountKeys(cn::AccountKeys& _keys); bool getMnemonicSeed(std::string& _seed); bool isOpen() const; - void sendTransaction(QVector& _transfers, + void sendTransaction(QVector& _transfers, quint64 _fee, const QString& _payment_id, - const QVector& _messages, + const QVector& _messages, quint64 _mixin = cn::parameters::MINIMUM_MIXIN); void optimizeWallet(); - void sendMessage(QVector& _transfers, + void sendMessage(QVector& _transfers, quint64 _fee, - const QVector& _messages, + const QVector& _messages, quint64 _ttl, quint64 _mixin = cn::parameters::MINIMUM_MIXIN); void deposit(quint32 _term, @@ -72,27 +76,29 @@ class WalletAdapter : public QObject, public cn::IWalletLegacyObserver { bool changePassword(const QString& _old_pass, const QString& _new_pass); void setWalletFile(const QString& _path); - void initCompleted(std::error_code _result) Q_DECL_OVERRIDE; - void saveCompleted(std::error_code _result) Q_DECL_OVERRIDE; - void synchronizationProgressUpdated(uint32_t _current, uint32_t _total) Q_DECL_OVERRIDE; - void synchronizationCompleted(std::error_code _error) Q_DECL_OVERRIDE; - void actualBalanceUpdated(uint64_t _actualBalance) Q_DECL_OVERRIDE; - void pendingBalanceUpdated(uint64_t _pendingBalance) Q_DECL_OVERRIDE; - void actualDepositBalanceUpdated(uint64_t _actualDepositBalance) Q_DECL_OVERRIDE; - void pendingDepositBalanceUpdated(uint64_t _pendingDepositBalance) Q_DECL_OVERRIDE; - void actualInvestmentBalanceUpdated(uint64_t _actualDepositBalance) Q_DECL_OVERRIDE; - void pendingInvestmentBalanceUpdated(uint64_t _pendingDepositBalance) Q_DECL_OVERRIDE; - void externalTransactionCreated(cn::TransactionId _transactionId) Q_DECL_OVERRIDE; - void sendTransactionCompleted(cn::TransactionId _transactionId, std::error_code _result) Q_DECL_OVERRIDE; - void transactionUpdated(cn::TransactionId _transactionId) Q_DECL_OVERRIDE; - void depositsUpdated(const std::vector& _depositIds) Q_DECL_OVERRIDE; + void initCompleted(std::error_code _result) override; + void saveCompleted(std::error_code _result) override; + void synchronizationProgressUpdated(uint32_t _current, uint32_t _total) override; + void synchronizationCompleted(std::error_code _error) override; + void actualBalanceUpdated(uint64_t _actualBalance) override; + void pendingBalanceUpdated(uint64_t _pendingBalance) override; + void actualDepositBalanceUpdated(uint64_t _actualDepositBalance) override; + void pendingDepositBalanceUpdated(uint64_t _pendingDepositBalance) override; + void actualInvestmentBalanceUpdated(uint64_t _actualDepositBalance) override; + void pendingInvestmentBalanceUpdated(uint64_t _pendingDepositBalance) override; + void externalTransactionCreated(cn::TransactionId _transactionId) override; + void sendTransactionCompleted(cn::TransactionId _transactionId, std::error_code _result) override; + void transactionUpdated(cn::TransactionId _transactionId) override; + void depositUpdated(cn::DepositId depositId) override; + void depositsUpdated(const std::vector& _depositIds) override; bool checkWalletPassword(const QString& _password); crypto::SecretKey getTxKey(crypto::Hash &txid); static bool isValidPaymentId(const QByteArray &_paymentIdString); private: std::fstream m_file; - cn::IWalletLegacy* m_wallet; + std::unique_ptr m_wallet; + platform_system::Event m_readyEvent; QMutex m_mutex; std::atomic m_isBackupInProgress; std::atomic m_isSynchronized; @@ -105,17 +111,13 @@ class WalletAdapter : public QObject, public cn::IWalletLegacyObserver { WalletAdapter(); - ~WalletAdapter(); + ~WalletAdapter() override; void onWalletInitCompleted(int _error, const QString& _error_text); void onWalletSendTransactionCompleted(cn::TransactionId _transaction_id, int _error, const QString& _error_text); bool importLegacyWallet(const QString &_password); bool save(const QString& _file, bool _details, bool _cache); - void lock(); - void unlock(); - bool openFile(const QString& _file, bool _read_only); - void closeFile(); void notifyAboutLastTransaction(); static void renameFile(const QString& _old_name, const QString& _new_name); diff --git a/src/gui/AddressBookDialog.cpp b/src/gui/AddressBookDialog.cpp index 2184ef2c..821da79f 100644 --- a/src/gui/AddressBookDialog.cpp +++ b/src/gui/AddressBookDialog.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/AddressBookDialog.h b/src/gui/AddressBookDialog.h index dc2f58bb..cb0fbc98 100644 --- a/src/gui/AddressBookDialog.h +++ b/src/gui/AddressBookDialog.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/AddressBookModel.cpp b/src/gui/AddressBookModel.cpp index 7f7817e0..d2619708 100644 --- a/src/gui/AddressBookModel.cpp +++ b/src/gui/AddressBookModel.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/AddressBookModel.h b/src/gui/AddressBookModel.h index 1ffaaf87..965c0885 100644 --- a/src/gui/AddressBookModel.h +++ b/src/gui/AddressBookModel.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/AddressListModel.cpp b/src/gui/AddressListModel.cpp index 1685ad67..50dcaf4e 100644 --- a/src/gui/AddressListModel.cpp +++ b/src/gui/AddressListModel.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/AddressListModel.h b/src/gui/AddressListModel.h index 1897c428..568ce998 100644 --- a/src/gui/AddressListModel.h +++ b/src/gui/AddressListModel.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/AnimatedLabel.cpp b/src/gui/AnimatedLabel.cpp index e41b773d..d7dea31b 100644 --- a/src/gui/AnimatedLabel.cpp +++ b/src/gui/AnimatedLabel.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/AnimatedLabel.h b/src/gui/AnimatedLabel.h index 4a88762e..1dcf8385 100644 --- a/src/gui/AnimatedLabel.h +++ b/src/gui/AnimatedLabel.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/ChangePasswordDialog.cpp b/src/gui/ChangePasswordDialog.cpp index 804dff8e..322e11f2 100644 --- a/src/gui/ChangePasswordDialog.cpp +++ b/src/gui/ChangePasswordDialog.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/ChangePasswordDialog.h b/src/gui/ChangePasswordDialog.h index 1a5f4af9..9f096714 100644 --- a/src/gui/ChangePasswordDialog.h +++ b/src/gui/ChangePasswordDialog.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/ContactDialog.cpp b/src/gui/ContactDialog.cpp index e853a475..72847216 100644 --- a/src/gui/ContactDialog.cpp +++ b/src/gui/ContactDialog.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/ContactDialog.h b/src/gui/ContactDialog.h index e4031da0..41148e1a 100644 --- a/src/gui/ContactDialog.h +++ b/src/gui/ContactDialog.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/DepositDetailsDialog.cpp b/src/gui/DepositDetailsDialog.cpp index 33f5603e..51bb6877 100644 --- a/src/gui/DepositDetailsDialog.cpp +++ b/src/gui/DepositDetailsDialog.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/DepositDetailsDialog.h b/src/gui/DepositDetailsDialog.h index 1be92d7b..8b9197a0 100644 --- a/src/gui/DepositDetailsDialog.h +++ b/src/gui/DepositDetailsDialog.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/DepositListModel.cpp b/src/gui/DepositListModel.cpp index 5126c4c4..82c8c8a8 100644 --- a/src/gui/DepositListModel.cpp +++ b/src/gui/DepositListModel.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/DepositListModel.h b/src/gui/DepositListModel.h index 4da79987..37ad802c 100644 --- a/src/gui/DepositListModel.h +++ b/src/gui/DepositListModel.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/DepositModel.cpp b/src/gui/DepositModel.cpp index 0488ca96..07f84705 100644 --- a/src/gui/DepositModel.cpp +++ b/src/gui/DepositModel.cpp @@ -192,7 +192,7 @@ QVariant DepositModel::getDisplayRole(const QModelIndex& _index) const { return _index.data(ROLE_DEPOSIT_TERM); case COLUMN_UNLOCK_HEIGHT: { quint64 unlockHeight = _index.data(ROLE_UNLOCK_HEIGHT).value(); - if (unlockHeight == cn::WALLET_LEGACY_UNCONFIRMED_TRANSACTION_HEIGHT) { + if (unlockHeight == cn::WALLET_UNCONFIRMED_TRANSACTION_HEIGHT) { return "-"; } @@ -216,7 +216,7 @@ QVariant DepositModel::getDisplayRole(const QModelIndex& _index) const { DepositState depositState = static_cast(_index.data(ROLE_STATE).toInt()); if (depositState == STATE_LOCKED) { quint64 unlockHeight = _index.data(ROLE_UNLOCK_HEIGHT).value(); - if (unlockHeight == cn::WALLET_LEGACY_UNCONFIRMED_TRANSACTION_HEIGHT) { + if (unlockHeight == cn::WALLET_UNCONFIRMED_TRANSACTION_HEIGHT) { return "-"; } @@ -233,7 +233,7 @@ QVariant DepositModel::getDisplayRole(const QModelIndex& _index) const { case COLUMN_CREATING_HEIGHT: { cn::TransactionId creatingTransactionId = _index.data(ROLE_CREATING_TRANSACTION_ID).value(); - if (creatingTransactionId == cn::WALLET_LEGACY_INVALID_TRANSACTION_ID) { + if (creatingTransactionId == cn::WALLET_INVALID_TRANSACTION_ID) { return "-"; } @@ -242,7 +242,7 @@ QVariant DepositModel::getDisplayRole(const QModelIndex& _index) const { case COLUMN_CREATING_TIME: { cn::TransactionId creatingTransactionId = _index.data(ROLE_CREATING_TRANSACTION_ID).value(); - if (creatingTransactionId == cn::WALLET_LEGACY_INVALID_TRANSACTION_ID) { + if (creatingTransactionId == cn::WALLET_INVALID_TRANSACTION_ID) { return "-"; } @@ -251,7 +251,7 @@ QVariant DepositModel::getDisplayRole(const QModelIndex& _index) const { case COLUMN_SPENDING_TRANSACTION_HASH: { cn::TransactionId spendingTransactionId = _index.data(ROLE_SPENDING_TRANSACTION_ID).value(); - if (spendingTransactionId == cn::WALLET_LEGACY_INVALID_TRANSACTION_ID) { + if (spendingTransactionId == cn::WALLET_INVALID_TRANSACTION_ID) { return "-"; } @@ -260,7 +260,7 @@ QVariant DepositModel::getDisplayRole(const QModelIndex& _index) const { case COLUMN_SPENDING_HEIGHT: { cn::TransactionId spendingTransactionId = _index.data(ROLE_SPENDING_TRANSACTION_ID).value(); - if (spendingTransactionId == cn::WALLET_LEGACY_INVALID_TRANSACTION_ID) { + if (spendingTransactionId == cn::WALLET_INVALID_TRANSACTION_ID) { return "-"; } @@ -269,7 +269,7 @@ QVariant DepositModel::getDisplayRole(const QModelIndex& _index) const { case COLUMN_SPENDING_TIME: { cn::TransactionId spendingTransactionId = _index.data(ROLE_SPENDING_TRANSACTION_ID).value(); - if (spendingTransactionId == cn::WALLET_LEGACY_INVALID_TRANSACTION_ID) { + if (spendingTransactionId == cn::WALLET_INVALID_TRANSACTION_ID) { return "-"; } @@ -312,7 +312,7 @@ QVariant DepositModel::getUserRole(const QModelIndex& _index, int _role) const { case ROLE_STATE: if (deposit.locked) { return static_cast(STATE_LOCKED); - } else if (deposit.spendingTransactionId == cn::WALLET_LEGACY_INVALID_TRANSACTION_ID) { + } else if (deposit.spendingTransactionId == cn::WALLET_INVALID_TRANSACTION_ID) { return static_cast(STATE_UNLOCKED); } else { return static_cast(STATE_SPENT); @@ -330,8 +330,8 @@ QVariant DepositModel::getUserRole(const QModelIndex& _index, int _role) const { cn::TransactionId creatingTransactionId = _index.data(ROLE_CREATING_TRANSACTION_ID).value(); quint64 creatingHeight = TransactionsModel::instance().index(creatingTransactionId, 0). data(TransactionsModel::ROLE_HEIGHT).value(); - if (creatingHeight == cn::WALLET_LEGACY_UNCONFIRMED_TRANSACTION_HEIGHT) { - return static_cast(cn::WALLET_LEGACY_UNCONFIRMED_TRANSACTION_HEIGHT); + if (creatingHeight == cn::WALLET_UNCONFIRMED_TRANSACTION_HEIGHT) { + return static_cast(cn::WALLET_UNCONFIRMED_TRANSACTION_HEIGHT); } return creatingHeight + _index.data(ROLE_DEPOSIT_TERM).value(); @@ -372,7 +372,7 @@ void DepositModel::appendDeposit(cn::DepositId _depositId) { } if (!deposit.locked) { - if (deposit.spendingTransactionId != cn::WALLET_LEGACY_INVALID_TRANSACTION_ID) { + if (deposit.spendingTransactionId != cn::WALLET_INVALID_TRANSACTION_ID) { return; } } diff --git a/src/gui/DepositModel.h b/src/gui/DepositModel.h index bc763dda..63285b04 100644 --- a/src/gui/DepositModel.h +++ b/src/gui/DepositModel.h @@ -12,7 +12,7 @@ #include #include -#include +#include namespace WalletGui { diff --git a/src/gui/EditableStyle.cpp b/src/gui/EditableStyle.cpp index 5db30465..d1d40659 100644 --- a/src/gui/EditableStyle.cpp +++ b/src/gui/EditableStyle.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/EditableStyle.h b/src/gui/EditableStyle.h index 4a07564a..09b0e32a 100644 --- a/src/gui/EditableStyle.h +++ b/src/gui/EditableStyle.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/ExitWidget.cpp b/src/gui/ExitWidget.cpp index 8e2981c5..dd156ed4 100644 --- a/src/gui/ExitWidget.cpp +++ b/src/gui/ExitWidget.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/ExitWidget.h b/src/gui/ExitWidget.h index 8059a9b6..38ef66c4 100644 --- a/src/gui/ExitWidget.h +++ b/src/gui/ExitWidget.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/ImportGUIKeyDialog.cpp b/src/gui/ImportGUIKeyDialog.cpp index 9539ceaa..c6d2a519 100644 --- a/src/gui/ImportGUIKeyDialog.cpp +++ b/src/gui/ImportGUIKeyDialog.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/ImportGUIKeyDialog.h b/src/gui/ImportGUIKeyDialog.h index 69f7558c..9e5b6559 100644 --- a/src/gui/ImportGUIKeyDialog.h +++ b/src/gui/ImportGUIKeyDialog.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/ImportSecretKeysDialog.cpp b/src/gui/ImportSecretKeysDialog.cpp index 27b981e2..2adb9a19 100644 --- a/src/gui/ImportSecretKeysDialog.cpp +++ b/src/gui/ImportSecretKeysDialog.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -143,6 +143,7 @@ namespace WalletGui WalletAdapter::instance().setWalletFile(filePath); WalletAdapter::instance().createWithKeys(keys); + WalletAdapter::instance().open(""); accept(); } diff --git a/src/gui/ImportSecretKeysDialog.h b/src/gui/ImportSecretKeysDialog.h index c54f044d..c322b2eb 100644 --- a/src/gui/ImportSecretKeysDialog.h +++ b/src/gui/ImportSecretKeysDialog.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/ImportSeedDialog.cpp b/src/gui/ImportSeedDialog.cpp index f3c97fd4..79d100e0 100644 --- a/src/gui/ImportSeedDialog.cpp +++ b/src/gui/ImportSeedDialog.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -119,6 +119,7 @@ namespace WalletGui WalletAdapter::instance().setWalletFile(filePath); WalletAdapter::instance().createWithKeys(keys); + WalletAdapter::instance().open(""); accept(); } diff --git a/src/gui/ImportSeedDialog.h b/src/gui/ImportSeedDialog.h index 6a0b6b2f..fcbfa5cd 100644 --- a/src/gui/ImportSeedDialog.h +++ b/src/gui/ImportSeedDialog.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/ImportTrackingDialog.cpp b/src/gui/ImportTrackingDialog.cpp index aeece50f..5845e938 100644 --- a/src/gui/ImportTrackingDialog.cpp +++ b/src/gui/ImportTrackingDialog.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -142,6 +142,7 @@ namespace WalletGui Settings::instance().setTrackingMode(true); WalletAdapter::instance().setWalletFile(filePath); WalletAdapter::instance().createWithKeys(keys); + WalletAdapter::instance().open(""); accept(); } diff --git a/src/gui/ImportTrackingDialog.h b/src/gui/ImportTrackingDialog.h index 3e9bef0d..4879fc03 100644 --- a/src/gui/ImportTrackingDialog.h +++ b/src/gui/ImportTrackingDialog.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/MainPasswordDialog.cpp b/src/gui/MainPasswordDialog.cpp index b635d694..38c6b3a6 100644 --- a/src/gui/MainPasswordDialog.cpp +++ b/src/gui/MainPasswordDialog.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/MainPasswordDialog.h b/src/gui/MainPasswordDialog.h index d396e6cf..db031e46 100644 --- a/src/gui/MainPasswordDialog.h +++ b/src/gui/MainPasswordDialog.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 8576ed76..124822a3 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -373,7 +373,7 @@ void MainWindow::openWallet() QString filePath = QFileDialog::getOpenFileName(this, tr("Open .wallet/.keys file"), walletDirectory, tr("Wallet (*.wallet *.keys)")); - + if (!filePath.isEmpty()) { if (WalletAdapter::instance().isOpen()) @@ -434,6 +434,7 @@ void MainWindow::importKey() WalletAdapter::instance().setWalletFile(filePath); WalletAdapter::instance().createWithKeys(keys); + WalletAdapter::instance().open(""); } else if (tools::base_58::decode_addr(keyString.toStdString(), addressPrefix, data) && addressPrefix == CurrencyAdapter::instance().getAddressPrefix()) { @@ -468,6 +469,7 @@ void MainWindow::importKey() WalletAdapter::instance().setWalletFile(filePath); WalletAdapter::instance().createWithKeys(keys); + WalletAdapter::instance().open(""); } } m_ui->m_welcomeFrame->setVisible(welcomeFrameVisible); @@ -497,7 +499,6 @@ void MainWindow::resetWallet() QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok) { WalletAdapter::instance().reset(); - WalletAdapter::instance().open(""); } } diff --git a/src/gui/MainWindow.h b/src/gui/MainWindow.h index 6c95fe1c..cc3215bb 100644 --- a/src/gui/MainWindow.h +++ b/src/gui/MainWindow.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/MainWindow.mm b/src/gui/MainWindow.mm index a9f1680a..74064363 100644 --- a/src/gui/MainWindow.mm +++ b/src/gui/MainWindow.mm @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/Message.cpp b/src/gui/Message.cpp index a4bcfeed..ce9bd0b0 100644 --- a/src/gui/Message.cpp +++ b/src/gui/Message.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/Message.h b/src/gui/Message.h index 47de6dee..c679cfb6 100644 --- a/src/gui/Message.h +++ b/src/gui/Message.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/MessageDetailsDialog.cpp b/src/gui/MessageDetailsDialog.cpp index fd4e88b3..00b706d3 100644 --- a/src/gui/MessageDetailsDialog.cpp +++ b/src/gui/MessageDetailsDialog.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/MessageDetailsDialog.h b/src/gui/MessageDetailsDialog.h index ee2f2c93..7ee0d2b8 100644 --- a/src/gui/MessageDetailsDialog.h +++ b/src/gui/MessageDetailsDialog.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/MessagesModel.cpp b/src/gui/MessagesModel.cpp index 72805b34..14ddd36c 100644 --- a/src/gui/MessagesModel.cpp +++ b/src/gui/MessagesModel.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -41,12 +41,6 @@ MessagesModel::MessagesModel() : QAbstractItemModel() { connect(&WalletAdapter::instance(), &WalletAdapter::walletTransactionUpdatedSignal, this, &MessagesModel::updateWalletTransaction, Qt::QueuedConnection); connect(&NodeAdapter::instance(), &NodeAdapter::lastKnownBlockHeightUpdatedSignal, this, &MessagesModel::lastKnownHeightUpdated, Qt::QueuedConnection); connect(&WalletAdapter::instance(), &WalletAdapter::walletCloseCompletedSignal, this, &MessagesModel::reset, Qt::QueuedConnection); - - quint64 dayPoolAmount = 0; - quint64 totalPoolAmount = 0; -} - -MessagesModel::~MessagesModel() { } Qt::ItemFlags MessagesModel::flags(const QModelIndex& _index) const { @@ -109,7 +103,7 @@ QVariant MessagesModel::data(const QModelIndex& _index, int _role) const return QVariant(); } - cn::WalletLegacyTransaction transaction; + cn::WalletTransaction transaction; cn::TransactionId transactionId = m_messages.value(_index.row()).first; Message message = m_messages.value(_index.row()).second; @@ -158,7 +152,7 @@ QVariant MessagesModel::getDisplayRole(const QModelIndex& _index) const { } case COLUMN_TYPE: { - MessageType messageType = static_cast(_index.data(ROLE_TYPE).value()); + auto messageType = static_cast(_index.data(ROLE_TYPE).value()); if (messageType == MessageType::OUTPUT) { return tr("Out"); } else if(messageType == MessageType::INPUT) { @@ -170,7 +164,7 @@ QVariant MessagesModel::getDisplayRole(const QModelIndex& _index) const { case COLUMN_HEIGHT: { quint64 height = _index.data(ROLE_HEIGHT).value(); - return (height == cn::WALLET_LEGACY_UNCONFIRMED_TRANSACTION_HEIGHT ? "-" : QString::number(height)); + return (height == cn::WALLET_UNCONFIRMED_TRANSACTION_HEIGHT ? "-" : QString::number(height)); } case COLUMN_MESSAGE: { @@ -208,7 +202,7 @@ QVariant MessagesModel::getDisplayRole(const QModelIndex& _index) const { return QVariant(); } -QVariant MessagesModel::getDecorationRole(const QModelIndex& _index) const { +QVariant MessagesModel::getDecorationRole(const QModelIndex&) const { return QVariant(); } @@ -216,8 +210,8 @@ QVariant MessagesModel::getAlignmentRole(const QModelIndex& _index) const { return headerData(_index.column(), Qt::Horizontal, Qt::TextAlignmentRole); } -QVariant MessagesModel::getUserRole(const QModelIndex& _index, int _role, cn::TransactionId _transactionId, - cn::WalletLegacyTransaction& _transaction, const Message& _message) const { +QVariant MessagesModel::getUserRole(const QModelIndex& _index, int _role, cn::TransactionId, + cn::WalletTransaction& _transaction, const Message& _message) const { switch(_role) { case ROLE_DATE: return (_transaction.timestamp > 0 ? QDateTime::fromTime_t(_transaction.timestamp) : QDateTime()); @@ -275,51 +269,24 @@ void MessagesModel::reloadWalletTransactions() { } } -void MessagesModel::appendTransaction(cn::TransactionId _transactionId, quint32& _insertedRowCount) -{ - - cn::WalletLegacyTransaction transaction; - if (!WalletAdapter::instance().getTransaction(_transactionId, transaction)) - { - +void MessagesModel::appendTransaction(cn::TransactionId _transactionId, + quint32& _insertedRowCount) { + cn::WalletTransaction transaction; + if (!WalletAdapter::instance().getTransaction(_transactionId, transaction)) { return; } - m_transactionRow.insert(_transactionId, qMakePair(std::numeric_limits::max(), std::numeric_limits::max())); - if (transaction.messages.empty()) - { - - return; - } - - /* ignore any transaction with the message P01 (for pool earnings), and I01 (for interest earnings) */ - if ((transaction.messages[0] == "P01") || (transaction.messages[0] == "I01")) - { - - /* if its an incoming transfer, add amount to the total */ - if (transaction.totalAmount > 0) - { - - totalPoolAmount = totalPoolAmount + transaction.totalAmount; - - if (transaction.blockHeight > (NodeAdapter::instance().getLastKnownBlockHeight() - 720)) - { - - dayPoolAmount = dayPoolAmount + transaction.totalAmount; - } - } - - Q_EMIT poolEarningsSignal(dayPoolAmount, totalPoolAmount); + m_transactionRow.insert(_transactionId, qMakePair(std::numeric_limits::max(), + std::numeric_limits::max())); + if (transaction.messages.empty()) { return; } m_transactionRow[_transactionId] = qMakePair(m_messages.size(), transaction.messages.size()); - for (quint32 i = 0; i < transaction.messages.size(); ++i) - { - - Message message(QString::fromStdString(transaction.messages[i])); - m_messages.append(TransactionMessageId(_transactionId, std::move(message))); + for (const auto& txMessage : transaction.messages) { + Message message(QString::fromStdString(txMessage)); + m_messages.append(TransactionMessageId(_transactionId, message)); ++_insertedRowCount; } } @@ -343,7 +310,6 @@ void MessagesModel::appendTransaction(cn::TransactionId _transactionId) if (insertedRowCount > 0) { - beginInsertRows(QModelIndex(), oldRowCount, oldRowCount + insertedRowCount - 1); endInsertRows(); } @@ -351,13 +317,12 @@ void MessagesModel::appendTransaction(cn::TransactionId _transactionId) void MessagesModel::updateWalletTransaction(cn::TransactionId _id) { - quint32 firstRow = m_transactionRow.value(_id).first; quint32 lastRow = firstRow + m_transactionRow.value(_id).second - 1; Q_EMIT dataChanged(index(firstRow, COLUMN_DATE), index(lastRow, COLUMN_HEIGHT)); } -void MessagesModel::lastKnownHeightUpdated(quint64 _height) +void MessagesModel::lastKnownHeightUpdated(quint64) { if(rowCount() > 0) { @@ -365,22 +330,10 @@ void MessagesModel::lastKnownHeightUpdated(quint64 _height) } } -void MessagesModel::reset() -{ - - /* reset pool transaction totals */ - dayPoolAmount = 0; - totalPoolAmount = 0; - - Q_EMIT poolEarningsSignal(dayPoolAmount, totalPoolAmount); - - /* reset everything else */ +void MessagesModel::reset() { beginResetModel(); m_messages.clear(); m_transactionRow.clear(); endResetModel(); - - } - } diff --git a/src/gui/MessagesModel.h b/src/gui/MessagesModel.h index 7e2fe6b7..4947a705 100644 --- a/src/gui/MessagesModel.h +++ b/src/gui/MessagesModel.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -9,10 +9,14 @@ #include #include -#include +#include #include "Message.h" +namespace cn { + using TransactionId = size_t; +} + namespace WalletGui { typedef QPair TransactionMessageId; @@ -35,8 +39,6 @@ class MessagesModel : public QAbstractItemModel { static const QString HEADER_REPLY_TO_KEY; static MessagesModel& instance(); - quint64 dayPoolAmount; - quint64 totalPoolAmount; Qt::ItemFlags flags(const QModelIndex& _index) const Q_DECL_OVERRIDE; int columnCount(const QModelIndex& _parent = QModelIndex()) const Q_DECL_OVERRIDE; @@ -52,12 +54,12 @@ class MessagesModel : public QAbstractItemModel { QHash > m_transactionRow; MessagesModel(); - ~MessagesModel(); + ~MessagesModel() override = default; QVariant getDisplayRole(const QModelIndex& _index) const; QVariant getDecorationRole(const QModelIndex& _index) const; QVariant getAlignmentRole(const QModelIndex& _index) const; - QVariant getUserRole(const QModelIndex& _index, int _role, cn::TransactionId _transactionId, cn::WalletLegacyTransaction& _transaction, + QVariant getUserRole(const QModelIndex& _index, int _role, cn::TransactionId _transactionId, cn::WalletTransaction& _transaction, const Message& _message) const; void reloadWalletTransactions(); @@ -67,10 +69,6 @@ class MessagesModel : public QAbstractItemModel { void updateWalletTransaction(cn::TransactionId _id); void lastKnownHeightUpdated(quint64 _height); void reset(); - -Q_SIGNALS: - void poolEarningsSignal(quint64 _dayPoolAmount, quint64 _totalPoolAmount); - }; } diff --git a/src/gui/NewPasswordDialog.cpp b/src/gui/NewPasswordDialog.cpp index 4c38d82b..c95efcc7 100644 --- a/src/gui/NewPasswordDialog.cpp +++ b/src/gui/NewPasswordDialog.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/NewPasswordDialog.h b/src/gui/NewPasswordDialog.h index 3237a774..82d9b229 100644 --- a/src/gui/NewPasswordDialog.h +++ b/src/gui/NewPasswordDialog.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/Notification.cpp b/src/gui/Notification.cpp index ad02018f..7eff7345 100644 --- a/src/gui/Notification.cpp +++ b/src/gui/Notification.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/Notification.h b/src/gui/Notification.h index 762d8961..cef3f6fb 100644 --- a/src/gui/Notification.h +++ b/src/gui/Notification.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/OverviewFrame.cpp b/src/gui/OverviewFrame.cpp index cc716142..242a688c 100644 --- a/src/gui/OverviewFrame.cpp +++ b/src/gui/OverviewFrame.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -49,7 +49,6 @@ #include "VisibleMessagesModel.h" #include "WalletAdapter.h" #include "WalletEvents.h" -#include "WalletLegacy/WalletHelper.h" #include "LoggerAdapter.h" #include @@ -1168,9 +1167,9 @@ namespace WalletGui } /* Prepare the transfers */ - QVector walletTransfers; - cn::WalletLegacyTransfer walletTransfer; - QVector walletMessages; + QVector walletTransfers; + cn::WalletOrder walletTransfer; + QVector walletMessages; bool isIntegrated = false; std::string paymentID; std::string spendPublicKey; @@ -1288,7 +1287,7 @@ namespace WalletGui QString comment = m_ui->m_messageEdit->text(); if (!comment.isEmpty()) { - walletMessages.append(cn::TransactionMessage{comment.toStdString(), address.toStdString()}); + walletMessages.append(cn::WalletMessage{ address.toStdString(), comment.toStdString() }); } quint64 actualFee = BASE_FEE; @@ -1301,7 +1300,7 @@ namespace WalletGui logger.log("Using remote node"); if (!OverviewFrame::remote_node_fee_address.isEmpty()) { - cn::WalletLegacyTransfer walletTransfer; + cn::WalletOrder walletTransfer; walletTransfer.address = OverviewFrame::remote_node_fee_address.toStdString(); walletTransfer.amount = REMOTE_FEE; walletTransfers.push_back(walletTransfer); @@ -1459,11 +1458,11 @@ namespace WalletGui return; } - QVector transfers; - QVector feeTransfer; - cn::WalletLegacyTransfer walletTransfer; - QVector messages; - QVector feeMessage; + QVector transfers; + QVector feeTransfer; + cn::WalletOrder walletTransfer; + QVector messages; + QVector feeMessage; QString address = m_ui->m_addressMessageEdit->text().toUtf8(); QString messageString = m_ui->m_messageTextEdit->toPlainText(); @@ -1501,7 +1500,7 @@ namespace WalletGui uint64_t amount = 100; walletTransfer.amount = amount; transfers.push_back(walletTransfer); - messages.append({messageString.toStdString(), address.toStdString()}); + messages.append({ address.toStdString(), messageString.toStdString() }); /* Set fee */ quint64 fee = BASE_FEE; @@ -1523,7 +1522,7 @@ namespace WalletGui QString connection = Settings::instance().getConnection(); if ((connection.compare("remote") == 0) || (connection.compare("autoremote") == 0)) { - cn::WalletLegacyTransfer walletTransfer; + cn::WalletOrder walletTransfer; walletTransfer.address = OverviewFrame::remote_node_fee_address.toStdString(); walletTransfer.amount = REMOTE_FEE; transfers.push_back(walletTransfer); @@ -1606,14 +1605,14 @@ namespace WalletGui WalletAdapter::instance().deposit(term, amount, BASE_FEE); /* Remote node fee */ - QVector walletTransfers; + QVector walletTransfers; QString connection = Settings::instance().getConnection(); if ((connection.compare("remote") == 0) || (connection.compare("autoremote") == 0)) { if (!OverviewFrame::remote_node_fee_address.isEmpty()) { - QVector walletMessages; - cn::WalletLegacyTransfer walletTransfer; + QVector walletMessages; + cn::WalletOrder walletTransfer; walletTransfer.address = OverviewFrame::remote_node_fee_address.toStdString(); walletTransfer.amount = REMOTE_FEE; walletTransfers.push_back(walletTransfer); @@ -1754,20 +1753,9 @@ namespace WalletGui if (Settings::instance().isTrackingMode()) { Q_EMIT notifySignal(tr("This is a tracking wallet.\nThis action is not available.")); - } - else - { - quint64 numUnlockedOutputs; - numUnlockedOutputs = WalletAdapter::instance().getNumUnlockedOutputs(); + } else { WalletAdapter::instance().optimizeWallet(); - while (WalletAdapter::instance().getNumUnlockedOutputs() > 100) - { - numUnlockedOutputs = WalletAdapter::instance().getNumUnlockedOutputs(); - if (numUnlockedOutputs == 0) - break; - WalletAdapter::instance().optimizeWallet(); - delay(); - } + delay(); dashboardClicked(); } } diff --git a/src/gui/OverviewFrame.h b/src/gui/OverviewFrame.h index eaff29c9..8f938268 100644 --- a/src/gui/OverviewFrame.h +++ b/src/gui/OverviewFrame.h @@ -1,13 +1,13 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #pragma once -#include +#include #ifdef HAVE_CHART #include diff --git a/src/gui/PasswordDialog.cpp b/src/gui/PasswordDialog.cpp index 411da180..ac5fd1fd 100644 --- a/src/gui/PasswordDialog.cpp +++ b/src/gui/PasswordDialog.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/PasswordDialog.h b/src/gui/PasswordDialog.h index c4e51b65..da0ef3c7 100644 --- a/src/gui/PasswordDialog.h +++ b/src/gui/PasswordDialog.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/QRLabel.cpp b/src/gui/QRLabel.cpp index 10c6f56a..d4723d6c 100644 --- a/src/gui/QRLabel.cpp +++ b/src/gui/QRLabel.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/QRLabel.h b/src/gui/QRLabel.h index 8a4fc477..5d40cfd2 100644 --- a/src/gui/QRLabel.h +++ b/src/gui/QRLabel.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/ReceiveFrame.cpp b/src/gui/ReceiveFrame.cpp index 91dd4121..8271f20b 100644 --- a/src/gui/ReceiveFrame.cpp +++ b/src/gui/ReceiveFrame.cpp @@ -1,12 +1,13 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "ReceiveFrame.h" +#include #include #include diff --git a/src/gui/ReceiveFrame.h b/src/gui/ReceiveFrame.h index f0197423..d6a29836 100644 --- a/src/gui/ReceiveFrame.h +++ b/src/gui/ReceiveFrame.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/RecentTransactionsModel.cpp b/src/gui/RecentTransactionsModel.cpp index 0546859b..da4693c1 100644 --- a/src/gui/RecentTransactionsModel.cpp +++ b/src/gui/RecentTransactionsModel.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/RecentTransactionsModel.h b/src/gui/RecentTransactionsModel.h index 50f701be..adc5dc2f 100644 --- a/src/gui/RecentTransactionsModel.h +++ b/src/gui/RecentTransactionsModel.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/ShowQRCode.cpp b/src/gui/ShowQRCode.cpp index a9aaf3d1..24dfa2dd 100644 --- a/src/gui/ShowQRCode.cpp +++ b/src/gui/ShowQRCode.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/ShowQRCode.h b/src/gui/ShowQRCode.h index 8a5aa340..27c7fc61 100644 --- a/src/gui/ShowQRCode.h +++ b/src/gui/ShowQRCode.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/SortedAddressListModel.cpp b/src/gui/SortedAddressListModel.cpp index 78750196..047bf723 100644 --- a/src/gui/SortedAddressListModel.cpp +++ b/src/gui/SortedAddressListModel.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/SortedAddressListModel.h b/src/gui/SortedAddressListModel.h index cc678d0d..cff7a292 100644 --- a/src/gui/SortedAddressListModel.h +++ b/src/gui/SortedAddressListModel.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/SortedDepositModel.cpp b/src/gui/SortedDepositModel.cpp index 634b9f09..20ec4174 100644 --- a/src/gui/SortedDepositModel.cpp +++ b/src/gui/SortedDepositModel.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/SortedDepositModel.h b/src/gui/SortedDepositModel.h index f8aeba59..02f898ac 100644 --- a/src/gui/SortedDepositModel.h +++ b/src/gui/SortedDepositModel.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/SortedMessagesModel.cpp b/src/gui/SortedMessagesModel.cpp index 993d7462..fb107574 100644 --- a/src/gui/SortedMessagesModel.cpp +++ b/src/gui/SortedMessagesModel.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/SortedMessagesModel.h b/src/gui/SortedMessagesModel.h index 954a86e0..0cb28a63 100644 --- a/src/gui/SortedMessagesModel.h +++ b/src/gui/SortedMessagesModel.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // // Copyright (c) 2018 The Circle Foundation & Conceal Devs // Copyright (c) 2018-2019 Conceal Network & Conceal Devs diff --git a/src/gui/SortedTransactionsModel.cpp b/src/gui/SortedTransactionsModel.cpp index df360440..2f6f7de2 100644 --- a/src/gui/SortedTransactionsModel.cpp +++ b/src/gui/SortedTransactionsModel.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/SortedTransactionsModel.h b/src/gui/SortedTransactionsModel.h index 9c3f878f..0e5e347f 100644 --- a/src/gui/SortedTransactionsModel.h +++ b/src/gui/SortedTransactionsModel.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/SplashScreen.cpp b/src/gui/SplashScreen.cpp index aac1d8d1..e6715a42 100644 --- a/src/gui/SplashScreen.cpp +++ b/src/gui/SplashScreen.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/SplashScreen.h b/src/gui/SplashScreen.h index dc086acf..63343fea 100644 --- a/src/gui/SplashScreen.h +++ b/src/gui/SplashScreen.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/TransactionDetailsDialog.cpp b/src/gui/TransactionDetailsDialog.cpp index 8910b325..7fb5cc3b 100644 --- a/src/gui/TransactionDetailsDialog.cpp +++ b/src/gui/TransactionDetailsDialog.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -48,7 +48,7 @@ TransactionDetailsDialog::TransactionDetailsDialog(const QModelIndex& _index, QW cn::DepositId depositId = transactionIndex.data(TransactionsModel::ROLE_DEPOSIT_ID).value(); QString depositInfo; - if (depositId != cn::WALLET_LEGACY_INVALID_DEPOSIT_ID) { + if (depositId != cn::WALLET_INVALID_DEPOSIT_ID) { QModelIndex depositIndex = DepositModel::instance().index(depositId, 0); QString depositAmount = depositIndex.sibling(depositIndex.row(), DepositModel::COLUMN_AMOUNT).data().toString() + " " + CurrencyAdapter::instance().getCurrencyTicker().toUpper(); diff --git a/src/gui/TransactionDetailsDialog.h b/src/gui/TransactionDetailsDialog.h index 83ba58b2..db1292bb 100644 --- a/src/gui/TransactionDetailsDialog.h +++ b/src/gui/TransactionDetailsDialog.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/TransactionFrame.cpp b/src/gui/TransactionFrame.cpp index 15f16bc3..530fca13 100644 --- a/src/gui/TransactionFrame.cpp +++ b/src/gui/TransactionFrame.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -56,23 +56,27 @@ namespace WalletGui case TransactionsModel::COLUMN_TYPE: { - QString txtype = _index.data(TransactionsModel::ROLE_TYPE).toString(); - QString txtext = tr("Incoming TX"); - if (txtype == "0") - { - txtext = tr("New Block"); - } - else if (txtype == "2") - { - txtext = tr("Outgoing TX"); - } - else if (txtype == "3") - { - txtext = tr("Optimization"); - } - else if (txtype == "4") - { - txtext = tr("New Deposit"); + auto txType = static_cast(_index.data(TransactionsModel::ROLE_TYPE).value()); + QString txtext; + switch (txType) { + case TransactionsModel::TransactionType::MINED: + txtext = tr("New Block"); + break; + case TransactionsModel::TransactionType::OUTPUT: + txtext = tr("Outgoing TX"); + break; + case TransactionsModel::TransactionType::INOUT: + txtext = tr("Optimization"); + break; + case TransactionsModel::TransactionType::DEPOSIT: + txtext = tr("New Deposit"); + break; + case TransactionsModel::TransactionType::DEPOSIT_UNLOCK: + txtext = tr("Deposit Unlock"); + break; + default: + txtext = tr("Incoming TX"); + break; } static_cast(_editor)->setText(txtext); return; diff --git a/src/gui/TransactionFrame.h b/src/gui/TransactionFrame.h index 2c7fbb99..63fc4b01 100644 --- a/src/gui/TransactionFrame.h +++ b/src/gui/TransactionFrame.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/TransactionsListModel.cpp b/src/gui/TransactionsListModel.cpp index 074741f0..785227c3 100644 --- a/src/gui/TransactionsListModel.cpp +++ b/src/gui/TransactionsListModel.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/TransactionsListModel.h b/src/gui/TransactionsListModel.h index 5e456fe0..aa9e5fdf 100644 --- a/src/gui/TransactionsListModel.h +++ b/src/gui/TransactionsListModel.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/TransactionsModel.cpp b/src/gui/TransactionsModel.cpp index 992c1947..37d478db 100644 --- a/src/gui/TransactionsModel.cpp +++ b/src/gui/TransactionsModel.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -17,39 +17,32 @@ #include "NodeAdapter.h" #include "TransactionsModel.h" #include "WalletAdapter.h" - +#include namespace WalletGui { - enum class TransactionType : quint8 - { - MINED, - INPUT, - OUTPUT, - INOUT, - DEPOSIT - }; - const int TRANSACTIONS_MODEL_COLUMN_COUNT = TransactionsModel::staticMetaObject.enumerator(TransactionsModel::staticMetaObject.indexOfEnumerator("Columns")).keyCount(); namespace { - QPixmap getTransactionIcon(TransactionType _transactionType) + QPixmap getTransactionIcon(TransactionsModel::TransactionType _transactionType) { switch (_transactionType) { - case TransactionType::MINED: + case TransactionsModel::TransactionType::MINED: return QPixmap(":icons/tx-mined"); - case TransactionType::INPUT: + case TransactionsModel::TransactionType::INPUT: return QPixmap(":icons/tx-input"); - case TransactionType::OUTPUT: + case TransactionsModel::TransactionType::OUTPUT: return QPixmap(":icons/tx-output"); - case TransactionType::INOUT: + case TransactionsModel::TransactionType::INOUT: return QPixmap(":icons/tx-inout"); - case TransactionType::DEPOSIT: + case TransactionsModel::TransactionType::DEPOSIT: return QPixmap(":icons/tx-deposit"); + case TransactionsModel::TransactionType::DEPOSIT_UNLOCK: + return QPixmap(":icons/tx-withdraw"); default: break; } @@ -162,21 +155,19 @@ namespace WalletGui return QVariant(); } - cn::WalletLegacyTransaction transaction; - cn::WalletLegacyTransfer transfer; + cn::WalletTransaction transaction; + cn::WalletTransfer transfer; cn::Deposit deposit; - cn::TransactionId transactionId = m_transfers.value(_index.row()).first; - cn::TransferId transferId = m_transfers.value(_index.row()).second; - - if (!WalletAdapter::instance().getTransaction(transactionId, transaction) || - (m_transfers.value(_index.row()).second != cn::WALLET_LEGACY_INVALID_TRANSFER_ID && - !WalletAdapter::instance().getTransfer(transferId, transfer))) + size_t transactionIndex = m_transfers.value(_index.row()).first; + size_t transferIndex = m_transfers.value(_index.row()).second; + if (!WalletAdapter::instance().getTransaction(transactionIndex, transaction) || + (m_transfers.value(_index.row()).second != cn::WALLET_INVALID_TRANSFER_ID && + !WalletAdapter::instance().getTransfer(transactionIndex, transferIndex, transfer))) { return QVariant(); } - cn::DepositId depositId = transaction.firstDepositId; - if (depositId != cn::WALLET_LEGACY_INVALID_DEPOSIT_ID) + if (depositId != cn::WALLET_INVALID_DEPOSIT_ID) { if (!WalletAdapter::instance().getDeposit(depositId, deposit)) { @@ -197,7 +188,7 @@ namespace WalletGui return getAlignmentRole(_index); default: - return getUserRole(_index, _role, transactionId, transaction, transferId, transfer, depositId, deposit); + return getUserRole(_index, _role, transactionIndex, transaction, transferIndex, transfer, depositId, deposit); } return QVariant(); @@ -264,21 +255,19 @@ namespace WalletGui if (transactionType == TransactionType::INPUT || transactionType == TransactionType::MINED || transactionType == TransactionType::INOUT) { - return "not applicable"; } else { /* existing outbound transactions not in the same sessions should be empty */ - if (_index.data(ROLE_SECRETKEY).toByteArray().toHex().toUpper() == "0000000000000000000000000000000000000000000000000000000000000000") + if (_index.data(ROLE_SECRETKEY) == "0000000000000000000000000000000000000000000000000000000000000000") { - return "expired"; } else { /* return the proper transaction secret key */ - return _index.data(ROLE_SECRETKEY).toByteArray().toHex().toUpper(); + return _index.data(ROLE_SECRETKEY); } } } @@ -310,17 +299,16 @@ namespace WalletGui case COLUMN_CONFIRMATIONS: { quint64 transactionHeight = _index.data(ROLE_HEIGHT).value(); - if (transactionHeight == cn::WALLET_LEGACY_UNCONFIRMED_TRANSACTION_HEIGHT) + if (transactionHeight == cn::WALLET_UNCONFIRMED_TRANSACTION_HEIGHT) { - return "Unconfirmed"; + return tr("Unconfirmed"); } quint64 confirmations = NodeAdapter::instance().getLastKnownBlockHeight() - transactionHeight + 1; if (confirmations >= 10) { - //return NodeAdapter::instance().getLastKnownBlockHeight(); - return "Confirmed"; + return tr("Confirmed"); } } @@ -336,7 +324,7 @@ namespace WalletGui case COLUMN_HEIGHT: { quint64 transactionHeight = _index.data(ROLE_HEIGHT).value(); - if (transactionHeight == cn::WALLET_LEGACY_UNCONFIRMED_TRANSACTION_HEIGHT) + if (transactionHeight == cn::WALLET_UNCONFIRMED_TRANSACTION_HEIGHT) { return QVariant(); } @@ -383,8 +371,6 @@ namespace WalletGui return QPixmap(":icons/clock5"); default: QPixmap icon = _index.data(ROLE_ICON).value(); - QPainter painter(&icon); - painter.drawPixmap(0, 0, QPixmap(":icons/transaction")); return icon; } } @@ -402,7 +388,7 @@ namespace WalletGui } QVariant TransactionsModel::getUserRole(const QModelIndex &_index, int _role, cn::TransactionId _transactionId, - const cn::WalletLegacyTransaction &_transaction, cn::TransferId _transferId, const cn::WalletLegacyTransfer &_transfer, + const cn::WalletTransaction &_transaction, cn::TransferId _transferId, const cn::WalletTransfer &_transfer, cn::DepositId _depositId, const cn::Deposit &_deposit) const { @@ -416,26 +402,25 @@ namespace WalletGui case ROLE_DATE: return (_transaction.timestamp > 0 ? QDateTime::fromTime_t(_transaction.timestamp) : QDateTime()); - case ROLE_TYPE: - { + case ROLE_TYPE: { QString transactionAddress = _index.data(ROLE_ADDRESS).toString(); - if (_transaction.isCoinbase) - { + if (_transaction.isBase) { return static_cast(TransactionType::MINED); - } - else if (_transaction.firstDepositId != cn::WALLET_LEGACY_INVALID_DEPOSIT_ID) - { + } else if (_transaction.firstDepositId != cn::WALLET_INVALID_DEPOSIT_ID) { return static_cast(TransactionType::DEPOSIT); - } - else if (!transactionAddress.compare(WalletAdapter::instance().getAddress())) - { + } else if (transactionAddress == WalletAdapter::instance().getAddress()) { + if (_transaction.fee == cn::parameters::MINIMUM_FEE) { + return static_cast(TransactionType::DEPOSIT_UNLOCK); + } else if (_transaction.totalAmount == -1000) { + return static_cast(TransactionType::INOUT); + } else if (_transaction.totalAmount < 0) { + return static_cast(TransactionType::OUTPUT); + } + } else if (_transaction.totalAmount == -1000) { return static_cast(TransactionType::INOUT); - } - else if (_transaction.totalAmount < 0) - { + } else if (_transaction.totalAmount < 0) { return static_cast(TransactionType::OUTPUT); } - return static_cast(TransactionType::INPUT); } @@ -443,17 +428,17 @@ namespace WalletGui { QString transactionAddress = _index.data(ROLE_ADDRESS).toString(); - TransactionState transactionState = static_cast(_index.data(ROLE_STATE).value()); - if (transactionState != TransactionState::ACTIVE && transactionState != TransactionState::SENDING) + auto transactionState = static_cast(_index.data(ROLE_STATE).value()); + if (transactionState == cn::WalletTransactionState::FAILED) { return "Failed"; } - if (_transaction.isCoinbase) + if (_transaction.isBase) { return "New Block"; } - else if (_transaction.firstDepositId != cn::WALLET_LEGACY_INVALID_DEPOSIT_ID) + else if (_transaction.firstDepositId != cn::WALLET_INVALID_DEPOSIT_ID) { return "New Deposit"; } @@ -478,7 +463,9 @@ namespace WalletGui crypto::SecretKey txkey = WalletAdapter::instance().getTxKey(txHash); if (txkey != cn::NULL_SECRET_KEY) { - return QByteArray(reinterpret_cast(&txkey), sizeof(txkey)); + return QString::fromStdString(common::podToHex(txkey)); + } else { + return tr("not found"); } } @@ -487,23 +474,20 @@ namespace WalletGui case ROLE_AMOUNT: { - TransactionType transactionType = static_cast(_index.data(ROLE_TYPE).value()); + auto transactionType = static_cast(_index.data(ROLE_TYPE).value()); if (transactionType == TransactionType::INPUT || transactionType == TransactionType::MINED) { return static_cast(_transaction.totalAmount); } else if (transactionType == TransactionType::OUTPUT || transactionType == TransactionType::INOUT) { - if (_transferId == cn::WALLET_LEGACY_INVALID_TRANSFER_ID) - { - return static_cast(_transaction.totalAmount); - } - - return static_cast(-_transfer.amount); + return static_cast(_transaction.totalAmount); } else if (transactionType == TransactionType::DEPOSIT) { - return static_cast(_transaction.fee + _deposit.amount); + return static_cast(_deposit.amount); + } else if (transactionType == TransactionType::DEPOSIT_UNLOCK){ + return static_cast(_transaction.totalAmount); } return QVariant(); @@ -514,7 +498,7 @@ namespace WalletGui case ROLE_ICON: { - TransactionType transactionType = static_cast(_index.data(ROLE_TYPE).value()); + auto transactionType = static_cast(_index.data(ROLE_TYPE).value()); return getTransactionIcon(transactionType); } @@ -528,7 +512,7 @@ namespace WalletGui return static_cast(_transaction.fee); case ROLE_NUMBER_OF_CONFIRMATIONS: - return (_transaction.blockHeight == cn::WALLET_LEGACY_UNCONFIRMED_TRANSACTION_HEIGHT ? 0 : NodeAdapter::instance().getLastKnownBlockHeight() - _transaction.blockHeight + 1); + return (_transaction.blockHeight == cn::WALLET_UNCONFIRMED_TRANSACTION_HEIGHT ? 0 : NodeAdapter::instance().getLastKnownBlockHeight() - _transaction.blockHeight + 1); case ROLE_COLUMN: return headerData(_index.column(), Qt::Horizontal, ROLE_COLUMN); @@ -538,7 +522,7 @@ namespace WalletGui case ROLE_MESSAGE: { - if (_transaction.messages.size() == 0) + if (_transaction.messages.empty()) { return QVariant(); } @@ -592,25 +576,19 @@ namespace WalletGui void TransactionsModel::appendTransaction(cn::TransactionId _transactionId, quint32 &_insertedRowCount) { - cn::WalletLegacyTransaction transaction; - if (!WalletAdapter::instance().getTransaction(_transactionId, transaction)) - { + cn::WalletTransaction transaction; + const auto &wallet = WalletAdapter::instance(); + if (!wallet.getTransaction(_transactionId, transaction)) { return; } - if (transaction.transferCount) - { - m_transactionRow[_transactionId] = qMakePair(m_transfers.size(), transaction.transferCount); - for (cn::TransferId transfer_id = transaction.firstTransferId; - transfer_id < transaction.firstTransferId + transaction.transferCount; ++transfer_id) - { - m_transfers.append(TransactionTransferId(_transactionId, transfer_id)); + quint64 transferCount = wallet.getTransferCount(_transactionId); + if (transferCount) { + m_transactionRow[_transactionId] = qMakePair(m_transfers.size(), transferCount); + m_transfers.append(TransactionTransferId(_transactionId, 0)); ++_insertedRowCount; - } - } - else - { - m_transfers.append(TransactionTransferId(_transactionId, cn::WALLET_LEGACY_INVALID_TRANSFER_ID)); + } else { + m_transfers.append(TransactionTransferId(_transactionId, cn::WALLET_INVALID_TRANSFER_ID)); m_transactionRow[_transactionId] = qMakePair(m_transfers.size() - 1, 1); ++_insertedRowCount; } diff --git a/src/gui/TransactionsModel.h b/src/gui/TransactionsModel.h index db45e5b5..31c13b87 100644 --- a/src/gui/TransactionsModel.h +++ b/src/gui/TransactionsModel.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -10,18 +10,13 @@ #include #include -#include +#include -namespace WalletGui { +namespace cn { + using TransferId = size_t; +} - enum class TransactionState : quint8 - { - ACTIVE, - DELETED, - SENDING, - CANCELLED, - FAILED - }; +namespace WalletGui { typedef QPair TransactionTransferId; @@ -72,6 +67,16 @@ namespace WalletGui { ROLE_STATE }; + enum class TransactionType : quint8 + { + MINED, + INPUT, + OUTPUT, + INOUT, + DEPOSIT, + DEPOSIT_UNLOCK + }; + static TransactionsModel &instance(); Qt::ItemFlags flags(const QModelIndex &_index) const Q_DECL_OVERRIDE; @@ -96,8 +101,8 @@ namespace WalletGui { QVariant getDecorationRole(const QModelIndex &_index) const; QVariant getAlignmentRole(const QModelIndex &_index) const; QVariant getUserRole(const QModelIndex &_index, int _role, cn::TransactionId _transactionId, - const cn::WalletLegacyTransaction &_transaction, cn::TransferId _transferId, - const cn::WalletLegacyTransfer &_transfer, cn::DepositId _depositId, const cn::Deposit &_deposit) const; + const cn::WalletTransaction &_transaction, cn::TransferId _transferId, + const cn::WalletTransfer &_transfer, cn::DepositId _depositId, const cn::Deposit &_deposit) const; void reloadWalletTransactions(); void appendTransaction(cn::TransactionId _id, quint32 &_row_count); diff --git a/src/gui/VisibleMessagesModel.cpp b/src/gui/VisibleMessagesModel.cpp index 9e78ad76..4d007548 100644 --- a/src/gui/VisibleMessagesModel.cpp +++ b/src/gui/VisibleMessagesModel.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/VisibleMessagesModel.h b/src/gui/VisibleMessagesModel.h index 3b19fb89..c0851643 100644 --- a/src/gui/VisibleMessagesModel.h +++ b/src/gui/VisibleMessagesModel.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/WalletEvents.h b/src/gui/WalletEvents.h index b6665f40..4a96db92 100644 --- a/src/gui/WalletEvents.h +++ b/src/gui/WalletEvents.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/WelcomeFrame.cpp b/src/gui/WelcomeFrame.cpp index b780c184..b05ff4da 100644 --- a/src/gui/WelcomeFrame.cpp +++ b/src/gui/WelcomeFrame.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/gui/WelcomeFrame.h b/src/gui/WelcomeFrame.h index 8cc10bfb..4cd9cb8e 100644 --- a/src/gui/WelcomeFrame.h +++ b/src/gui/WelcomeFrame.h @@ -1,6 +1,6 @@ // Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/icons/tx_deposit.png b/src/icons/tx_deposit.png index 76fa4d3f..fe461b5a 100644 Binary files a/src/icons/tx_deposit.png and b/src/icons/tx_deposit.png differ diff --git a/src/icons/tx_inout.png b/src/icons/tx_inout.png index 5b6ac8a5..90794f3b 100644 Binary files a/src/icons/tx_inout.png and b/src/icons/tx_inout.png differ diff --git a/src/icons/tx_input.png b/src/icons/tx_input.png index 2262aa8e..32e22ed9 100644 Binary files a/src/icons/tx_input.png and b/src/icons/tx_input.png differ diff --git a/src/icons/tx_mined.png b/src/icons/tx_mined.png index a74905a1..7f08fb2e 100644 Binary files a/src/icons/tx_mined.png and b/src/icons/tx_mined.png differ diff --git a/src/icons/tx_output.png b/src/icons/tx_output.png index b89edcf4..cc7f9f49 100644 Binary files a/src/icons/tx_output.png and b/src/icons/tx_output.png differ diff --git a/src/icons/tx_withdraw.png b/src/icons/tx_withdraw.png new file mode 100644 index 00000000..5b040be4 Binary files /dev/null and b/src/icons/tx_withdraw.png differ diff --git a/src/main.cpp b/src/main.cpp index 0e4d358b..6e413c42 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/miniupnpcstrings.h b/src/miniupnpcstrings.h index 5f0135d2..2377107e 100644 --- a/src/miniupnpcstrings.h +++ b/src/miniupnpcstrings.h @@ -2,7 +2,7 @@ // Copyright (c) 2014-2017 XDN developers // Copyright (c) 2017 Karbowanec developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs -// Copyright (c) 2018-2022 Conceal Network & Conceal Devs +// Copyright (c) 2018-2023 Conceal Network & Conceal Devs // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/resources.qrc b/src/resources.qrc index 034f4d20..8b675e77 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -31,6 +31,7 @@ icons/tx_output.png icons/tx_inout.png icons/tx_deposit.png + icons/tx_withdraw.png icons/icon-address.png icons/icon-banking.png