diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..84610780
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+build
+.idea
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 00000000..814e3df2
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,2 @@
+github: [letheanVPN]
+open_collective: lthn
diff --git a/.github/workflows/cli-testnet.yml b/.github/workflows/cli-testnet.yml
new file mode 100644
index 00000000..40ab6f0d
--- /dev/null
+++ b/.github/workflows/cli-testnet.yml
@@ -0,0 +1,161 @@
+name: cli-testnet
+
+on:
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+ push:
+ paths-ignore:
+ - '**.md'
+ pull_request:
+ paths-ignore:
+ - '**.md'
+
+env:
+ CCACHE_SETTINGS: |
+ ccache --max-size=150M
+ ccache --set-config=compression=true
+
+jobs:
+ linux-amd64:
+ runs-on: ubuntu-20.04
+ env:
+ CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
+ steps:
+ - name: Cancel Previous Runs
+ uses: styfle/cancel-workflow-action@0.9.1
+ with:
+ access_token: ${{ github.token }}
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ - uses: actions/cache@v3
+ with:
+ path: ${{ github.workspace }}/ccache
+ key: ccache-${{ runner.os }}-build-testnet-cli
+ restore-keys: ccache-${{ runner.os }}-build-testnet-cli
+ - name: update apt
+ run: sudo apt update
+ - name: install dependencies
+ run: sudo apt-get install -y python-dev autotools-dev libboost-all-dev libicu-dev libbz2-dev git screen checkinstall zlib1g-dev ccache miniupnpc
+ - name: build server
+ run: |
+ ${{env.CCACHE_SETTINGS}}
+ ./utils/build/testnet_linux_cli.sh
+ - name: Move Tarball
+ run: cd build/release && mv lethean-linux-cli-*.tar.bz2 ../../
+ - uses: actions/upload-artifact@v3
+ with:
+ name: lethean-linux-cli
+ if-no-files-found: error
+ path: lethean-linux-cli-*.tar.bz2
+ - name: Release
+ uses: softprops/action-gh-release@v1
+ if: startsWith(github.ref, 'refs/tags/')
+ with:
+ files: ${{ github.workspace }}/lethean-linux-cli-*.tar.bz2
+ macos-amd64:
+ runs-on: macos-latest
+ env:
+ CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
+ steps:
+ - name: Cancel Previous Runs
+ uses: styfle/cancel-workflow-action@0.9.1
+ with:
+ access_token: ${{ github.token }}
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ - uses: actions/cache@v3
+ with:
+ path: ${{ github.workspace }}/ccache
+ key: ccache-${{ runner.os }}-build-testnet-cli
+ restore-keys: ccache-${{ runner.os }}-build-testnet-cli
+ - name: install dependencies
+ run: HOMEBREW_NO_AUTO_UPDATE=1 brew install openssl boost icu4c ccache miniupnpc
+ - name: build server
+ env:
+ PKG_CONFIG_PATH: "/usr/local/opt/openssl@3/lib/pkgconfig"
+ OPENSSL_ROOT_DIR: "/usr/local/opt/openssl@3"
+ ZANO_BOOST_ROOT: "/opt/homebrew/opt/boost"
+ ZANO_BOOST_LIBS_PATH: "/opt/homebrew/opt/boost/lib"
+ CMAKE_OSX_SYSROOT: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk"
+ run: |
+ ${{env.CCACHE_SETTINGS}}
+ export LIBRARY_PATH=${LIBRARY_PATH}:/usr/local/opt/icu4c/lib
+ ./utils/build/testnet_mac_osx_cli.sh
+ - name: Move Tarball
+ run: cd build/release && mv lethean-macos-cli-*.tar.bz2 ../../
+ - uses: actions/upload-artifact@v3
+ with:
+ name: lethean-macos-cli
+ if-no-files-found: error
+ path: lethean-macos-cli-*.tar.bz2
+ - name: Release
+ uses: softprops/action-gh-release@v1
+ if: startsWith(github.ref, 'refs/tags/')
+ with:
+ files: ${{ github.workspace }}/lethean-macos-cli-*.tar.bz2
+ windows-amd64:
+ runs-on: windows-latest
+ env:
+ CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
+ steps:
+ - name: Cancel Previous Runs
+ uses: styfle/cancel-workflow-action@0.9.1
+ with:
+ access_token: ${{ github.token }}
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ - uses: actions/cache@v3
+ with:
+ path: ${{ github.workspace }}/ccache
+ key: ccache-${{ runner.os }}-build-testnet-cli
+ restore-keys: ccache-${{ runner.os }}-build-testnet-cli
+ - name: Eat the Choco
+ run: |
+ choco install openssl --version 1.1.1.1500 -y
+ choco install ccache -y
+ choco install zip -y
+ - name: install msvc toolset
+ uses: ilammy/msvc-dev-cmd@v1
+ - name: Install boost
+ uses: MarkusJx/install-boost@v2.4.1
+ id: install-boost
+ with:
+ # REQUIRED: Specify the required boost version
+ # A list of supported versions can be found here:
+ # https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json
+ boost_version: 1.80.0
+ platform_version: 2022
+ toolset: msvc
+ link: static
+ - name: Set up Visual Studio shell
+ uses: egor-tensin/vs-shell@v2
+ with:
+ arch: x64
+ - name: build server
+ env:
+ QT_PREFIX_PATH: C:\ProgramData\chocolatey\lib\Qt5.11.2\5.11.2
+ BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
+ LOCAL_BOOST_PATH: ${{ steps.install-boost.outputs.BOOST_ROOT }}
+ OPENSSL_ROOT_DIR: "C:\\Program Files\\OpenSSL-Win64"
+ CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
+ run: |
+ refreshenv
+ ${{env.CCACHE_SETTINGS}}
+ .\utils\build\testnet_windows_cli.bat
+ - uses: actions/upload-artifact@v3
+ with:
+ name: lethean-windows-cli
+ if-no-files-found: error
+ path: ${{ github.workspace }}\lethean-win-cli-*.zip
+ - name: Release
+ uses: softprops/action-gh-release@v1
+ if: startsWith(github.ref, 'refs/tags/')
+ with:
+ files: |
+ lethean-win-cli-*
diff --git a/.github/workflows/dockerhub-testnet.yml b/.github/workflows/dockerhub-testnet.yml
new file mode 100644
index 00000000..478e33d9
--- /dev/null
+++ b/.github/workflows/dockerhub-testnet.yml
@@ -0,0 +1,67 @@
+name: chain-itw3:testnet
+on:
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+ push:
+ branches:
+ - main
+ tags:
+ - v*
+ paths-ignore:
+ - '**.md'
+ pull_request:
+ branches:
+ - main
+ tags:
+ - v*
+ paths-ignore:
+ - '**.md'
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Cancel Previous Runs
+ uses: styfle/cancel-workflow-action@0.9.1
+ with:
+ access_token: ${{ github.token }}
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ - name: Set up Docker Buildx
+ id: buildx
+ uses: docker/setup-buildx-action@v2
+ with:
+ install: true
+ - name: Login to GitHub Container registry
+ uses: docker/login-action@v2
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Login to DockerHub
+ uses: docker/login-action@v2
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+ - name: Docker Build
+ if: ${{ github.event_name != 'pull_request' }}
+ uses: docker/build-push-action@v3
+ with:
+ context: .
+ file: utils/docker/Dockerfile
+ cache-to: ghcr.io/letheanvpn/blockchain-itw3:testnet-${{ github.ref_name }}
+ cache-from: ghcr.io/letheanvpn/blockchain-itw3:testnet-${{ github.ref_name }}
+ push: true
+ tags: lthn/chain:testnet-${{ github.ref_name }},ghcr.io/letheanvpn/blockchain-itw3:testnet-${{ github.ref_name }}
+ - name: Docker Build
+ if: ${{ github.event_name == 'pull_request' }}
+ uses: docker/build-push-action@v3
+ with:
+ context: .
+ file: utils/docker/Dockerfile
+ cache-to: ghcr.io/letheanvpn/blockchain-itw3:testnet-${{ github.head_ref }}
+ cache-from: ghcr.io/letheanvpn/blockchain-itw3:testnet-${{ github.head_ref }}
+ push: true
+ tags: lthn/chain:testnet-${{ github.head_ref }},ghcr.io/letheanvpn/blockchain-itw3:testnet-${{ github.head_ref }}
+
diff --git a/.github/workflows/gui-testnet.yml b/.github/workflows/gui-testnet.yml
new file mode 100644
index 00000000..2880c6ad
--- /dev/null
+++ b/.github/workflows/gui-testnet.yml
@@ -0,0 +1,170 @@
+name: "gui-testnet"
+on:
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+ push:
+ paths-ignore:
+ - '**.md'
+ pull_request:
+ paths-ignore:
+ - '**.md'
+
+env:
+ CCACHE_SETTINGS: |
+ ccache --max-size=150M
+ ccache --set-config=compression=true
+
+jobs:
+ linux-amd64:
+ runs-on: ubuntu-20.04
+ env:
+ CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
+ steps:
+ - name: Cancel Previous Runs
+ uses: styfle/cancel-workflow-action@0.9.1
+ with:
+ access_token: ${{ github.token }}
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ - uses: actions/cache@v3
+ with:
+ path: ${{ github.workspace }}/ccache
+ key: ccache-${{ runner.os }}-build-testnet-gui
+ restore-keys: ccache-${{ runner.os }}-build-testnet-gui
+ - name: update apt
+ run: sudo apt update
+ - name: install dependencies
+ run: sudo apt-get install -y qt5-default qtwebengine5-dev libqt5websockets5-dev python-dev autotools-dev libboost-all-dev libicu-dev libbz2-dev git screen checkinstall zlib1g-dev ccache miniupnpc
+ - name: build server
+ env:
+ QT_PREFIX_PATH: /usr/lib/qt5
+ run: |
+ ${{env.CCACHE_SETTINGS}}
+ ./utils/build/testnet_linux_gui.sh
+ - uses: actions/upload-artifact@v3
+ with:
+ name: lethean-gui-bundle-linux-testnet-x86_64
+ if-no-files-found: error
+ path: lethean-gui-bundle-linux-testnet-x86_64.tar.bz2
+ - name: Release
+ uses: softprops/action-gh-release@v1
+ if: startsWith(github.ref, 'refs/tags/')
+ with:
+ files: ${{ github.workspace }}/lethean-gui-bundle-linux-testnet-x86_64.tar.bz2
+ macos-amd64:
+ runs-on: macos-latest
+ env:
+ CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
+ steps:
+ - name: Cancel Previous Runs
+ uses: styfle/cancel-workflow-action@0.9.1
+ with:
+ access_token: ${{ github.token }}
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ - uses: actions/cache@v3
+ with:
+ path: ${{ github.workspace }}/ccache
+ key: ccache-${{ runner.os }}-build-testnet-gui
+ restore-keys: ccache-${{ runner.os }}-build-testnet-gui
+ - name: install dependencies
+ run: HOMEBREW_NO_AUTO_UPDATE=1 brew install openssl boost icu4c ccache miniupnpc qt@5
+ - name: build server
+ env:
+ PKG_CONFIG_PATH: "/usr/local/opt/openssl@3/lib/pkgconfig"
+ OPENSSL_ROOT_DIR: "/usr/local/opt/openssl@3"
+ ZANO_BOOST_ROOT: "/usr/local/opt/boost"
+ ZANO_BOOST_LIBS_PATH: "/usr/local/opt/boost/lib"
+ ZANO_QT_PATH: "/usr/local/opt/qt@5"
+ CMAKE_OSX_SYSROOT: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk"
+ run: |
+ ${{env.CCACHE_SETTINGS}}
+ export LIBRARY_PATH=${LIBRARY_PATH}:/usr/local/opt/icu4c/lib
+ ./utils/build/testnet_mac_osx_gui.sh
+ - uses: actions/upload-artifact@v3
+ with:
+ name: lethean-gui-bundle-macos-testnet-i386
+ if-no-files-found: error
+ path: lethean-gui-bundle-macos-testnet-i386.tar.bz2
+ - name: Release
+ uses: softprops/action-gh-release@v1
+ if: startsWith(github.ref, 'refs/tags/')
+ with:
+ files: ${{ github.workspace }}/lethean-gui-bundle-macos-testnet-i386.tar.bz2
+ windows-amd64:
+ runs-on: windows-latest
+ env:
+ CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
+ steps:
+ - name: Cancel Previous Runs
+ uses: styfle/cancel-workflow-action@0.9.1
+ with:
+ access_token: ${{ github.token }}
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ - name: cCache Cache
+ uses: actions/cache@v3
+ with:
+ path: ${{ github.workspace }}/ccache
+ key: ccache-${{ runner.os }}-build-testnet-gui
+ restore-keys: ccache-${{ runner.os }}-build-testnet-gui
+ - name: Eat the Choco
+ run: |
+ choco install openssl --version 1.1.1.1500 -y
+ choco install ccache -y
+ choco install zip -y
+ - name: Install Qt
+ uses: jurplel/install-qt-action@v3
+ with:
+ version: '5.15.2'
+ host: 'windows'
+ target: 'desktop'
+ arch: 'win64_msvc2019_64'
+ dir: '${{ github.workspace }}/example/'
+ modules: 'qtcharts qtwebengine'
+ tools: 'tools_cmake tools_vcredist'
+ cache: true
+ - name: install msvc toolset
+ uses: ilammy/msvc-dev-cmd@v1
+ - name: Install boost
+ uses: MarkusJx/install-boost@v2.4.1
+ id: install-boost
+ with:
+ # REQUIRED: Specify the required boost version
+ # A list of supported versions can be found here:
+ # https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json
+ boost_version: 1.80.0
+ platform_version: 2022
+ toolset: msvc
+ link: static
+ - name: Set up Visual Studio shell
+ uses: egor-tensin/vs-shell@v2
+ with:
+ arch: x64
+ - name: build server
+ env:
+ QT_PREFIX_PATH: ${{ github.workspace }}/example/Qt/5.15.2/win64_msvc2019_64
+ BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
+ LOCAL_BOOST_PATH: ${{ steps.install-boost.outputs.BOOST_ROOT }}
+ OPENSSL_ROOT_DIR: "C:\\Program Files\\OpenSSL-Win64"
+ CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
+ run: |
+ ${{env.CCACHE_SETTINGS}}
+ .\utils\build\testnet_windows_gui.bat
+ - uses: actions/upload-artifact@v3
+ with:
+ name: lethean-gui-bundle-win-testnet-x64
+ if-no-files-found: error
+ path: ${{ github.workspace }}\lethean-gui-bundle-win-testnet-x64.zip
+ - name: Release
+ uses: softprops/action-gh-release@v1
+ if: startsWith(github.ref, 'refs/tags/')
+ with:
+ files: |
+ lethean-gui-bundle-win-testnet-*
diff --git a/.gitignore b/.gitignore
index 7518f4e9..557012b6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,5 +5,6 @@
._.DS_Store
Thumbs.db
._*
+out
.idea
.vs/*
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
index 191af28d..b2d6bfb8 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,10 @@
[submodule "contrib/miniupnp"]
path = contrib/miniupnp
url = https://github.com/miniupnp/miniupnp
+[submodule "contrib/tor-connect"]
+ path = contrib/tor-connect
+ url = https://github.com/letheanVPN/tor-connect.git
+ branch = main
[submodule "src/gui/qt-daemon/layout"]
path = src/gui/qt-daemon/layout
url = https://github.com/hyle-team/zano_ui.git
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 00000000..ad8daebd
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+Lethean
diff --git a/.idea/blockchain-iTw3.iml b/.idea/blockchain-iTw3.iml
new file mode 100644
index 00000000..f08604bb
--- /dev/null
+++ b/.idea/blockchain-iTw3.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/.idea/cmake.xml b/.idea/cmake.xml
new file mode 100644
index 00000000..bb2d9a14
--- /dev/null
+++ b/.idea/cmake.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/.idea/code-comments.xml b/.idea/code-comments.xml
new file mode 100644
index 00000000..edd215bb
--- /dev/null
+++ b/.idea/code-comments.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 00000000..79ee123c
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 00000000..79b3c948
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000..780bc2f0
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/daemon.xml b/.idea/runConfigurations/daemon.xml
new file mode 100644
index 00000000..0726754d
--- /dev/null
+++ b/.idea/runConfigurations/daemon.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/docker_server.xml b/.idea/runConfigurations/docker_server.xml
new file mode 100644
index 00000000..6572ce7c
--- /dev/null
+++ b/.idea/runConfigurations/docker_server.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/simplewallet.xml b/.idea/runConfigurations/simplewallet.xml
new file mode 100644
index 00000000..851f56cf
--- /dev/null
+++ b/.idea/runConfigurations/simplewallet.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/wallet.xml b/.idea/runConfigurations/wallet.xml
new file mode 100644
index 00000000..abca9644
--- /dev/null
+++ b/.idea/runConfigurations/wallet.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..7e3b93ca
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 31c80a7a..0d5de234 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,11 +1,41 @@
cmake_minimum_required(VERSION 3.5)
-PROJECT(Zano)
+list(INSERT CMAKE_MODULE_PATH 0
+ "${CMAKE_CURRENT_SOURCE_DIR}/contrib/cmake")
+PROJECT(Lethean)
-message("OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}")
-message("OPENSSL_CRYPTO_LIBRARY: ${OPENSSL_CRYPTO_LIBRARY}")
-message("OPENSSL_SSL_LIBRARY: ${OPENSSL_SSL_LIBRARY}")
+option (USE_CCACHE "Use ccache if a usable instance is found" ON)
+if (USE_CCACHE)
+ include(FindCcache) # Has to be included after the project() macro, to be able to read the CXX variable.
+else()
+ message(STATUS "ccache deselected")
+endif()
+option (USE_COMPILATION_TIME_PROFILER "Use compilation time profiler (for CLang >= 9 only)" OFF)
+if (USE_COMPILATION_TIME_PROFILER)
+ if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+ message(FATAL_ERROR "The flag USE_COMPILATION_TIME_PROFILER is meant to be set only for CLang compiler!")
+ endif()
+ add_compile_options("-ftime-trace")
+endif()
+
+if (${CMAKE_VERSION} VERSION_GREATER "3.0.0" AND CMAKE_MAKE_PROGRAM MATCHES "ninja")
+ set(CCACHE_PARALLEL_COMPILE_JOBS "" CACHE STRING "The maximum number of concurrent compilation jobs.")
+ if (CCACHE_PARALLEL_COMPILE_JOBS)
+ set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${CCACHE_PARALLEL_COMPILE_JOBS})
+ set(CMAKE_JOB_POOL_COMPILE compile_job_pool)
+ endif ()
+
+ set(CCACHE_PARALLEL_LINK_JOBS "" CACHE STRING "The maximum number of concurrent link jobs.")
+ if (CCACHE_PARALLEL_LINK_JOBS)
+ set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${CCACHE_PARALLEL_LINK_JOBS})
+ set(CMAKE_JOB_POOL_LINK link_job_pool)
+ endif ()
+endif ()
+
+message("OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}")
+message("OPENSSL_CRYPTO_LIBRARY: ${OPENSSL_CRYPTO_LIBRARY}")
+message("OPENSSL_SSL_LIBRARY: ${OPENSSL_SSL_LIBRARY}")
@@ -26,15 +56,15 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
add_definitions(-DMOBILE_WALLET_BUILD)
- if(CMAKE_SYSTEM_NAME STREQUAL "iOS" )
+ if(CMAKE_SYSTEM_NAME STREQUAL "iOS" )
add_definitions(-DIOS_BUILD)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
add_definitions(-DANDROID_BUILD)
- message("Android sdk prefix: ${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}")
- message("Android CMAKE_CXX_COMPILER prefix: ${CMAKE_CXX_COMPILER}")
+ message("Android sdk prefix: ${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}")
+ message("Android CMAKE_CXX_COMPILER prefix: ${CMAKE_CXX_COMPILER}")
message("Android ANDROID_LD: ${ANDROID_LD}")
endif()
endif()
@@ -49,16 +79,16 @@ if (UNIX AND NOT APPLE)
endif()
else()
# multi configurations for MSVC and XCode
- if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
+ if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(CMAKE_CONFIGURATION_TYPES "Release")
- elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
else()
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
endif()
endif()
message("Generated with config types: ${CMAKE_CONFIGURATION_TYPES}, and built type: ${CMAKE_BUILD_TYPE}")
-
+
enable_testing()
set(OPENSSL_USE_STATIC_LIBS TRUE) # link statically
@@ -66,12 +96,13 @@ find_package(OpenSSL REQUIRED)
if(APPLE)
- set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12)
+ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum OS X deployment version")
endif()
set(USE_PCH FALSE CACHE BOOL "Use shared precompiled headers")
set(DISABLE_TOR FALSE CACHE BOOL "Disable TOR library(and related tor-connect submodule)")
set(TESTNET FALSE CACHE BOOL "Compile for testnet")
+set(MUTE_ERRORS TRUE CACHE BOOL "Disable Error Suppression")
set(BUILD_GUI FALSE CACHE BOOL "Build qt-daemon")
include_directories(src contrib/eos_portable_archive contrib contrib/epee/include ${OPENSSL_INCLUDE_DIR} "${CMAKE_BINARY_DIR}/version" "${CMAKE_BINARY_DIR}/contrib/zlib")
@@ -79,24 +110,37 @@ include_directories(src contrib/eos_portable_archive contrib contrib/epee/includ
add_definitions(-DSTATICLIB)
if(TESTNET)
- message("!!!!!! NOTICE: Project is building for TESTNET !!!!!!")
- add_definitions(-DTESTNET)
+ message("!!!!!! NOTICE: Project is building for TESTNET !!!!!!")
+ add_definitions(-DTESTNET)
+ if(MUTE_ERRORS)
+ # shhhhh sleepy time errors, we know...
+ add_definitions(-w)
+ endif()
+else()
+ if(MUTE_ERRORS)
+ # shhhhh sleepy time errors, we know...
+ add_definitions(-w)
+ endif()
endif()
if(CAKEWALLET)
- message("NOTICE: Building libraries for CAKEWALLET")
- add_definitions(-DCAKEWALLET)
+ message("NOTICE: Building libraries for CAKEWALLET")
+ add_definitions(-DCAKEWALLET)
endif()
set(OPENSSL_USE_STATIC_LIBS TRUE) # link statically
find_package(OpenSSL REQUIRED)
if(DISABLE_TOR)
- message("NOTICE: Building with disabled TOR support!")
- add_definitions(-DDISABLE_TOR)
+ message("NOTICE: Building with disabled TOR support!")
+ add_definitions(-DDISABLE_TOR)
endif()
+include_directories(src contrib/eos_portable_archive contrib contrib/epee/include "${CMAKE_BINARY_DIR}/version" "${CMAKE_BINARY_DIR}/contrib/zlib")
+
+add_definitions(-DSTATICLIB)
+
set(STATIC ${MSVC} CACHE BOOL "Link libraries statically")
if (UNIX AND NOT APPLE)
# Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail
@@ -197,7 +241,7 @@ else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
if(STATIC)
if(APPLE)
- message(SEND_ERROR "Static build is not supported on MacOS X")
+# message(SEND_ERROR "Static build is not supported on MacOS X")
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
endif()
@@ -214,12 +258,12 @@ if(MSVC)
set(Boost_USE_STATIC_LIBS ON)
endif()
-if(STATIC)
- set(Boost_USE_STATIC_LIBS ON)
- set(Boost_USE_STATIC_RUNTIME ON)
+if(STATIC)
+ set(Boost_USE_STATIC_LIBS ON)
+# set(Boost_USE_STATIC_RUNTIME ON)
endif()
-message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
+message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(CMAKE_OSX_DEPLOYMENT_TARGET 12.00)
set(Boost_LIBRARIES "libboost.a")
@@ -250,8 +294,8 @@ if(MINGW)
elseif(NOT MSVC)
if(NOT APPLE)
set(Boost_LIBRARIES "${Boost_LIBRARIES};")
- if(STATIC)
- message("NOTICE: Including static ICU libraries")
+ if(STATIC)
+ message("NOTICE: Including static ICU libraries")
set(Boost_LIBRARIES "${Boost_LIBRARIES};icui18n.a;icuuc.a;icudata.a;dl")
endif()
endif()
@@ -259,7 +303,13 @@ endif()
if(BUILD_GUI)
cmake_minimum_required(VERSION 3.1)
- find_package(Qt5Widgets REQUIRED)
+
+ if(APPLE AND NOT CMAKE_PREFIX_PATH)
+ execute_process(COMMAND brew --prefix qt5 OUTPUT_VARIABLE QT5_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
+ list(APPEND CMAKE_PREFIX_PATH ${QT5_DIR})
+ endif()
+
+ find_package(Qt5Widgets REQUIRED)
endif()
set(COMMIT_ID_IN_VERSION ON CACHE BOOL "Include commit ID in version")
@@ -288,13 +338,13 @@ else()
endif()
endif()
-set(BUILD_TESTS FALSE CACHE BOOL "Build Zano tests")
-set(DISABLE_MDBX FALSE CACHE BOOL "Exclude mdbx from build(need for a first time)")
+set(BUILD_TESTS FALSE CACHE BOOL "Build Lethean tests")
+set(DISABLE_MDBX FALSE CACHE BOOL "Exclude mdbx from build(need for a first time)")
if(NOT DISABLE_MDBX)
add_definitions(-DENABLED_ENGINE_MDBX)
endif()
-
+
add_subdirectory(contrib)
add_subdirectory(src)
diff --git a/CODEOWNERS b/CODEOWNERS
new file mode 100644
index 00000000..95df2ee3
--- /dev/null
+++ b/CODEOWNERS
@@ -0,0 +1,2 @@
+* @snider
+docs/* @snider @bodane
\ No newline at end of file
diff --git a/LICENCE b/LICENCE
new file mode 100644
index 00000000..c29ce2f8
--- /dev/null
+++ b/LICENCE
@@ -0,0 +1,287 @@
+ EUROPEAN UNION PUBLIC LICENCE v. 1.2
+ EUPL © the European Union 2007, 2016
+
+This European Union Public Licence (the ‘EUPL’) applies to the Work (as defined
+below) which is provided under the terms of this Licence. Any use of the Work,
+other than as authorised under this Licence is prohibited (to the extent such
+use is covered by a right of the copyright holder of the Work).
+
+The Work is provided under the terms of this Licence when the Licensor (as
+defined below) has placed the following notice immediately following the
+copyright notice for the Work:
+
+ Licensed under the EUPL
+
+or has expressed by any other means his willingness to license under the EUPL.
+
+1. Definitions
+
+In this Licence, the following terms have the following meaning:
+
+- ‘The Licence’: this Licence.
+
+- ‘The Original Work’: the work or software distributed or communicated by the
+ Licensor under this Licence, available as Source Code and also as Executable
+ Code as the case may be.
+
+- ‘Derivative Works’: the works or software that could be created by the
+ Licensee, based upon the Original Work or modifications thereof. This Licence
+ does not define the extent of modification or dependence on the Original Work
+ required in order to classify a work as a Derivative Work; this extent is
+ determined by copyright law applicable in the country mentioned in Article 15.
+
+- ‘The Work’: the Original Work or its Derivative Works.
+
+- ‘The Source Code’: the human-readable form of the Work which is the most
+ convenient for people to study and modify.
+
+- ‘The Executable Code’: any code which has generally been compiled and which is
+ meant to be interpreted by a computer as a program.
+
+- ‘The Licensor’: the natural or legal person that distributes or communicates
+ the Work under the Licence.
+
+- ‘Contributor(s)’: any natural or legal person who modifies the Work under the
+ Licence, or otherwise contributes to the creation of a Derivative Work.
+
+- ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of
+ the Work under the terms of the Licence.
+
+- ‘Distribution’ or ‘Communication’: any act of selling, giving, lending,
+ renting, distributing, communicating, transmitting, or otherwise making
+ available, online or offline, copies of the Work or providing access to its
+ essential functionalities at the disposal of any other natural or legal
+ person.
+
+2. Scope of the rights granted by the Licence
+
+The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
+sublicensable licence to do the following, for the duration of copyright vested
+in the Original Work:
+
+- use the Work in any circumstance and for all usage,
+- reproduce the Work,
+- modify the Work, and make Derivative Works based upon the Work,
+- communicate to the public, including the right to make available or display
+ the Work or copies thereof to the public and perform publicly, as the case may
+ be, the Work,
+- distribute the Work or copies thereof,
+- lend and rent the Work or copies thereof,
+- sublicense rights in the Work or copies thereof.
+
+Those rights can be exercised on any media, supports and formats, whether now
+known or later invented, as far as the applicable law permits so.
+
+In the countries where moral rights apply, the Licensor waives his right to
+exercise his moral right to the extent allowed by law in order to make effective
+the licence of the economic rights here above listed.
+
+The Licensor grants to the Licensee royalty-free, non-exclusive usage rights to
+any patents held by the Licensor, to the extent necessary to make use of the
+rights granted on the Work under this Licence.
+
+3. Communication of the Source Code
+
+The Licensor may provide the Work either in its Source Code form, or as
+Executable Code. If the Work is provided as Executable Code, the Licensor
+provides in addition a machine-readable copy of the Source Code of the Work
+along with each copy of the Work that the Licensor distributes or indicates, in
+a notice following the copyright notice attached to the Work, a repository where
+the Source Code is easily and freely accessible for as long as the Licensor
+continues to distribute or communicate the Work.
+
+4. Limitations on copyright
+
+Nothing in this Licence is intended to deprive the Licensee of the benefits from
+any exception or limitation to the exclusive rights of the rights owners in the
+Work, of the exhaustion of those rights or of other applicable limitations
+thereto.
+
+5. Obligations of the Licensee
+
+The grant of the rights mentioned above is subject to some restrictions and
+obligations imposed on the Licensee. Those obligations are the following:
+
+Attribution right: The Licensee shall keep intact all copyright, patent or
+trademarks notices and all notices that refer to the Licence and to the
+disclaimer of warranties. The Licensee must include a copy of such notices and a
+copy of the Licence with every copy of the Work he/she distributes or
+communicates. The Licensee must cause any Derivative Work to carry prominent
+notices stating that the Work has been modified and the date of modification.
+
+Copyleft clause: If the Licensee distributes or communicates copies of the
+Original Works or Derivative Works, this Distribution or Communication will be
+done under the terms of this Licence or of a later version of this Licence
+unless the Original Work is expressly distributed only under this version of the
+Licence — for example by communicating ‘EUPL v. 1.2 only’. The Licensee
+(becoming Licensor) cannot offer or impose any additional terms or conditions on
+the Work or Derivative Work that alter or restrict the terms of the Licence.
+
+Compatibility clause: If the Licensee Distributes or Communicates Derivative
+Works or copies thereof based upon both the Work and another work licensed under
+a Compatible Licence, this Distribution or Communication can be done under the
+terms of this Compatible Licence. For the sake of this clause, ‘Compatible
+Licence’ refers to the licences listed in the appendix attached to this Licence.
+Should the Licensee's obligations under the Compatible Licence conflict with
+his/her obligations under this Licence, the obligations of the Compatible
+Licence shall prevail.
+
+Provision of Source Code: When distributing or communicating copies of the Work,
+the Licensee will provide a machine-readable copy of the Source Code or indicate
+a repository where this Source will be easily and freely available for as long
+as the Licensee continues to distribute or communicate the Work.
+
+Legal Protection: This Licence does not grant permission to use the trade names,
+trademarks, service marks, or names of the Licensor, except as required for
+reasonable and customary use in describing the origin of the Work and
+reproducing the content of the copyright notice.
+
+6. Chain of Authorship
+
+The original Licensor warrants that the copyright in the Original Work granted
+hereunder is owned by him/her or licensed to him/her and that he/she has the
+power and authority to grant the Licence.
+
+Each Contributor warrants that the copyright in the modifications he/she brings
+to the Work are owned by him/her or licensed to him/her and that he/she has the
+power and authority to grant the Licence.
+
+Each time You accept the Licence, the original Licensor and subsequent
+Contributors grant You a licence to their contributions to the Work, under the
+terms of this Licence.
+
+7. Disclaimer of Warranty
+
+The Work is a work in progress, which is continuously improved by numerous
+Contributors. It is not a finished work and may therefore contain defects or
+‘bugs’ inherent to this type of development.
+
+For the above reason, the Work is provided under the Licence on an ‘as is’ basis
+and without warranties of any kind concerning the Work, including without
+limitation merchantability, fitness for a particular purpose, absence of defects
+or errors, accuracy, non-infringement of intellectual property rights other than
+copyright as stated in Article 6 of this Licence.
+
+This disclaimer of warranty is an essential part of the Licence and a condition
+for the grant of any rights to the Work.
+
+8. Disclaimer of Liability
+
+Except in the cases of wilful misconduct or damages directly caused to natural
+persons, the Licensor will in no event be liable for any direct or indirect,
+material or moral, damages of any kind, arising out of the Licence or of the use
+of the Work, including without limitation, damages for loss of goodwill, work
+stoppage, computer failure or malfunction, loss of data or any commercial
+damage, even if the Licensor has been advised of the possibility of such damage.
+However, the Licensor will be liable under statutory product liability laws as
+far such laws apply to the Work.
+
+9. Additional agreements
+
+While distributing the Work, You may choose to conclude an additional agreement,
+defining obligations or services consistent with this Licence. However, if
+accepting obligations, You may act only on your own behalf and on your sole
+responsibility, not on behalf of the original Licensor or any other Contributor,
+and only if You agree to indemnify, defend, and hold each Contributor harmless
+for any liability incurred by, or claims asserted against such Contributor by
+the fact You have accepted any warranty or additional liability.
+
+10. Acceptance of the Licence
+
+The provisions of this Licence can be accepted by clicking on an icon ‘I agree’
+placed under the bottom of a window displaying the text of this Licence or by
+affirming consent in any other similar way, in accordance with the rules of
+applicable law. Clicking on that icon indicates your clear and irrevocable
+acceptance of this Licence and all of its terms and conditions.
+
+Similarly, you irrevocably accept this Licence and all of its terms and
+conditions by exercising any rights granted to You by Article 2 of this Licence,
+such as the use of the Work, the creation by You of a Derivative Work or the
+Distribution or Communication by You of the Work or copies thereof.
+
+11. Information to the public
+
+In case of any Distribution or Communication of the Work by means of electronic
+communication by You (for example, by offering to download the Work from a
+remote location) the distribution channel or media (for example, a website) must
+at least provide to the public the information requested by the applicable law
+regarding the Licensor, the Licence and the way it may be accessible, concluded,
+stored and reproduced by the Licensee.
+
+12. Termination of the Licence
+
+The Licence and the rights granted hereunder will terminate automatically upon
+any breach by the Licensee of the terms of the Licence.
+
+Such a termination will not terminate the licences of any person who has
+received the Work from the Licensee under the Licence, provided such persons
+remain in full compliance with the Licence.
+
+13. Miscellaneous
+
+Without prejudice of Article 9 above, the Licence represents the complete
+agreement between the Parties as to the Work.
+
+If any provision of the Licence is invalid or unenforceable under applicable
+law, this will not affect the validity or enforceability of the Licence as a
+whole. Such provision will be construed or reformed so as necessary to make it
+valid and enforceable.
+
+The European Commission may publish other linguistic versions or new versions of
+this Licence or updated versions of the Appendix, so far this is required and
+reasonable, without reducing the scope of the rights granted by the Licence. New
+versions of the Licence will be published with a unique version number.
+
+All linguistic versions of this Licence, approved by the European Commission,
+have identical value. Parties can take advantage of the linguistic version of
+their choice.
+
+14. Jurisdiction
+
+Without prejudice to specific agreement between parties,
+
+- any litigation resulting from the interpretation of this License, arising
+ between the European Union institutions, bodies, offices or agencies, as a
+ Licensor, and any Licensee, will be subject to the jurisdiction of the Court
+ of Justice of the European Union, as laid down in article 272 of the Treaty on
+ the Functioning of the European Union,
+
+- any litigation arising between other parties and resulting from the
+ interpretation of this License, will be subject to the exclusive jurisdiction
+ of the competent court where the Licensor resides or conducts its primary
+ business.
+
+15. Applicable Law
+
+Without prejudice to specific agreement between parties,
+
+- this Licence shall be governed by the law of the European Union Member State
+ where the Licensor has his seat, resides or has his registered office,
+
+- this licence shall be governed by Belgian law if the Licensor has no seat,
+ residence or registered office inside a European Union Member State.
+
+Appendix
+
+‘Compatible Licences’ according to Article 5 EUPL are:
+
+- GNU General Public License (GPL) v. 2, v. 3
+- GNU Affero General Public License (AGPL) v. 3
+- Open Software License (OSL) v. 2.1, v. 3.0
+- Eclipse Public License (EPL) v. 1.0
+- CeCILL v. 2.0, v. 2.1
+- Mozilla Public Licence (MPL) v. 2
+- GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
+- Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
+ works other than software
+- European Union Public Licence (EUPL) v. 1.1, v. 1.2
+- Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong
+ Reciprocity (LiLiQ-R+).
+
+The European Commission may update this Appendix to later versions of the above
+licences without producing a new version of the EUPL, as long as they provide
+the rights granted in Article 2 of this Licence and protect the covered Source
+Code from exclusive appropriation.
+
+All other changes or additions to this Appendix require the production of a new
+EUPL version.
\ No newline at end of file
diff --git a/Makefile b/Makefile
index d0be5571..5663014f 100644
--- a/Makefile
+++ b/Makefile
@@ -11,12 +11,13 @@ endif
cmake = cmake $(cmake_gen)
-cmake_debug = $(cmake) -D CMAKE_BUILD_TYPE=Debug
+cmake_debug = $(cmake) -D CMAKE_BUILD_TYPE=Debug -D MUTE_ERRORS=FALSE
cmake_release = $(cmake) -D CMAKE_BUILD_TYPE=Release
cmake_gui = -D BUILD_GUI=ON
+cmake_testnet = -D TESTNET=ON
cmake_static = -D STATIC=ON
-cmake_tests = -D BUILD_TESTS=ON
+cmake_tests = -D BUILD_TESTS=ON -D TESTNET=ON
# Helper macro
define CMAKE
@@ -33,15 +34,27 @@ release:
$(eval command += $(cmake_release))
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
+release-testnet:
+ $(eval command += $(cmake_release) $(cmake_testnet))
+ $(call CMAKE,$(dir_release),$(command)) && $(MAKE)
+
debug:
$(eval command += $(cmake_debug))
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE)
+debug-testnet:
+ $(eval command += $(cmake_debug) $(cmake_testnet))
+ $(call CMAKE,$(dir_debug),$(command)) && $(MAKE)
+
static: static-release
static-release:
$(eval command += $(cmake_release) $(cmake_static))
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
+static-release-testnet:
+ $(eval command += $(cmake_release) $(cmake_static) $(cmake_testnet))
+ $(call CMAKE,$(dir_release),$(command)) && $(MAKE)
+
#
# GUI
#
@@ -50,6 +63,9 @@ gui: gui-release
gui-release:
$(eval command += $(cmake_release) $(cmake_gui))
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
+gui-release-testnet:
+ $(eval command += $(cmake_release) $(cmake_gui) $(cmake_testnet))
+ $(call CMAKE,$(dir_release),$(command)) && $(MAKE)
gui-debug:
$(eval command += $(cmake_debug) $(cmake_gui))
@@ -60,6 +76,10 @@ gui-release-static:
$(eval command += $(cmake_release) $(cmake_gui) $(cmake_static))
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
+gui-release-static-testnet:
+ $(eval command += $(cmake_release) $(cmake_gui) $(cmake_static) $(cmake_testnet))
+ $(call CMAKE,$(dir_release),$(command)) && $(MAKE)
+
#
# Tests
#
@@ -76,7 +96,10 @@ test-debug:
clean:
rm -rf build
+macos-gui:
+ bash ./utils/build/testnet_mac_osx_gui.sh
+
tags:
ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest
-.PHONY: all release debug static static-release gui gui-release gui-static gui-release-static gui-debug test test-release test-debug clean tags
+.PHONY: all release debug static static-release gui gui-release gui-static gui-release-static gui-debug test test-release test-debug clean tags macos-gui
diff --git a/README.md b/README.md
index 1b661e0a..1c8e8e29 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,19 @@
-[](https://scan.coverity.com/projects/zanoproject)
-[](https://discord.gg/wE3rmYY)
+# Addresses
+- `iT`/`0x73f7` - Main prefix
+- `iTH`/`0x6af7` - integrated paymennt_id address prefix
+- `iTHn`/`0xdeaf7` - auditable wallet address
+- `iTHa`/`0x7eaf7` - auditable integrated paymennt_id address prefix
+
+## Ports
+
+- STRATUM: `36941`
+- RPC: `36942`
+- P2P: `36943`
## Cloning
Be sure to clone the repository properly:\
-`$ git clone --recursive https://github.com/hyle-team/zano.git`
+`$ git clone --recursive https://github.com/letheanVPN/blockchain-iTw3.git`
# Building
--------
@@ -24,7 +33,7 @@ Be sure to clone the repository properly:\
Note:\
[*server version*] denotes steps required for building command-line tools (daemon, simplewallet, etc.).\
-[*GUI version*] denotes steps required for building Zano executable with GUI.
+[*GUI version*] denotes steps required for building LTHN executable with GUI.
@@ -109,9 +118,10 @@ For instance, by adding the following lines to `~/.bashrc`
BOOST_ROOT=$HOME/boost_1_70_0 OPENSSL_ROOT_DIR=$HOME/openssl cmake ..
make -j1 daemon simplewallet
- 2. If you set the variables in step 6:
-
- cd zano && mkdir build && cd build
+ cd lthn/ && make -j1
+ or
+
+ cd lthn && mkdir build && cd build
cmake ..
make -j1 daemon simplewallet
@@ -125,7 +135,7 @@ For instance, by adding the following lines to `~/.bashrc`
1. Build GUI:
- cd zano
+ cd lthn
utils/build_script_linux.sh
Look for the binaries in `build` folder
@@ -133,19 +143,32 @@ For instance, by adding the following lines to `~/.bashrc`
### Windows
-Recommended OS version: Windows 7 x64, Windows 11 x64.
-1. Install required prerequisites (Boost, Qt, CMake, OpenSSL).
-2. Edit paths in `utils/configure_local_paths.cmd`.
-3. Run one of `utils/configure_win64_msvsNNNN_gui.cmd` according to your MSVC version.
-4. Go to the build folder and open generated Zano.sln in MSVC.
-5. Build.
+Recommended OS versions: Windows 7+ x64, Windows 11 x64.
+
+1. Install [Chocolatey](https://chocolatey.org/install)
+2. Install required prerequisites (Boost, Qt, CMake, OpenSSL).
+
+ _NOTE: At time of writing the following versions were available on Chocolatey_
+ ```
+ choco install boost-msvc-14.2 --version 1.74.0 -y
+ choco install qt5-default --version 5.15.2.20211228 -y
+ choco install cmake --version 3.23.1 -y
+ choco install openssl --version 1.1.1.1500 -y
+ ```
+
+3. Clone repository, then complete the following:
+ 1. Edit paths in file `utils/configure_local_paths.cmd.example`.
+ 2. Rename `configure_local_paths.cmd.example` to `configure_local_paths.cmd` (do not commit).
+4. Run one of `utils/configure_win64_msvsNNNN_gui.cmd` according to your MSVC version.
+5. Go to the build folder and open generated Zano.sln in MSVC.
+6. Build.
In order to correctly deploy Qt GUI application, you also need to do the following:
-6. Copy Zano.exe to a folder (e.g. `depoy`).
-7. Run `PATH_TO_QT\bin\windeployqt.exe deploy\Zano.exe`.
+6. Copy Lethean.exe to a folder (e.g. `depoy`).
+7. Run `PATH_TO_QT\bin\windeployqt.exe deploy\Lethean.exe`.
8. Copy folder `\src\gui\qt-daemon\html` to `deploy\html`.
-9. Now you can run `Zano.exe`
+9. Now you can run `Lethean.exe`
@@ -160,12 +183,12 @@ To build GUI application:
1. Create self-signing certificate via Keychain Access:\
a. Run Keychain Access.\
b. Choose Keychain Access > Certificate Assistant > Create a Certificate.\
- c. Use “Zano” (without quotes) as certificate name.\
+ c. Use “LetheanVPN” (without quotes) as certificate name.\
d. Choose “Code Signing” in “Certificate Type” field.\
e. Press “Create”, then “Done”.\
f. Make sure the certificate was added to keychain "System". If not—move it to "System".\
g. Double click the certificate you've just added, enter the trust section and under "When using this certificate" select "Always trust".\
- h. Unfold the certificate in Keychain Access window and double click the underlying private key "Zano". Select "Access Control" tab, then select "Allow all applications to access this item". Click "Save Changes".
+ h. Unfold the certificate in Keychain Access window and double click the underlying private key "LetheanVPN". Select "Access Control" tab, then select "Allow all applications to access this item". Click "Save Changes".
2. Revise building script, comment out unwanted steps and run it: `utils/build_script_mac_osx.sh`
3. The application should be here: `/buid_mac_osx_64/release/src`
diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt
index a3220829..c9858c0f 100644
--- a/contrib/CMakeLists.txt
+++ b/contrib/CMakeLists.txt
@@ -14,10 +14,29 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
message("excluded upnp support for IOS build")
return()
endif()
+
+
+find_package(Miniupnpc REQUIRED)
+
+message(STATUS "Using in-tree miniupnpc")
+set(UPNPC_NO_INSTALL TRUE CACHE BOOL "Disable miniupnp installation" FORCE)
add_subdirectory(miniupnp/miniupnpc)
-
-
set_property(TARGET libminiupnpc-static PROPERTY FOLDER "contrib")
+set_property(TARGET libminiupnpc-static PROPERTY POSITION_INDEPENDENT_CODE ON)
+if(MSVC)
+ set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
+elseif(NOT MSVC)
+ set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
+endif()
+if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+ set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -D_NETBSD_SOURCE")
+endif()
+
+set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE)
+
+
+
+#set_property(TARGET libminiupnpc-static PROPERTY FOLDER "contrib")
set_property(TARGET zlibstatic PROPERTY FOLDER "contrib")
set_property(TARGET mdbx PROPERTY FOLDER "contrib")
set_property(TARGET lmdb PROPERTY FOLDER "contrib")
@@ -25,7 +44,7 @@ if( NOT DISABLE_TOR)
set_property(TARGET tor-connect PROPERTY FOLDER "contrib")
endif()
-set_property(TARGET upnpc-static mdbx_chk mdbx_copy mdbx_dump mdbx_load mdbx_stat PROPERTY FOLDER "unused")
+set_property(TARGET mdbx_chk mdbx_copy mdbx_dump mdbx_load mdbx_stat PROPERTY FOLDER "unused")
if(MSVC)
#set_property(TARGET ntdll_extra_target PROPERTY FOLDER "unused")
@@ -33,9 +52,9 @@ endif()
if(MSVC)
- set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " /wd4244 /wd4267")
+# set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " /wd4244 /wd4267")
set_property(TARGET zlibstatic APPEND_STRING PROPERTY COMPILE_FLAGS " /wd4267 /wd4267")
else()
- set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value -Wno-implicit-fallthrough -Wno-discarded-qualifiers ")
- set_property(TARGET zlibstatic APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value -Wno-implicit-fallthrough -Wno-discarded-qualifiers ")
+# set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value -Wno-implicit-fallthrough -Wno-ignored-qualifiers ")
+ set_property(TARGET zlibstatic APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value -Wno-implicit-fallthrough -Wno-ignored-qualifiers ")
endif()
diff --git a/contrib/cmake/ConfigOpenSSL.cmake b/contrib/cmake/ConfigOpenSSL.cmake
new file mode 100644
index 00000000..71309563
--- /dev/null
+++ b/contrib/cmake/ConfigOpenSSL.cmake
@@ -0,0 +1,22 @@
+if (APPLE AND NOT IOS)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default")
+ if (NOT OPENSSL_ROOT_DIR)
+ EXECUTE_PROCESS(COMMAND brew --prefix openssl
+ OUTPUT_VARIABLE OPENSSL_ROOT_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ message(STATUS "Using OpenSSL found at ${OPENSSL_ROOT_DIR}")
+ endif()
+endif()
+
+find_package(OpenSSL REQUIRED)
+message(STATUS "Using OpenSSL include dir at ${OPENSSL_INCLUDE_DIR}")
+include_directories(${OPENSSL_INCLUDE_DIR})
+if(STATIC AND NOT IOS)
+ if(UNIX)
+ set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES};${CMAKE_DL_LIBS};${CMAKE_THREAD_LIBS_INIT}")
+ endif()
+endif()
+
+if (WIN32)
+ list(APPEND OPENSSL_LIBRARIES ws2_32 crypt32)
+endif()
diff --git a/contrib/cmake/FindCcache.cmake b/contrib/cmake/FindCcache.cmake
new file mode 100644
index 00000000..10e495f9
--- /dev/null
+++ b/contrib/cmake/FindCcache.cmake
@@ -0,0 +1,67 @@
+# Copyright (c) 2014-2022, The Monero Project
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this list of
+# conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice, this list
+# of conditions and the following disclaimer in the documentation and/or other
+# materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors may be
+# used to endorse or promote products derived from this software without specific
+# prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# - Try to find readline include dirs and libraries
+#
+# Automatically finds ccache build accelerator, if it's found in PATH.
+#
+# Usage of this module as follows:
+#
+# project(monero)
+# include(FindCcache) # Include AFTER the project() macro to be able to reach the CMAKE_CXX_COMPILER variable
+#
+# Properties modified by this module:
+#
+# GLOBAL PROPERTY RULE_LAUNCH_COMPILE set to ccache, when ccache found
+# GLOBAL PROPERTY RULE_LAUNCH_LINK set to ccache, when ccache found
+
+find_program(CCACHE_FOUND ccache)
+if (CCACHE_FOUND)
+ # Try to compile a test program with ccache, in order to verify if it really works. (needed on exotic setups)
+ set(TEST_PROJECT "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp")
+ file(WRITE "${TEST_PROJECT}/CMakeLists.txt" [=[
+cmake_minimum_required(VERSION 3.5)
+project(test)
+option (CCACHE "")
+file(WRITE "${CMAKE_SOURCE_DIR}/test.cpp" "int main() { return 0; }")
+set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE}")
+set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE}")
+add_executable(main test.cpp)
+]=])
+ try_compile(RET "${TEST_PROJECT}/build" "${TEST_PROJECT}" "test" CMAKE_FLAGS -DCCACHE="${CCACHE_FOUND}")
+ unset(TEST_PROJECT)
+ if (${RET})
+ # Success
+ message(STATUS "Found usable ccache: ${CCACHE_FOUND}")
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}")
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_FOUND}")
+ else()
+ message(STATUS "Found ccache ${CCACHE_FOUND}, but is UNUSABLE! Return code: ${RET}")
+ endif()
+else()
+ message(STATUS "ccache NOT found! Please install it for faster rebuilds.")
+endif()
diff --git a/contrib/cmake/FindMiniupnpc.cmake b/contrib/cmake/FindMiniupnpc.cmake
new file mode 100644
index 00000000..a3872171
--- /dev/null
+++ b/contrib/cmake/FindMiniupnpc.cmake
@@ -0,0 +1,59 @@
+# --------------------------------- FindMiniupnpc Start ---------------------------------
+# Locate miniupnp library
+# This module defines
+# MINIUPNP_FOUND, if false, do not try to link to miniupnp
+# MINIUPNP_LIBRARY, the miniupnp variant
+# MINIUPNP_INCLUDE_DIR, where to find miniupnpc.h and family)
+# MINIUPNPC_VERSION_1_7_OR_HIGHER, set if we detect the version of miniupnpc is 1.7 or higher
+#
+# Note that the expected include convention is
+# #include "miniupnpc.h"
+# and not
+# #include
+# This is because, the miniupnpc location is not standardized and may exist
+# in locations other than miniupnpc/
+
+if (MINIUPNP_INCLUDE_DIR AND MINIUPNP_LIBRARY)
+ # Already in cache, be silent
+ set(MINIUPNP_FIND_QUIETLY TRUE)
+endif ()
+
+find_path(MINIUPNP_INCLUDE_DIR miniupnpc.h
+ HINTS $ENV{MINIUPNP_INCLUDE_DIR}
+ PATH_SUFFIXES miniupnpc
+ )
+
+find_library(MINIUPNP_LIBRARY miniupnpc
+ HINTS $ENV{MINIUPNP_LIBRARY}
+ )
+
+find_library(MINIUPNP_STATIC_LIBRARY libminiupnpc.a
+ HINTS $ENV{MINIUPNP_STATIC_LIBRARY}
+ )
+
+set(MINIUPNP_INCLUDE_DIRS ${MINIUPNP_INCLUDE_DIR})
+set(MINIUPNP_LIBRARIES ${MINIUPNP_LIBRARY})
+set(MINIUPNP_STATIC_LIBRARIES ${MINIUPNP_STATIC_LIBRARY})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ MiniUPnPc DEFAULT_MSG
+ MINIUPNP_INCLUDE_DIR
+ MINIUPNP_LIBRARY
+)
+
+IF(MINIUPNPC_FOUND)
+ file(STRINGS "${MINIUPNP_INCLUDE_DIR}/miniupnpc.h" MINIUPNPC_API_VERSION_STR REGEX "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+[0-9]+")
+ if(MINIUPNPC_API_VERSION_STR MATCHES "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+([0-9]+)")
+ set(MINIUPNPC_API_VERSION "${CMAKE_MATCH_1}")
+ if (${MINIUPNPC_API_VERSION} GREATER "10" OR ${MINIUPNPC_API_VERSION} EQUAL "10")
+ message(STATUS "Found miniupnpc API version " ${MINIUPNPC_API_VERSION})
+ set(MINIUPNP_FOUND true)
+ set(MINIUPNPC_VERSION_1_7_OR_HIGHER true)
+ endif()
+ endif()
+
+ENDIF()
+
+mark_as_advanced(MINIUPNP_INCLUDE_DIR MINIUPNP_LIBRARY MINIUPNP_STATIC_LIBRARY)
+# --------------------------------- FindMiniupnpc End ---------------------------------
diff --git a/contrib/epee/include/misc_language.h b/contrib/epee/include/misc_language.h
index 5855d977..adce0c88 100644
--- a/contrib/epee/include/misc_language.h
+++ b/contrib/epee/include/misc_language.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019, anonimal,
+// Copyright (c) 2019, anonimal,
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
diff --git a/contrib/epee/include/misc_log_ex.h b/contrib/epee/include/misc_log_ex.h
index 318237c9..09057999 100644
--- a/contrib/epee/include/misc_log_ex.h
+++ b/contrib/epee/include/misc_log_ex.h
@@ -1,5 +1,5 @@
// Copyright (c) 2019, Zano Project
-// Copyright (c) 2019, anonimal
+// Copyright (c) 2019, anonimal
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
diff --git a/contrib/epee/include/profile_tools.h b/contrib/epee/include/profile_tools.h
index b66adac4..ecd82e7c 100644
--- a/contrib/epee/include/profile_tools.h
+++ b/contrib/epee/include/profile_tools.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019, anonimal
+// Copyright (c) 2019, anonimal
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
diff --git a/contrib/epee/include/string_tools.h b/contrib/epee/include/string_tools.h
index 24dbffee..b09499d0 100644
--- a/contrib/epee/include/string_tools.h
+++ b/contrib/epee/include/string_tools.h
@@ -22,7 +22,7 @@
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
+//
#ifndef _STRING_TOOLS_H_
#define _STRING_TOOLS_H_
diff --git a/resources/app_icon_256.png b/resources/app_icon_256.png
deleted file mode 100644
index c2cb1525..00000000
Binary files a/resources/app_icon_256.png and /dev/null differ
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
deleted file mode 100644
index f27305af..00000000
--- a/snap/snapcraft.yaml
+++ /dev/null
@@ -1,75 +0,0 @@
-name: zano
-base: core18
-adopt-info: zano
-summary: "Zano coin: official wallet. Secure. Scalable. Easy to Use."
-description: |
- Zano is a scalable and secure coin, designed for use in e-commerce.
- The technology behind our blockchain provides reliability, security,
- and flexibility a perfect option for P2P transactions.
- More info: http://zano.org
-grade: stable
-confinement: strict
-
-architectures:
- - build-on: amd64
- - build-on: i386
-
-parts:
- zano:
- source: https://github.com/hyle-team/zano.git
- plugin: cmake
- override-pull: |
- snapcraftctl pull
- snapcraftctl set-version "$(git describe)"
- configflags:
- - -DBUILD_GUI=TRUE
- override-build: |
- snapcraftctl build
- mkdir -p $SNAPCRAFT_PART_INSTALL/opt/Zano
- cp $SNAPCRAFT_PART_BUILD/src/Zano $SNAPCRAFT_PART_INSTALL/opt/Zano/
- cp $SNAPCRAFT_PART_BUILD/src/simplewallet $SNAPCRAFT_PART_INSTALL/opt/Zano/
- cp $SNAPCRAFT_PART_BUILD/src/zanod $SNAPCRAFT_PART_INSTALL/opt/Zano/
- rsync -a $SNAPCRAFT_PART_SRC/src/gui/qt-daemon/html $SNAPCRAFT_PART_INSTALL/opt/Zano --exclude less --exclude package.json --exclude gulpfile.js
- build-packages:
- - make
- - g++
- - libboost-all-dev
- - qtwebengine5-dev
- - rsync
- build-attributes: [keep-execstack]
- stage-packages:
- - libboost-system1.65.1
- - libboost-filesystem1.65.1
- - libboost-thread1.65.1
- - libboost-date-time1.65.1
- - libboost-chrono1.65.1
- - libboost-regex1.65.1
- - libboost-serialization1.65.1
- - libboost-program-options1.65.1
- - libboost-locale1.65.1
-
-apps:
- zano:
- command: opt/Zano/Zano --data-dir $SNAP_USER_COMMON
- extensions:
- - kde-neon
- plugs:
- - network
- - home
- - desktop
- - opengl #for QML support
- - browser-support #for Qt WebEngine support
- - audio-playback
- - unity7 #for tray icon support
- simplewallet:
- command: opt/Zano/simplewallet
- plugs:
- - network
- - home
- zanod:
- command: opt/Zano/zanod --data-dir $SNAP_USER_COMMON
- environment:
- LC_ALL: C
- plugs:
- - network
- - network-bind
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6b5ff732..c1fd7910 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -78,7 +78,13 @@ if(BUILD_GUI)
endif()
list(FILTER QTDAEMON EXCLUDE REGEX "node_modules")
endif()
-
+# if(BUILD_GUI)
+# if(APPLE)
+# file(GLOB_RECURSE QTSERVER gui/*.cpp gui/*.h gui/*.mm)
+# else()
+# file(GLOB_RECURSE QTSERVER gui/*.cpp gui/*.h)
+# endif()
+#endif()
source_group(pch FILES ${PCH})
source_group(common FILES ${COMMON})
@@ -94,7 +100,7 @@ source_group(connectivity-tool FILES ${CONN_TOOL})
source_group(wallet FILES ${WALLET})
if(BUILD_GUI)
- source_group(qtdaemon FILES ${QTDAEMON})
+ source_group(qtserver FILES ${QTSERVER})
endif()
@@ -165,7 +171,7 @@ add_dependencies(daemon version)
target_link_libraries(daemon rpc stratum currency_core crypto common libminiupnpc-static zlibstatic ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
ENABLE_SHARED_PCH(daemon DAEMON)
ENABLE_SHARED_PCH_EXECUTABLE(daemon)
-
+
add_executable(connectivity_tool ${CONN_TOOL})
add_dependencies(connectivity_tool version)
target_link_libraries(connectivity_tool currency_core crypto common zlibstatic ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
@@ -173,7 +179,7 @@ ENABLE_SHARED_PCH(connectivity_tool CONN_TOOL)
ENABLE_SHARED_PCH_EXECUTABLE(connectivity_tool)
add_executable(simplewallet ${SIMPLEWALLET})
-add_dependencies(simplewallet version)
+add_dependencies(simplewallet version)
target_link_libraries(simplewallet wallet rpc currency_core crypto common zlibstatic ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
ENABLE_SHARED_PCH(simplewallet SIMPLEWALLET)
@@ -181,7 +187,8 @@ ENABLE_SHARED_PCH_EXECUTABLE(simplewallet)
set_property(TARGET common crypto currency_core rpc stratum wallet PROPERTY FOLDER "libs")
set_property(TARGET daemon simplewallet connectivity_tool PROPERTY FOLDER "prog")
-set_property(TARGET daemon PROPERTY OUTPUT_NAME "zanod")
+set_property(TARGET daemon PROPERTY OUTPUT_NAME "letheand")
+
if(BUILD_GUI)
@@ -189,57 +196,34 @@ if(BUILD_GUI)
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
endif()
+ set(AUTORCC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
- SET(MACOSX_BUNDLE_ICON_FILE app.icns)
- add_executable(Zano WIN32 MACOSX_BUNDLE ${QTDAEMON} )
- ENABLE_SHARED_PCH(Zano QTDAEMON)
- ENABLE_SHARED_PCH_EXECUTABLE(Zano)
-
- QT5_USE_MODULES(Zano WebEngineWidgets WebChannel)
+# SET(MACOSX_BUNDLE_ICON_FILE app.icns)
+ qt5_add_resources (RCC_SOURCES gui/resources/files.qrc)
+ add_executable(Lethean WIN32 MACOSX_BUNDLE ${QTSERVER} ${RCC_SOURCES} )
+ ENABLE_SHARED_PCH(Lethean QTSERVER)
+ ENABLE_SHARED_PCH_EXECUTABLE(Lethean)
+ set_property(TARGET Lethean PROPERTY OUTPUT_NAME "lethean-gui-server")
+
+ QT5_USE_MODULES(Lethean WebEngineWidgets WebChannel WebSockets)
find_package(Qt5PrintSupport REQUIRED)
- target_link_libraries(Zano wallet rpc currency_core crypto common zlibstatic ethash Qt5::WebEngineWidgets Qt5::PrintSupport ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
+ target_link_libraries(Lethean wallet rpc currency_core crypto common zlibstatic ethash Qt5::WebSockets Qt5::WebEngineWidgets Qt5::PrintSupport ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
if (UNIX AND NOT APPLE)
- target_link_libraries(Zano rt)
+ target_link_libraries(Lethean rt)
endif()
if(APPLE)
- target_link_libraries(Zano ${COCOA_LIBRARY})
- set_property(TARGET Zano PROPERTY XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES)
+ target_link_libraries(Lethean ${COCOA_LIBRARY})
+ set_property(TARGET Lethean PROPERTY XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES)
endif()
if(MSVC)
- target_link_libraries(Zano shlwapi.lib)
+ target_link_libraries(Lethean shlwapi.lib)
endif()
- set_property(TARGET Zano PROPERTY FOLDER "prog")
- set_target_properties(Zano PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/gui/qt-daemon/Info.plist.in)
-
- set(HTML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/gui/qt-daemon/layout/html)
- set_target_properties(Zano PROPERTIES VS_DEBUGGER_COMMAND_ARGUMENTS "--html-path=${HTML_DIR}")
+ set_property(TARGET Lethean PROPERTY FOLDER "prog")
set(CMAKE_AUTOMOC OFF)
- # GUI convenience "bundle"
- # set(GUI_DIR ${CMAKE_CURRENT_BINARY_DIR}/gui)
- # set_target_properties(Zano PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${GUI_DIR})
- # add_custom_command(TARGET Zano POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${HTML_DIR} ${GUI_DIR}/html)
-endif()
-
-if(APPLE)
- set(SIMPLE_BUNDLE 1)
-endif()
-
-if(SIMPLE_BUNDLE)
- set(INSTALL_DIR "${CMAKE_BINARY_DIR}/hp-${VERSION}")
- install(TARGETS daemon simplewallet connectivity_tool
- RUNTIME DESTINATION "${INSTALL_DIR}" COMPONENT Runtime
- )
-
- install(FILES ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} DESTINATION "${INSTALL_DIR}/lib")
-
- if(APPLE)
- set(FIXUP_COMMAND ${CMAKE_SOURCE_DIR}/utils/macosx_fixup.sh " " ${INSTALL_DIR})
- install(CODE "execute_process(COMMAND ${FIXUP_COMMAND})")
- endif()
endif()
diff --git a/src/common/command_line.cpp b/src/common/command_line.cpp
index a7b9a5ff..7e1fff1c 100644
--- a/src/common/command_line.cpp
+++ b/src/common/command_line.cpp
@@ -6,14 +6,14 @@
#include "command_line.h"
-#include "currency_core/currency_config.h"
+#include "currency_config.h"
namespace command_line
{
const arg_descriptor arg_help ("help", "Produce help message");
const arg_descriptor arg_version ("version", "Output version information");
const arg_descriptor arg_data_dir ("data-dir", "Specify data directory", "");
-
+
const arg_descriptor arg_stop_after_height ( "stop-after-height", "If specified, the daemon will stop immediately after a block with the given height is added", 0 );
const arg_descriptor arg_config_file ( "config-file", "Specify configuration file", std::string(CURRENCY_NAME_SHORT ".conf") );
diff --git a/src/common/db_backend_selector.cpp b/src/common/db_backend_selector.cpp
index 9c7917ca..efa759af 100644
--- a/src/common/db_backend_selector.cpp
+++ b/src/common/db_backend_selector.cpp
@@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "db_backend_selector.h"
-#include "currency_core/currency_config.h"
+#include "currency_config.h"
#include "command_line.h"
#include "db_backend_lmdb.h"
#include "db_backend_mdbx.h"
@@ -42,7 +42,7 @@ namespace db
m_engine_type = db_mdbx;
#else
LOG_PRINT_L0(" DB ENGINE: " << ARG_DB_ENGINE_MDBX << " is not suported by this build(see DISABLE_MDBX cmake option), STOPPING");
-#endif
+#endif
}
else
{
@@ -122,7 +122,7 @@ namespace db
std::string db_backend_selector::get_temp_config_folder() const
{
- return m_config_folder + "_TEMP";
+ return m_config_folder + "_TEMP";
}
diff --git a/src/common/general_purpose_commands_defs.h b/src/common/general_purpose_commands_defs.h
index f9da9968..9d00c668 100644
--- a/src/common/general_purpose_commands_defs.h
+++ b/src/common/general_purpose_commands_defs.h
@@ -16,11 +16,11 @@ namespace currency
struct tx_cost_struct
{
std::string usd_needed_for_erc20;
- std::string zano_needed_for_erc20;
+ std::string lethean_needed_for_erc20;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(usd_needed_for_erc20)
- KV_SERIALIZE(zano_needed_for_erc20)
+ KV_SERIALIZE(lethean_needed_for_erc20)
END_KV_SERIALIZE_MAP()
};
diff --git a/src/common/miniupnp_helper.h b/src/common/miniupnp_helper.h
index be7c688b..f779bed7 100644
--- a/src/common/miniupnp_helper.h
+++ b/src/common/miniupnp_helper.h
@@ -4,7 +4,7 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#pragma once
+#pragma once
#include
#include
@@ -17,7 +17,7 @@ extern "C" {
}
#include "misc_language.h"
-#include "currency_core/currency_config.h"
+#include "currency_config.h"
#include "version.h"
namespace tools
@@ -34,9 +34,9 @@ namespace tools
uint32_t m_external_port;
uint32_t m_internal_port;
uint32_t m_period_ms;
- public:
+ public:
miniupnp_helper():m_devlist(nullptr),
- m_urls(AUTO_VAL_INIT(m_urls)),
+ m_urls(AUTO_VAL_INIT(m_urls)),
m_data(AUTO_VAL_INIT(m_data)),
m_IGD(0),
m_external_port(0),
@@ -123,7 +123,7 @@ namespace tools
if(m_devlist)
{
- freeUPNPDevlist(m_devlist);
+ freeUPNPDevlist(m_devlist);
m_devlist = nullptr;
}
@@ -156,8 +156,8 @@ namespace tools
if(r!=UPNPCOMMAND_SUCCESS)
{
- LOG_PRINT_L1("AddPortMapping with external_port_str= " << external_port_str <<
- ", internal_port_str=" << internal_port_str <<
+ LOG_PRINT_L1("AddPortMapping with external_port_str= " << external_port_str <<
+ ", internal_port_str=" << internal_port_str <<
", failed with code=" << r << "(" << strupnperror(r) << ")");
}else
{
diff --git a/src/common/pre_download.h b/src/common/pre_download.h
index ec12df55..7f3746d5 100644
--- a/src/common/pre_download.h
+++ b/src/common/pre_download.h
@@ -21,8 +21,12 @@ namespace tools
};
#ifndef TESTNET
- static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.42.247/pre-download/zano_mdbx_95_2500000.pak", "8ffa2cb4213f4f96f97033c65a9e52bc350f683237808597784e79b24d5bfee7", 3242348793, 5905489920 };
- static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.42.247/pre-download/zano_lmdb_95_2500000.pak", "5509650e12c8f901e6731a2bfaf3abfd64409e3e1366d3d94cd11db8beddb0c3", 4239505801, 5893566464 };
+@todo bookmarking bootstrap file location
+ // static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.42.247/pre-download/zano_mdbx_95_1161000.pak", "26660ffcdaf80a43a586e64a1a6da042dcb9ff3b58e14ce1ec9a775b995dc146", 1330022593, 2684313600 };
+// static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.42.247/pre-download/zano_lmdb_95_1161000.pak", "9dd03f08dea396fe32e6483a8221b292be35fa41c29748f119f11c3275956cdc", 1787475468, 2600247296 };
+ static constexpr pre_download_entry c_pre_download_mdbx = { "", "", 0, 0 };
+ static constexpr pre_download_entry c_pre_download_lmdb = { "", "", 0, 0 };
+
#else
static constexpr pre_download_entry c_pre_download_mdbx = { "", "", 0, 0 };
static constexpr pre_download_entry c_pre_download_lmdb = { "", "", 0, 0 };
diff --git a/src/common/util.cpp b/src/common/util.cpp
index 1fdbe537..6fafd6cc 100644
--- a/src/common/util.cpp
+++ b/src/common/util.cpp
@@ -9,7 +9,7 @@
using namespace epee;
#include "util.h"
-#include "currency_core/currency_config.h"
+#include "currency_config.h"
#include "version.h"
#ifdef WIN32
@@ -18,7 +18,7 @@ using namespace epee;
#include
#include
#pragma comment(lib, "netapi32.lib")
-#else
+#else
#include
#endif
@@ -98,7 +98,7 @@ namespace tools
else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 0 && osver.wProductType != VER_NT_WORKSTATION) winver = "Windows Server 2008";
else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 0 && osver.wProductType == VER_NT_WORKSTATION) winver = "Windows Vista";
else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 2 && osver.wProductType == VER_NT_WORKSTATION
- && sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
+ && sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
winver = "Windows XP x64";
else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 2) winver = "Windows Server 2003";
else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 1) winver = "Windows XP";
@@ -166,13 +166,13 @@ namespace tools
// Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.
pGNSI = (PGNSI) GetProcAddress(
- GetModuleHandle(TEXT("kernel32.dll")),
+ GetModuleHandle(TEXT("kernel32.dll")),
"GetNativeSystemInfo");
if(NULL != pGNSI)
pGNSI(&si);
else GetSystemInfo(&si);
- if ( VER_PLATFORM_WIN32_NT==osvi.dwPlatformId &&
+ if ( VER_PLATFORM_WIN32_NT==osvi.dwPlatformId &&
osvi.dwMajorVersion > 4 )
{
StringCchCopy(pszOS, BUFSIZE, TEXT("Microsoft "));
@@ -196,7 +196,7 @@ namespace tools
}
pGPI = (PGPI) GetProcAddress(
- GetModuleHandle(TEXT("kernel32.dll")),
+ GetModuleHandle(TEXT("kernel32.dll")),
"GetProductInfo");
pGPI( osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
@@ -326,7 +326,7 @@ namespace tools
{
StringCchCat(pszOS, BUFSIZE, TEXT( "Professional" ));
}
- else
+ else
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
StringCchCat(pszOS, BUFSIZE, TEXT( "Datacenter Server" ));
@@ -357,10 +357,10 @@ namespace tools
StringCchCat(pszOS, BUFSIZE, TEXT(", 32-bit"));
}
- return pszOS;
+ return pszOS;
}
else
- {
+ {
printf( "This sample does not support this version of Windows.\n");
return pszOS;
}
@@ -386,7 +386,7 @@ namespace tools
if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE))
{
- // Create the minidump
+ // Create the minidump
MINIDUMP_EXCEPTION_INFORMATION mdei;
mdei.ThreadId = GetCurrentThreadId();
@@ -416,7 +416,7 @@ namespace tools
{
LOG_PRINT_L0("Minidump file created on path: " << path);
}
- // Close the file
+ // Close the file
CloseHandle(hFile);
}
else
@@ -483,9 +483,9 @@ std::string get_nix_version_display_string()
// Windows
#ifdef _M_X64
config_folder = get_special_folder_path_utf8(CSIDL_APPDATA, true) + "/" + CURRENCY_NAME_SHORT;
-#else
+#else
config_folder = get_special_folder_path_utf8(CSIDL_APPDATA, true) + "/" + CURRENCY_NAME_SHORT + "-x86";
-#endif
+#endif
#else
std::string pathRet;
char* pszHome = getenv("HOME");
@@ -517,7 +517,7 @@ std::string get_nix_version_display_string()
std::string get_default_user_dir()
{
//namespace fs = boost::filesystem;
- // Windows < Vista: C:\Documents and Settings\Username
+ // Windows < Vista: C:\Documents and Settings\Username
// Windows >= Vista: C:\Users\Username\AppData\Roaming\CURRENCY_NAME_SHORT
// Mac: ~/Library/Application Support/CURRENCY_NAME_SHORT
// Unix: ~/.CURRENCY_NAME_SHORT
@@ -691,8 +691,8 @@ std::string get_nix_version_display_string()
return true;
}
- //this code was taken from https://stackoverflow.com/a/8594696/5566653
- //credits goes to @nijansen: https://stackoverflow.com/users/1056003/nijansen
+ //this code was taken from https://stackoverflow.com/a/8594696/5566653
+ //credits goes to @nijansen: https://stackoverflow.com/users/1056003/nijansen
bool copy_dir( boost::filesystem::path const & source, boost::filesystem::path const & destination)
{
namespace fs = boost::filesystem;
diff --git a/src/crypto/range_proofs.h b/src/crypto/range_proofs.h
index 646f2908..ae000940 100644
--- a/src/crypto/range_proofs.h
+++ b/src/crypto/range_proofs.h
@@ -35,7 +35,7 @@ namespace crypto
return multiply_de_bruijn_bit_position[((uint32_t)((v & -(int32_t)v) * 0x077CB531U)) >> 27];
}
-
+
////////////////////////////////////////
// crypto trait for Zano
////////////////////////////////////////
@@ -78,7 +78,7 @@ namespace crypto
static const scalar_t& get_initial_transcript()
{
- static scalar_t value = hash_helper_t::hs("Zano BP+ initial transcript");
+ static scalar_t value = hash_helper_t::hs("Lethean BP+ initial transcript");
return value;
}
@@ -110,7 +110,7 @@ namespace crypto
static bool calculated = false;
if (!calculated)
{
- scalar_t hash_buf[2] = { hash_helper_t::hs("Zano BP+ generator"), 0 };
+ scalar_t hash_buf[2] = { hash_helper_t::hs("Lethean BP+ generator"), 0 };
for (size_t i = 0; i < 2 * c_bpp_mn_max; ++i)
{
hash_buf[1].m_u64[0] = i;
diff --git a/src/currency_core/currency_config.h b/src/currency_config.h
similarity index 82%
rename from src/currency_core/currency_config.h
rename to src/currency_config.h
index 50ca76a8..2d18e75b 100644
--- a/src/currency_core/currency_config.h
+++ b/src/currency_config.h
@@ -8,7 +8,7 @@
#ifndef TESTNET
-#define CURRENCY_FORMATION_VERSION 84
+#define CURRENCY_FORMATION_VERSION 1
#else
#define CURRENCY_FORMATION_VERSION 97
#endif
@@ -16,21 +16,20 @@
#define CURRENCY_GENESIS_NONCE (CURRENCY_FORMATION_VERSION + 101011010121) //bender's nightmare
-
+
#define CURRENCY_MAX_BLOCK_NUMBER 500000000
#define CURRENCY_MAX_BLOCK_SIZE 500000000 // block header blob limit, never used!
-#define CURRENCY_TX_MAX_ALLOWED_OUTS 2000
-#define CURRENCY_TX_MIN_ALLOWED_OUTS 2 // effective starting HF4 Zarcanum
-#define CURRENCY_PUBLIC_ADDRESS_BASE58_PREFIX 0xc5 // addresses start with 'Zx'
-#define CURRENCY_PUBLIC_INTEG_ADDRESS_BASE58_PREFIX 0x3678 // integrated addresses start with 'iZ'
-#define CURRENCY_PUBLIC_INTEG_ADDRESS_V2_BASE58_PREFIX 0x36f8 // integrated addresses start with 'iZ' (new format)
-#define CURRENCY_PUBLIC_AUDITABLE_ADDRESS_BASE58_PREFIX 0x98c8 // auditable addresses start with 'aZx'
-#define CURRENCY_PUBLIC_AUDITABLE_INTEG_ADDRESS_BASE58_PREFIX 0x8a49 // auditable integrated addresses start with 'aiZX'
+#define CURRENCY_TX_MAX_ALLOWED_OUTS 2 // effective starting HF4 Zarcanum
+#define CURRENCY_PUBLIC_ADDRESS_BASE58_PREFIX 0x73f7 // addresses start with 'iT'
+#define CURRENCY_PUBLIC_INTEG_ADDRESS_BASE58_PREFIX 0x6af7 // integrated addresses start with 'iTH'
+#define CURRENCY_PUBLIC_INTEG_ADDRESS_V2_BASE58_PREFIX 0x6af7 // integrated addresses start with 'iTH' (new format)
+#define CURRENCY_PUBLIC_AUDITABLE_ADDRESS_BASE58_PREFIX 0xdeaf7 // auditable addresses start with 'iTHn'
+#define CURRENCY_PUBLIC_AUDITABLE_INTEG_ADDRESS_BASE58_PREFIX 0x7eaf7 // auditable integrated addresses start with 'iTHa'
#define CURRENCY_MINED_MONEY_UNLOCK_WINDOW 10
#define CURRENT_TRANSACTION_VERSION 2
#define TRANSACTION_VERSION_INITAL 0
#define TRANSACTION_VERSION_PRE_HF4 1
-#define TRANSACTION_VERSION_POST_HF4 2
+#define TRANSACTION_VERSION_POST_HF4 2
#define HF1_BLOCK_MAJOR_VERSION 1
#define HF3_BLOCK_MAJOR_VERSION 2
#define HF3_BLOCK_MINOR_VERSION 0
@@ -53,17 +52,17 @@
#define CURRENCY_COINBASE_BLOB_RESERVED_SIZE 1100
#define CURRENCY_MAX_TRANSACTION_BLOB_SIZE (CURRENCY_BLOCK_GRANTED_FULL_REWARD_ZONE - CURRENCY_COINBASE_BLOB_RESERVED_SIZE*2)
#define CURRENCY_FREE_TX_MAX_BLOB_SIZE 1024 // soft txpool-based limit for free-of-charge txs (such as BC_OFFERS_SERVICE_INSTRUCTION_DEL)
-#define CURRENCY_DISPLAY_DECIMAL_POINT 12
+#define CURRENCY_DISPLAY_DECIMAL_POINT 8
// COIN - number of smallest units in one coin
-#define COIN ((uint64_t)1000000000000) // pow(10, CURRENCY_DISPLAY_DECIMAL_POINT)
+#define COIN ((uint64_t)100000000) // pow(8, CURRENCY_DISPLAY_DECIMAL_POINT)
#define BASE_REWARD_DUST_THRESHOLD ((uint64_t)1000000) // pow(10, 6) - change this will cause hard-fork!
#define DEFAULT_DUST_THRESHOLD ((uint64_t)0)
-#define TX_DEFAULT_FEE ((uint64_t)10000000000) // .01
-#define TX_MINIMUM_FEE ((uint64_t)10000000000) // .01
+#define TX_DEFAULT_FEE ((uint64_t)1000000) // .01
+#define TX_MINIMUM_FEE ((uint64_t)1000000) // .01
-#define CURRENCY_BLOCK_REWARD 1000000000000 // 1.0 coin == pow(10, CURRENCY_DISPLAY_DECIMAL_POINT)
+#define CURRENCY_BLOCK_REWARD 10000000 // 1.0 coin == pow(10, CURRENCY_DISPLAY_DECIMAL_POINT)
#define WALLET_MAX_ALLOWED_OUTPUT_AMOUNT ((uint64_t)0xffffffffffffffffLL)
@@ -93,7 +92,7 @@
#define MAX_ALIAS_PER_BLOCK 1000
#define ALIAS_COAST_PERIOD CURRENCY_BLOCKS_PER_DAY*7 //week
#define ALIAS_COAST_RECENT_PERIOD CURRENCY_BLOCKS_PER_DAY*8 //week + 1 day (we guarantee split depth at least 1 day)
-#define ALIAS_VERY_INITAL_COAST ((uint64_t)10000) // to avoid split when default fee changed
+#define ALIAS_VERY_INITAL_COAST ((uint64_t)1000000000) // to avoid split when default fee changed
#define ALIAS_MEDIAN_RECALC_INTERWAL CURRENCY_BLOCKS_PER_DAY
@@ -110,19 +109,23 @@
#ifndef TESTNET
-#define P2P_DEFAULT_PORT 11121
-#define RPC_DEFAULT_PORT 11211
-#define STRATUM_DEFAULT_PORT 11777
+#define SEED_NODE_HOST "mainnet.lethean.io"
+
+#define P2P_DEFAULT_PORT (36942 + CURRENCY_FORMATION_VERSION)
+#define RPC_DEFAULT_PORT 36942
+#define STRATUM_DEFAULT_PORT 36941
+#define STRARUM_DEFAULT_PORT 36941
#define P2P_NETWORK_ID_TESTNET_FLAG 0
#define P2P_MAINTAINERS_PUB_KEY "8f138bb73f6d663a3746a542770781a09579a7b84cb4125249e95530824ee607"
#define DIFFICULTY_POS_STARTER 1
-#else
-#define P2P_DEFAULT_PORT (11112 + CURRENCY_FORMATION_VERSION)
-#define RPC_DEFAULT_PORT 12111
-#define STRATUM_DEFAULT_PORT 11888
-#define STRARUM_DEFAULT_PORT 51113
+#else
+#define SEED_NODE_HOST "testnet.lethean.io"
+#define SEED_NODE_HOST2 "dev.lthn.network"
+#define P2P_DEFAULT_PORT 31122
+#define RPC_DEFAULT_PORT 31212
+#define STRATUM_DEFAULT_PORT 31778
#define P2P_NETWORK_ID_TESTNET_FLAG 1
-#define P2P_MAINTAINERS_PUB_KEY "aaa2d7aabc8d383fd53a3ae898697b28f236ceade6bafc1eecff413a6a02272a"
+#define P2P_MAINTAINERS_PUB_KEY "cc6076dd0ba1bdb1dd65c8aedcc4c15705d713060f33c4a12ce301eb86f4c684"
#define DIFFICULTY_POS_STARTER 1
#endif
@@ -190,19 +193,19 @@
-#define CURRENCY_NAME_ABR "ZANO"
-#define CURRENCY_NAME_BASE "Zano"
-#define CURRENCY_NAME_SHORT_BASE "Zano"
+#define CURRENCY_NAME_ABR "LTHN"
+#define CURRENCY_NAME_BASE "Lethean"
+#define CURRENCY_NAME_SHORT_BASE "Lethean"
#ifndef TESTNET
#define CURRENCY_NAME CURRENCY_NAME_BASE
#define CURRENCY_NAME_SHORT CURRENCY_NAME_SHORT_BASE
#else
-#define CURRENCY_NAME CURRENCY_NAME_BASE"_testnet"
-#define CURRENCY_NAME_SHORT CURRENCY_NAME_SHORT_BASE"_testnet"
+#define CURRENCY_NAME CURRENCY_NAME_BASE"_testnet3"
+#define CURRENCY_NAME_SHORT CURRENCY_NAME_SHORT_BASE"_testnet3"
#endif
//premine
-#define PREMINE_AMOUNT (17517203000000000000U) // 13827203.0 reserved for coinswap, 3690000.0 - premine
+#define PREMINE_AMOUNT (100000000000000U) // 50% of new emission max supply
//alias registration wallet
#define ALIAS_REWARDS_ACCOUNT_SPEND_PUB_KEY "0000000000000000000000000000000000000000000000000000000000000000" //burn alias money
@@ -210,7 +213,7 @@
#define ALIAS_REWARDS_ACCOUNT_VIEW_SEC_KEY "0000000000000000000000000000000000000000000000000000000000000000" //burn alias money
#define ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED 6
-#define ALIAS_SHORT_NAMES_VALIDATION_PUB_KEY "37947f7b6a5268c5d0a48bde73d7a426f0b5f24648f74024279540207dc70031"
+#define ALIAS_SHORT_NAMES_VALIDATION_PUB_KEY "fc5c69233067971ca4e55cbf21d5cc3fd947393945fa5c2041794a1e17f43c21"
#define ALIAS_NAME_MAX_LEN 255
@@ -252,7 +255,7 @@
#ifndef TESTNET
#define WALLET_FILE_SERIALIZATION_VERSION 163
#define WALLET_FILE_LAST_SUPPORTED_VERSION 163
-#else
+#else
#define WALLET_FILE_LAST_SUPPORTED_VERSION (CURRENCY_FORMATION_VERSION+76)
#define WALLET_FILE_SERIALIZATION_VERSION (CURRENCY_FORMATION_VERSION+76)
#endif
@@ -264,16 +267,13 @@
#define BLOCK_MINOR_VERSION_GENESIS 0
#define BLOCK_MAJOR_VERSION_INITIAL 0
#ifndef TESTNET
-#define ZANO_HARDFORK_01_AFTER_HEIGHT 194624 // 2019-09-21 20:25:16
-#define ZANO_HARDFORK_02_AFTER_HEIGHT 999999 // 2021-04-05 09:11:45
-#define ZANO_HARDFORK_03_AFTER_HEIGHT 1082577 // 2021-06-01 23:28:10
-#define ZANO_HARDFORK_04_AFTER_HEIGHT 2555000 // 2024-03-21 10:16:46 (expected)
+#define ZANO_HARDFORK_01_AFTER_HEIGHT 1
+#define ZANO_HARDFORK_02_AFTER_HEIGHT 2
+#define ZANO_HARDFORK_03_AFTER_HEIGHT 3
#else
-/////// Zarcanum Testnet //////////////////////////////
-#define ZANO_HARDFORK_01_AFTER_HEIGHT 0
-#define ZANO_HARDFORK_02_AFTER_HEIGHT 0
-#define ZANO_HARDFORK_03_AFTER_HEIGHT 0
-#define ZANO_HARDFORK_04_AFTER_HEIGHT 2440
+#define ZANO_HARDFORK_01_AFTER_HEIGHT 1
+#define ZANO_HARDFORK_02_AFTER_HEIGHT 2
+#define ZANO_HARDFORK_03_AFTER_HEIGHT 3
#endif
diff --git a/src/currency_core/basic_pow_helpers.cpp b/src/currency_core/basic_pow_helpers.cpp
index ddb87912..7becbf8a 100644
--- a/src/currency_core/basic_pow_helpers.cpp
+++ b/src/currency_core/basic_pow_helpers.cpp
@@ -11,7 +11,7 @@ using namespace epee;
#include "currency_format_utils.h"
#include "serialization/binary_utils.h"
#include "serialization/stl_containers.h"
-#include "currency_core/currency_config.h"
+#include "currency_config.h"
#include "crypto/crypto.h"
#include "crypto/hash.h"
#include "common/int-util.h"
@@ -99,4 +99,4 @@ namespace currency
get_block_longhash(b, p);
return p;
}
-}
\ No newline at end of file
+}
diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp
index 17ed1fbd..9dcdd9a1 100644
--- a/src/currency_core/blockchain_storage.cpp
+++ b/src/currency_core/blockchain_storage.cpp
@@ -22,7 +22,7 @@
#include "blockchain_storage.h"
#include "currency_format_utils.h"
#include "currency_boost_serialization.h"
-#include "currency_core/currency_config.h"
+#include "currency_config.h"
#include "miner.h"
#include "misc_language.h"
#include "profile_tools.h"
@@ -40,7 +40,7 @@
#include "crypto_config.h"
-#undef LOG_DEFAULT_CHANNEL
+#undef LOG_DEFAULT_CHANNEL
#define LOG_DEFAULT_CHANNEL "core"
ENABLE_CHANNEL_BY_DEFAULT("core");
@@ -72,7 +72,7 @@ using namespace currency;
DISABLE_VS_WARNINGS(4267)
-namespace
+namespace
{
const command_line::arg_descriptor arg_db_cache_l1 ( "db-cache-l1", "Specify size of memory mapped db cache file");
const command_line::arg_descriptor arg_db_cache_l2 ( "db-cache-l2", "Specify cached elements in db helpers");
@@ -89,7 +89,7 @@ blockchain_storage::blockchain_storage(tx_memory_pool& tx_pool) :m_db(nullptr, m
m_db_solo_options(m_db),
m_db_aliases(m_db),
m_db_assets(m_db),
- m_db_addr_to_alias(m_db),
+ m_db_addr_to_alias(m_db),
m_read_lock(m_rw_lock),
m_db_current_block_cumul_sz_limit(BLOCKCHAIN_STORAGE_OPTIONS_ID_CURRENT_BLOCK_CUMUL_SZ_LIMIT, m_db_solo_options),
m_db_current_pruned_rs_height(BLOCKCHAIN_STORAGE_OPTIONS_ID_CURRENT_PRUNED_RS_HEIGHT, m_db_solo_options),
@@ -97,19 +97,19 @@ blockchain_storage::blockchain_storage(tx_memory_pool& tx_pool) :m_db(nullptr, m
m_db_storage_major_compatibility_version(BLOCKCHAIN_STORAGE_OPTIONS_ID_STORAGE_MAJOR_COMPATIBILITY_VERSION, m_db_solo_options),
m_db_storage_minor_compatibility_version(BLOCKCHAIN_STORAGE_OPTIONS_ID_STORAGE_MINOR_COMPATIBILITY_VERSION, m_db_solo_options),
m_db_per_block_gindex_incs(m_db),
- m_tx_pool(tx_pool),
- m_is_in_checkpoint_zone(false),
- m_is_blockchain_storing(false),
+ m_tx_pool(tx_pool),
+ m_is_in_checkpoint_zone(false),
+ m_is_blockchain_storing(false),
m_core_runtime_config(get_default_core_runtime_config()),
//m_bei_stub(AUTO_VAL_INIT(m_bei_stub)),
- m_event_handler(&m_event_handler_stub),
- m_interprocess_locker_file(0),
- m_current_fee_median(0),
- m_current_fee_median_effective_index(0),
- m_is_reorganize_in_process(false),
- m_deinit_is_done(false),
- m_cached_next_pow_difficulty(0),
- m_cached_next_pos_difficulty(0),
+ m_event_handler(&m_event_handler_stub),
+ m_interprocess_locker_file(0),
+ m_current_fee_median(0),
+ m_current_fee_median_effective_index(0),
+ m_is_reorganize_in_process(false),
+ m_deinit_is_done(false),
+ m_cached_next_pow_difficulty(0),
+ m_cached_next_pos_difficulty(0),
m_blockchain_launch_timestamp(0)
@@ -145,7 +145,7 @@ std::shared_ptr blockchain_storage::get_tx(const crypto::hash &id)
auto it = m_db_transactions.find(id);
if (it == m_db_transactions.end())
return std::shared_ptr(nullptr);
-
+
return std::make_shared(it->tx);
}
//------------------------------------------------------------------
@@ -155,7 +155,7 @@ void blockchain_storage::init_options(boost::program_options::options_descriptio
command_line::add_arg(desc, arg_db_cache_l2);
}
//------------------------------------------------------------------
-uint64_t blockchain_storage::get_block_h_older_then(uint64_t timestamp) const
+uint64_t blockchain_storage::get_block_h_older_then(uint64_t timestamp) const
{
// get avarage block position
uint64_t last_block_timestamp = m_db_blocks.back()->bl.timestamp;
@@ -217,7 +217,7 @@ bool blockchain_storage::init(const std::string& config_folder, const boost::pro
}
m_db.reset_backend(p_backend);
LOG_PRINT_L0("DB ENGINE USED BY CORE: " << m_db.get_backend()->name());
-
+
if (!validate_instance(config_folder))
{
LOG_ERROR("Failed to initialize instance");
@@ -315,7 +315,7 @@ bool blockchain_storage::init(const std::string& config_folder, const boost::pro
aliases_container_old db_aliases_old(m_db);
res = db_aliases_old.init(BLOCKCHAIN_STORAGE_CONTAINER_ALIASES);
CHECK_AND_ASSERT_MES(res, false, "Unable to init db_aliases_old");
-
+
typedef tools::db::cached_key_value_accessor, true, false> address_to_aliases_container_old;
address_to_aliases_container_old db_addr_to_alias_old(m_db);
res = db_addr_to_alias_old.init(BLOCKCHAIN_STORAGE_CONTAINER_ADDR_TO_ALIAS);
@@ -352,7 +352,7 @@ bool blockchain_storage::init(const std::string& config_folder, const boost::pro
m_db.commit_transaction();
db_aliases_old.deinit();
db_addr_to_alias_old.deinit();
-
+
res = m_db_aliases.init(BLOCKCHAIN_STORAGE_CONTAINER_ALIASES);
CHECK_AND_ASSERT_MES(res, false, "Unable to init m_db_aliases");
res = m_db_addr_to_alias.init(BLOCKCHAIN_STORAGE_CONTAINER_ADDR_TO_ALIAS);
@@ -390,11 +390,11 @@ bool blockchain_storage::init(const std::string& config_folder, const boost::pro
else if (m_db_storage_major_compatibility_version != BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION)
{
need_reinit = true;
- LOG_PRINT_MAGENTA("DB storage needs reinit because it has major compatibility ver " << m_db_storage_major_compatibility_version << ", expected : " << BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION, LOG_LEVEL_0);
+ LOG_PRINT_MAGENTA("DB storage needs reinit because it has major compatibility ver " << m_db_storage_major_compatibility_version << ", expected : " << BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION, LOG_LEVEL_0);
}
else if (m_db_storage_minor_compatibility_version > BLOCKCHAIN_STORAGE_MINOR_COMPATIBILITY_VERSION)
{
- // reinit db only if minor version in the DB is greather (i.e. newer) than minor version in the code
+ // reinit db only if minor version in the DB is greather (i.e. newer) than minor version in the code
need_reinit = true;
LOG_PRINT_MAGENTA("DB storage needs reinit because it has minor compatibility ver " << m_db_storage_minor_compatibility_version << " that is greater than BLOCKCHAIN_STORAGE_MINOR_COMPATIBILITY_VERSION: " << BLOCKCHAIN_STORAGE_MINOR_COMPATIBILITY_VERSION, LOG_LEVEL_0);
}
@@ -437,7 +437,7 @@ bool blockchain_storage::init(const std::string& config_folder, const boost::pro
add_new_block(bl, bvc);
CHECK_AND_ASSERT_MES(!bvc.m_verification_failed, false, "Failed to add genesis block to blockchain");
LOG_PRINT_MAGENTA("Storage initialized with genesis", LOG_LEVEL_0);
- }
+ }
store_db_solo_options_values();
@@ -452,7 +452,7 @@ bool blockchain_storage::init(const std::string& config_folder, const boost::pro
set_lost_tx_unmixable();
m_db.commit_transaction();
- LOG_PRINT_GREEN("Blockchain initialized. (v:" << m_db_storage_major_compatibility_version << ") last block: " << m_db_blocks.size() - 1 << ENDL
+ LOG_PRINT_GREEN("Blockchain initialized. (v:" << m_db_storage_major_compatibility_version << ") last block: " << m_db_blocks.size() - 1 << ENDL
<< "genesis: " << get_block_hash(m_db_blocks[0]->bl) << ENDL
<< "last block: " << m_db_blocks.size() - 1 << ", " << misc_utils::get_time_interval_string(timestamp_diff) << " time ago" << ENDL
<< "current pos difficulty: " << get_next_diff_conditional(true) << ENDL
@@ -468,19 +468,19 @@ bool blockchain_storage::set_lost_tx_unmixable_for_height(uint64_t height)
{
#ifndef TESTNET
if (height == 75738)
- return set_lost_tx_unmixable();
+ return set_lost_tx_unmixable();
#endif
return true;
}
//------------------------------------------------------------------
bool blockchain_storage::set_lost_tx_unmixable()
-{
+{
#ifndef TESTNET
if (m_db_blocks.size() > 75738)
{
crypto::hash tx_id_1 = epee::string_tools::parse_tpod_from_hex_string("c2a2229d614e7c026433efbcfdbd0be1f68d9b419220336df3e2c209f5d57314");
crypto::hash tx_id_2 = epee::string_tools::parse_tpod_from_hex_string("647f936c6ffbd136f5c95d9a90ad554bdb4c01541c6eb5755ad40b984d80da67");
-
+
auto tx_ptr_1 = m_db_transactions.find(tx_id_1);
CHECK_AND_ASSERT_MES(tx_ptr_1, false, "Internal error: filed to find lost tx");
transaction_chain_entry tx1_local_entry(*tx_ptr_1);
@@ -503,7 +503,7 @@ bool blockchain_storage::set_lost_tx_unmixable()
return true;
}
//------------------------------------------------------------------
-void blockchain_storage::patch_out_if_needed(txout_to_key& out, const crypto::hash& tx_id, uint64_t n) const
+void blockchain_storage::patch_out_if_needed(txout_to_key& out, const crypto::hash& tx_id, uint64_t n) const
{
#ifndef TESTNET
static crypto::hash tx_id_1 = epee::string_tools::parse_tpod_from_hex_string("c2a2229d614e7c026433efbcfdbd0be1f68d9b419220336df3e2c209f5d57314");
@@ -562,7 +562,7 @@ bool blockchain_storage::pop_block_from_blockchain(transactions_map& onboard_tra
return true;
}
//------------------------------------------------------------------
-bool blockchain_storage::set_checkpoints(checkpoints&& chk_pts)
+bool blockchain_storage::set_checkpoints(checkpoints&& chk_pts)
{
m_checkpoints = chk_pts;
try
@@ -586,7 +586,7 @@ bool blockchain_storage::set_checkpoints(checkpoints&& chk_pts)
LOG_ERROR("UNKNOWN EXCEPTION WHILE SETTING CHECKPOINTS.");
return false;
}
-
+
}
//------------------------------------------------------------------
bool blockchain_storage::prune_ring_signatures_and_attachments(uint64_t height, uint64_t& transactions_pruned, uint64_t& signatures_pruned, uint64_t& attachments_pruned)
@@ -600,17 +600,17 @@ bool blockchain_storage::prune_ring_signatures_and_attachments(uint64_t height,
for (const auto& h : vptr->bl.tx_hashes)
{
auto it = m_db_transactions.find(h);
- CHECK_AND_ASSERT_MES(it != m_db_transactions.end(), false, "failed to find transaction " << h << " in blockchain index, in block on height = " << height);
+ CHECK_AND_ASSERT_MES(it != m_db_transactions.end(), false, "failed to find transaction " << h << " in blockchain index, in block on height = " << height);
- CHECK_AND_ASSERT_MES(it->m_keeper_block_height == height, false,
- "failed to validate extra check, it->second.m_keeper_block_height = " << it->m_keeper_block_height <<
+ CHECK_AND_ASSERT_MES(it->m_keeper_block_height == height, false,
+ "failed to validate extra check, it->second.m_keeper_block_height = " << it->m_keeper_block_height <<
"is mot equal to height = " << height << " in blockchain index, for block on height = " << height);
-
+
transaction_chain_entry lolcal_chain_entry = *it;
signatures_pruned = lolcal_chain_entry.tx.signatures.size();
lolcal_chain_entry.tx.signatures.clear();
-
+
attachments_pruned += lolcal_chain_entry.tx.attachment.size();
lolcal_chain_entry.tx.attachment.clear();
@@ -665,7 +665,7 @@ bool blockchain_storage::clear()
m_pow_targetdata_cache.clear();
m_db.commit_transaction();
-
+
{
CRITICAL_REGION_LOCAL(m_invalid_blocks_lock);
@@ -677,8 +677,8 @@ bool blockchain_storage::clear()
m_altblocks_keyimages.clear();
m_alternative_chains_txs.clear();
}
-
-
+
+
return true;
}
//------------------------------------------------------------------
@@ -707,7 +707,7 @@ bool blockchain_storage::purge_transaction_keyimages_from_blockchain(const trans
bool m_strict_check;
purge_transaction_visitor(blockchain_storage& bcs, key_images_container& spent_keys, bool strict_check):
m_bcs(bcs),
- m_spent_keys(spent_keys),
+ m_spent_keys(spent_keys),
m_strict_check(strict_check)
{}
bool process_input(const crypto::key_image& k_image, const std::vector& key_offsets, uint64_t amount) const
@@ -775,10 +775,10 @@ bool blockchain_storage::purge_transaction_from_blockchain(const crypto::hash& t
fee = get_tx_fee(tx_res_ptr->tx);
purge_transaction_keyimages_from_blockchain(tx, true);
-
+
bool r = unprocess_blockchain_tx_extra(tx);
CHECK_AND_ASSERT_MES(r, false, "failed to unprocess_blockchain_tx_extra for tx " << tx_id);
-
+
r = unprocess_blockchain_tx_attachments(tx, get_current_blockchain_size(), 0/*TODO: add valid timestamp here in future if need*/);
bool added_to_the_pool = false;
@@ -901,7 +901,7 @@ bool blockchain_storage::get_block_by_hash(const crypto::hash &h, block &blk) c
// try to find block in main chain
auto it = m_db_blocks_index.find(h);
- if (m_db_blocks_index.end() != it)
+ if (m_db_blocks_index.end() != it)
{
blk = m_db_blocks[*it]->bl;
return true;
@@ -911,7 +911,7 @@ bool blockchain_storage::get_block_by_hash(const crypto::hash &h, block &blk) c
CRITICAL_REGION_LOCAL1(m_alternative_chains_lock);
auto it_alt = m_alternative_chains.find(h);
- if (m_alternative_chains.end() != it_alt)
+ if (m_alternative_chains.end() != it_alt)
{
blk = it_alt->second.bl;
return true;
@@ -941,7 +941,7 @@ bool blockchain_storage::get_block_extended_info_by_hash(const crypto::hash &h,
// try to find block in alternative chain
CRITICAL_REGION_LOCAL1(m_alternative_chains_lock);
auto it_alt = m_alternative_chains.find(h);
- if (m_alternative_chains.end() != it_alt)
+ if (m_alternative_chains.end() != it_alt)
{
blk = it_alt->second;
return true;
@@ -956,7 +956,7 @@ bool blockchain_storage::get_block_extended_info_by_height(uint64_t h, block_ext
if (h >= m_db_blocks.size())
return false;
-
+
blk = *m_db_blocks[h];
return true;
}
@@ -973,16 +973,16 @@ bool blockchain_storage::get_block_by_height(uint64_t h, block &blk) const
// void blockchain_storage::get_all_known_block_ids(std::list &main, std::list &alt, std::list &invalid) const
// {
// CRITICAL_REGION_LOCAL(m_blockchain_lock);
-//
+//
// for (auto &v : m_blocks_index)
// main.push_back(v.first);
-//
+//
// for (auto &v : m_alternative_chains)
// alt.push_back(v.first);
-//
+//
// for(auto &v: m_invalid_blocks)
// invalid.push_back(v.first);
-// }
+// }
//------------------------------------------------------------------
bool blockchain_storage::rollback_blockchain_switching(std::list& original_chain, size_t rollback_height)
{
@@ -1072,7 +1072,7 @@ bool blockchain_storage::switch_to_alternative_blockchain(alt_chain_type& alt_ch
bwt.b = m_db_blocks[i]->bl;
bool r = pop_block_from_blockchain(bwt.onboard_transactions);
CHECK_AND_ASSERT_MES(r, false, "failed to remove block " << get_block_hash(bwt.b) << " @ " << get_block_height(bwt.b) << " on chain switching");
-
+
CHECK_AND_ASSERT_MES(validate_blockchain_prev_links(), false, "EPIC FAIL!");
}
@@ -1111,9 +1111,9 @@ bool blockchain_storage::switch_to_alternative_blockchain(alt_chain_type& alt_ch
rollback_blockchain_switching(disconnected_chain, split_height);
CHECK_AND_ASSERT_MES(validate_blockchain_prev_links(), false, "EPIC FAIL!");
- //can't do return false here, because of the risc to get stuck in "PANIC" mode when nor of
+ //can't do return false here, because of the risc to get stuck in "PANIC" mode when nor of
//new chain nor altchain can be inserted into main chain. Got core caught in this trap when
- //when machine time was wrongly set for a few hours back, then blocks which was detached from main chain
+ //when machine time was wrongly set for a few hours back, then blocks which was detached from main chain
//couldn't be added as alternative due to timestamps validation(timestamps assumed as from future)
//thanks @Gigabyted for reporting this problem
LOG_PRINT("REORGANIZE FAILED because ex-main block wasn't added as alt, but we pretend it was successfull (see also comments in sources)", LOG_LEVEL_0);
@@ -1165,7 +1165,7 @@ wide_difficulty_type blockchain_storage::get_next_diff_conditional(bool pos) con
{
dif = next_difficulty_1(timestamps, commulative_difficulties, pos ? global_difficulty_pos_target : global_difficulty_pow_target, pos ? global_difficulty_pos_starter : global_difficulty_pow_starter);
}
-
+
TIME_MEASURE_FINISH_PD(target_calculating_calc);
return dif;
@@ -1257,7 +1257,7 @@ wide_difficulty_type blockchain_storage::get_next_difficulty_for_alternative_cha
timestamps.push_back(m_db_blocks[i]->bl.timestamp);
commulative_difficulties.push_back(m_db_blocks[i]->cumulative_diff_precise);
- }
+ }
return next_difficulty_1(timestamps, commulative_difficulties, pos ? DIFFICULTY_POS_TARGET:DIFFICULTY_POW_TARGET, pos ? global_difficulty_pos_starter : global_difficulty_pow_starter);
}
@@ -1328,10 +1328,10 @@ bool blockchain_storage::prevalidate_miner_transaction(const block& b, uint64_t
return true;
}
//------------------------------------------------------------------
-bool blockchain_storage::validate_miner_transaction(const block& b,
- size_t cumulative_block_size,
- uint64_t fee,
- uint64_t& base_reward,
+bool blockchain_storage::validate_miner_transaction(const block& b,
+ size_t cumulative_block_size,
+ uint64_t fee,
+ uint64_t& base_reward,
const boost::multiprecision::uint128_t& already_generated_coins) const
{
CRITICAL_REGION_LOCAL(m_read_lock);
@@ -1378,7 +1378,7 @@ bool blockchain_storage::validate_miner_transaction(const block& b,
blockchain_storage::performnce_data& blockchain_storage::get_performnce_data()const
{
m_db.get_backend()->get_stat_info(m_performance_data.si);
- return m_performance_data;
+ return m_performance_data;
}
//------------------------------------------------------------------
bool blockchain_storage::get_backward_blocks_sizes(size_t from_height, std::vector& sz, size_t count)const
@@ -1410,7 +1410,7 @@ uint64_t blockchain_storage::get_current_comulative_blocksize_limit() const
bool blockchain_storage::create_block_template(const account_public_address& miner_address,
const blobdata& ex_nonce,
block& b,
- wide_difficulty_type& diffic,
+ wide_difficulty_type& diffic,
uint64_t& height) const
{
return create_block_template(miner_address, miner_address, ex_nonce, false, pos_entry(), nullptr, b, diffic, height);
@@ -1447,11 +1447,11 @@ bool blockchain_storage::create_block_template(const account_public_address& min
bool blockchain_storage::create_block_template(const create_block_template_params& params, create_block_template_response& resp) const
{
- const account_public_address& miner_address = params.miner_address;
+ const account_public_address& miner_address = params.miner_address;
const account_public_address& stakeholder_address = params.stakeholder_address;
const blobdata& ex_nonce = params.ex_nonce;
bool pos = params.pos;
- pos_entry pe = params.pe;
+ pos_entry pe = params.pe;
fill_block_template_func_t* pcustom_fill_block_template_func = params.pcustom_fill_block_template_func;
@@ -1472,7 +1472,7 @@ bool blockchain_storage::create_block_template(const create_block_template_param
}
pe.g_index = indexs[pe.tx_out_index];
}
-
+
height = m_db_blocks.size();
b.major_version = m_core_runtime_config.hard_forks.get_block_major_version_by_height(height);
@@ -1493,7 +1493,7 @@ bool blockchain_storage::create_block_template(const create_block_template_param
CHECK_AND_ASSERT_MES(diffic, false, "difficulty owverhead.");
-
+
median_size = m_db_current_block_cumul_sz_limit / 2;
already_generated_coins = m_db_blocks.back()->already_generated_coins;
@@ -1513,33 +1513,33 @@ bool blockchain_storage::create_block_template(const create_block_template_param
resp.txs_fee = fee;
- /*
+ /*
instead of complicated two-phase template construction and adjustment of cumulative size with block reward we
use CURRENCY_COINBASE_BLOB_RESERVED_SIZE as penalty-free coinbase transaction reservation.
*/
- bool r = construct_miner_tx(height, median_size, already_generated_coins,
- txs_size,
- fee,
- miner_address,
+ bool r = construct_miner_tx(height, median_size, already_generated_coins,
+ txs_size,
+ fee,
+ miner_address,
stakeholder_address,
b.miner_tx,
resp.block_reward_without_fee,
resp.block_reward,
get_tx_version(height, m_core_runtime_config.hard_forks),
- ex_nonce,
- CURRENCY_MINER_TX_MAX_OUTS,
+ ex_nonce,
+ CURRENCY_MINER_TX_MAX_OUTS,
pos,
pe,
&resp.miner_tx_tgc);
CHECK_AND_ASSERT_MES(r, false, "Failed to construc miner tx, first chance");
uint64_t coinbase_size = get_object_blobsize(b.miner_tx);
// "- 100" - to reserve room for PoS additions into miner tx
- CHECK_AND_ASSERT_MES(coinbase_size < CURRENCY_COINBASE_BLOB_RESERVED_SIZE - 100, false, "Failed to get block template (coinbase_size = " << coinbase_size << ") << coinbase structue: "
+ CHECK_AND_ASSERT_MES(coinbase_size < CURRENCY_COINBASE_BLOB_RESERVED_SIZE - 100, false, "Failed to get block template (coinbase_size = " << coinbase_size << ") << coinbase structue: "
<< ENDL << obj_to_json_str(b.miner_tx));
return true;
}
//------------------------------------------------------------------
-bool blockchain_storage::print_transactions_statistics() const
+bool blockchain_storage::print_transactions_statistics() const
{
LOG_ERROR("print_transactions_statistics not implemented yet");
// CRITICAL_REGION_LOCAL(m_blockchain_lock);
@@ -1559,11 +1559,11 @@ bool blockchain_storage::print_transactions_statistics() const
// transaction tx = tx_entry.second.tx;
// signatures.clear();
// total_cropped_blob += get_object_blobsize(tx);
-// }
+// }
// }
// LOG_PRINT_L0("Done" << ENDL
-// << "total transactions: " << total_count << ENDL
-// << "coinbase transactions: " << coinbase_count << ENDL
+// << "total transactions: " << total_count << ENDL
+// << "coinbase transactions: " << coinbase_count << ENDL
// << "avarage size of transaction: " << total_full_blob/(total_count-coinbase_count) << ENDL
// << "avarage size of transaction without ring signatures: " << total_cropped_blob/(total_count-coinbase_count) << ENDL
// );
@@ -1625,16 +1625,16 @@ bool blockchain_storage::append_altblock_keyimages_to_big_heap(const crypto::has
{
for (auto& ki : alt_block_keyimages)
m_altblocks_keyimages[ki].push_back(block_id);
-
+
return true;
}
//------------------------------------------------------------------
bool blockchain_storage::purge_keyimage_from_big_heap(const crypto::key_image& ki, const crypto::hash& id)
{
auto it = m_altblocks_keyimages.find(ki);
- CHECK_AND_ASSERT_MES(it != m_altblocks_keyimages.end(), false, "internal error: keyimage " << ki
+ CHECK_AND_ASSERT_MES(it != m_altblocks_keyimages.end(), false, "internal error: keyimage " << ki
<< "from altblock " << id << "not found in m_altblocks_keyimages in purge_keyimage_from_big_heap");
-
+
//TODO: at the moment here is simple liner algo since having the same txs in few altblocks is rare case
std::list& ki_blocks_ids = it->second;
bool found = false;
@@ -1772,7 +1772,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
bool r = m_tx_pool.get_transaction(h, tx);
if (!r)
{
- //transaction could be in main chain
+ //transaction could be in main chain
auto tx_ptr = m_db_transactions.find(h);
if (!tx_ptr)
{
@@ -1825,8 +1825,9 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
// PoW / PoS validation (heavy checks)
wide_difficulty_type current_diff = get_next_diff_conditional2(pos_block, alt_chain, connection_height, abei);
+
CHECK_AND_ASSERT_MES_CUSTOM(current_diff, false, bvc.m_verification_failed = true, "!!!!!!! DIFFICULTY OVERHEAD !!!!!!!");
-
+
crypto::hash proof_of_work = null_hash;
uint64_t pos_amount = 0;
wide_difficulty_type pos_diff_final = 0;
@@ -1835,7 +1836,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
//POS
bool res = validate_pos_block(abei.bl, current_diff, pos_amount, pos_diff_final, abei.stake_hash, id, true, alt_chain, connection_height);
CHECK_AND_ASSERT_MES_CUSTOM(res, false, bvc.m_verification_failed = true, "Failed to validate_pos_block on alternative block, height = "
- << abei.height
+ << abei.height
<< ", block id: " << get_block_hash(abei.bl));
}
else
@@ -1865,7 +1866,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
abei.difficulty = current_diff;
wide_difficulty_type cumulative_diff_delta = 0;
abei.cumulative_diff_adjusted = alt_chain.size() ? it_prev->second.cumulative_diff_adjusted : m_db_blocks[*ptr_main_prev]->cumulative_diff_adjusted;
-
+
if (pos_block)
cumulative_diff_delta = get_adjusted_cumulative_difficulty_for_next_alt_pos(alt_chain, abei.height, current_diff, connection_height);
else
@@ -1890,7 +1891,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
wide_difficulty_type diff_precise_adj = correct_difficulty_with_sequence_factor(sequence_factor, current_diff);
abei.cumulative_diff_precise_adjusted = last_x_cumul_dif_precise_adj + diff_precise_adj;
-
+
//////////////////////////////////////////////////////////////////////////
#ifdef _DEBUG
@@ -1918,7 +1919,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
ss_pow_pos_info << "PoW:\t" << proof_of_work;
proof = proof_of_work;
}
-
+
LOG_PRINT_BLUE("----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT " << abei.height << (pos_block ? " [PoS] Sq: " : " [PoW] Sq: ") << sequence_factor << ", altchain sz: " << alt_chain.size() << ", split h: " << connection_height
<< ENDL << "id:\t" << id
<< ENDL << "prev\t" << abei.bl.prev_id
@@ -1935,9 +1936,9 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
LOG_PRINT_GREEN("###### REORGANIZE on height: " << alt_chain.front()->second.height << " of " << m_db_blocks.size() - 1 << " with cumulative_diff_adjusted " << m_db_blocks.back()->cumulative_diff_adjusted
<< ENDL << " alternative blockchain size: " << alt_chain.size() << " with cumulative_diff_adjusted " << abei.cumulative_diff_adjusted, LOG_LEVEL_0);
bool r = switch_to_alternative_blockchain(alt_chain);
- if(r)
+ if(r)
bvc.m_added_to_main_chain = true;
- else
+ else
bvc.m_verification_failed = true;
return r;
}
@@ -1966,7 +1967,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
LOG_PRINT_RED_L0("Block recognized as orphaned and rejected, id = " << id << "," << ENDL << "parent id = " << b.prev_id << ENDL << "height = " << coinbase_height);
}
}
-
+
CHECK_AND_ASSERT_MES(validate_blockchain_prev_links(), false, "EPIC FAIL!");
return true;
CATCH_ENTRY_CUSTOM("blockchain_storage::handle_alternative_block", bvc.m_verification_failed = true, false);
@@ -1996,7 +1997,7 @@ wide_difficulty_type blockchain_storage::get_x_difficulty_after_height(uint64_t
//------------------------------------------------------------------
bool blockchain_storage::is_reorganize_required(const block_extended_info& main_chain_bei, const alt_chain_type& alt_chain, const crypto::hash& proof_alt)
{
- //alt_chain - back is latest(top), first - connection with main chain
+ //alt_chain - back is latest(top), first - connection with main chain
const block_extended_info& alt_chain_bei = alt_chain.back()->second;
const block_extended_info& connection_point = alt_chain.front()->second;
@@ -2012,7 +2013,7 @@ bool blockchain_storage::is_reorganize_required(const block_extended_info& main_
if (!is_pos_block(main_chain_bei.bl))
return false; // do not reorganize on the same cummul diff if it's a PoW block
- //in case of simultaneous PoS blocks are happened on the same height (quite common for PoS)
+ //in case of simultaneous PoS blocks are happened on the same height (quite common for PoS)
//we also try to weight them to guarantee consensus in network
if (std::memcmp(&main_chain_bei.stake_hash, &proof_alt, sizeof(main_chain_bei.stake_hash)) >= 0)
return false;
@@ -2036,7 +2037,7 @@ bool blockchain_storage::is_reorganize_required(const block_extended_info& main_
wide_difficulty_type alt_pos_diff_end = get_last_alt_x_block_cumulative_precise_adj_difficulty(alt_chain, alt_chain_bei.height, true);
wide_difficulty_type alt_pos_diff_begin = get_last_alt_x_block_cumulative_precise_adj_difficulty(alt_chain_type(), connection_point.height-1, true);
alt_cumul_diff.pos_diff = alt_pos_diff_end - alt_pos_diff_begin;
-
+
wide_difficulty_type alt_pow_diff_end = get_last_alt_x_block_cumulative_precise_adj_difficulty(alt_chain, alt_chain_bei.height, false);
wide_difficulty_type alt_pow_diff_begin = get_last_alt_x_block_cumulative_precise_adj_difficulty(alt_chain_type(), connection_point.height - 1, false);
alt_cumul_diff.pow_diff = alt_pow_diff_end - alt_pow_diff_begin;
@@ -2061,7 +2062,7 @@ bool blockchain_storage::is_reorganize_required(const block_extended_info& main_
alt = get_a_to_b_relative_cumulative_difficulty(difficulty_pos_at_split_point, difficulty_pow_at_split_point, alt_cumul_diff, main_cumul_diff);
main = get_a_to_b_relative_cumulative_difficulty(difficulty_pos_at_split_point, difficulty_pow_at_split_point, main_cumul_diff, alt_cumul_diff);
}
- LOG_PRINT_L1("[FORK_CHOICE]: " << ENDL
+ LOG_PRINT_L1("[FORK_CHOICE]: " << ENDL
<< "difficulty_pow_at_split_point:" << difficulty_pow_at_split_point << ENDL
<< "difficulty_pos_at_split_point:" << difficulty_pos_at_split_point << ENDL
<< "alt_cumul_diff.pow_diff:" << alt_cumul_diff.pow_diff << ENDL
@@ -2081,8 +2082,8 @@ bool blockchain_storage::is_reorganize_required(const block_extended_info& main_
{
// prefer blocks with more summary fee(to motivate stakers include transactions)
- // since we don't have "summary block fee" field yet, we can use this_block_tx_fee_median multiplied to transactions
- // count as an indirect measure of sumarry paid fee. If this approach won't be doing it's job it's subject
+ // since we don't have "summary block fee" field yet, we can use this_block_tx_fee_median multiplied to transactions
+ // count as an indirect measure of sumarry paid fee. If this approach won't be doing it's job it's subject
// to reconsider and introducing additional field in block_extended_info structure
if (alt_chain_bei.this_block_tx_fee_median * alt_chain_bei.bl.tx_hashes.size() >
@@ -2095,7 +2096,7 @@ bool blockchain_storage::is_reorganize_required(const block_extended_info& main_
if (!is_pos_block(main_chain_bei.bl))
return false; // do not reorganize on the same cummul diff if it's a PoW block
- //in case of simultaneous PoS blocks are happened on the same height (quite common for PoS)
+ //in case of simultaneous PoS blocks are happened on the same height (quite common for PoS)
//we also try to weight them to guarantee consensus in network
if (std::memcmp(&main_chain_bei.stake_hash, &proof_alt, sizeof(main_chain_bei.stake_hash)) >= 0)
return false;
@@ -2111,7 +2112,7 @@ bool blockchain_storage::is_reorganize_required(const block_extended_info& main_
}
//------------------------------------------------------------------
-bool blockchain_storage::pre_validate_relayed_block(block& bl, block_verification_context& bvc, const crypto::hash& id)const
+bool blockchain_storage::pre_validate_relayed_block(block& bl, block_verification_context& bvc, const crypto::hash& id)const
{
CRITICAL_REGION_LOCAL(m_read_lock);
if (!(bl.prev_id == get_top_block_id()))
@@ -2134,7 +2135,7 @@ bool blockchain_storage::pre_validate_relayed_block(block& bl, block_verificatio
bvc.m_added_to_main_chain = true;
}
else
- {
+ {
proof_hash = get_block_longhash(bl); //get_block_longhash(bl);
if (!check_hash(proof_hash, current_diffic))
@@ -2175,7 +2176,7 @@ bool blockchain_storage::get_tx_rpc_details(const crypto::hash& h, tx_rpc_extend
tei.keeper_block = -1; // tx is not confirmed yet, probably it's in the pool
return false;
}
-
+
if (tx_ptr && !timestamp)
{
@@ -2316,7 +2317,7 @@ bool blockchain_storage::get_alt_blocks_rpc_details(uint64_t start_offset, uint6
// erase blocks from 0 till start_offset-1
blocks_its.erase(blocks_its.begin(), blocks_its.begin() + start_offset);
-
+
// erase the tail
blocks_its.erase(blocks_its.begin() + count, blocks_its.end());
@@ -2386,7 +2387,7 @@ bool blockchain_storage::get_main_blocks_rpc_details(uint64_t start_offset, size
return true;
}
//------------------------------------------------------------------
-bool blockchain_storage::get_blocks(uint64_t start_offset, size_t count, std::list& blocks)const
+bool blockchain_storage::get_blocks(uint64_t start_offset, size_t count, std::list& blocks)const
{
CRITICAL_REGION_LOCAL(m_read_lock);
if(start_offset >= m_db_blocks.size())
@@ -2504,15 +2505,15 @@ uint64_t blockchain_storage::get_current_hashrate(size_t aprox_count) const
std::shared_ptr back_blk_ptr = m_db_blocks[nearest_back_pow_block_i];
uint64_t front_blk_ts = front_blk_ptr->bl.timestamp;
uint64_t back_blk_ts = back_blk_ptr->bl.timestamp;
-
+
uint64_t ts_delta = front_blk_ts > back_blk_ts ? front_blk_ts - back_blk_ts : DIFFICULTY_POW_TARGET;
wide_difficulty_type w_hr = (front_blk_ptr->cumulative_diff_precise - back_blk_ptr->cumulative_diff_precise) / ts_delta;
-
+
return w_hr.convert_to();
}
//------------------------------------------------------------------
-bool blockchain_storage::get_alternative_blocks(std::list& blocks) const
+bool blockchain_storage::get_alternative_blocks(std::list& blocks) const
{
CRITICAL_REGION_LOCAL(m_read_lock);
CRITICAL_REGION_LOCAL1(m_alternative_chains_lock);
@@ -2545,20 +2546,20 @@ bool blockchain_storage::add_out_to_get_random_outs(COMMAND_RPC_GET_RANDOM_OUTPU
if (height_upper_limit != 0 && tx_ptr->m_keeper_block_height > height_upper_limit)
return false;
-
+
const transaction& tx = tx_ptr->tx;
CHECK_AND_ASSERT_MES(tx_ptr->m_spent_flags.size() == tx.vout.size(), false, "internal error: spent_flag.size()=" << tx_ptr->m_spent_flags.size() << ", tx.vout.size()=" << tx.vout.size());
-
+
//do not use outputs that obviously spent for mixins
if (tx_ptr->m_spent_flags[out_ptr->out_no])
return false;
-
+
//check if transaction is unlocked
if (!is_tx_spendtime_unlocked(get_tx_unlock_time(tx, out_ptr->out_no)))
return false;
const tx_out_v& out_v = tx.vout[out_ptr->out_no];
-
+
// do not use burned coins
if (is_out_burned(out_v))
return false;
@@ -2609,7 +2610,7 @@ size_t blockchain_storage::find_end_of_allowed_index(uint64_t amount) const
{
CRITICAL_REGION_LOCAL(m_read_lock);
uint64_t sz = m_db_outputs.get_item_size(amount);
-
+
if (!sz)
return 0;
uint64_t i = sz;
@@ -2626,7 +2627,7 @@ size_t blockchain_storage::find_end_of_allowed_index(uint64_t amount) const
}
//------------------------------------------------------------------
bool blockchain_storage::get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res)const
-{
+{
CRITICAL_REGION_LOCAL(m_read_lock);
LOG_PRINT_L3("[get_random_outs_for_amounts] amounts: " << req.amounts.size());
std::map amounts_to_up_index_limit_cache;
@@ -2654,7 +2655,7 @@ bool blockchain_storage::get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDO
{
up_index_limit = it_limit->second;
}
-
+
CHECK_AND_ASSERT_MES(up_index_limit <= outs_container_size, false, "internal error: find_end_of_allowed_index returned wrong index=" << up_index_limit << ", with amount_outs.size = " << outs_container_size);
if (up_index_limit >= req.decoys_count)
{
@@ -2688,7 +2689,7 @@ bool blockchain_storage::get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDO
}
//------------------------------------------------------------------
bool blockchain_storage::get_target_outs_for_amount_prezarcanum(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS2::request& req, const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS2::offsets_distribution& details, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::outs_for_amount& result_outs, std::map& amounts_to_up_index_limit_cache) const
-{
+{
size_t decoys_count = details.offsets.size();
uint64_t amount = details.amount;
@@ -2727,7 +2728,7 @@ bool blockchain_storage::get_target_outs_for_amount_prezarcanum(const COMMAND_RP
if (!used.count(g_index))
break;
g_index++;
-
+
if (g_index >= up_index_limit)
g_index = 0;
if (g_index == g_index_initial)
@@ -2741,7 +2742,7 @@ bool blockchain_storage::get_target_outs_for_amount_prezarcanum(const COMMAND_RP
bool added = add_out_to_get_random_outs(result_outs, amount, g_index, decoys_count, req.use_forced_mix_outs, req.height_upper_limit);
used.insert(g_index);
if (added)
- ++j;
+ ++j;
}
if (result_outs.outs.size() < decoys_count)
{
@@ -2759,7 +2760,7 @@ bool blockchain_storage::get_target_outs_for_amount_prezarcanum(const COMMAND_RP
}
}
//------------------------------------------------------------------
-bool blockchain_storage::get_target_outs_for_postzarcanum(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS2::request& req, const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS2::offsets_distribution& details, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::outs_for_amount& result_outs, std::map& amounts_to_up_index_limit_cache) const
+bool blockchain_storage::get_target_outs_for_postzarcanum(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS2::request& req, const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS2::offsets_distribution& details, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::outs_for_amount& result_outs, std::map& amounts_to_up_index_limit_cache) const
{
std::set used;
used.insert(details.own_global_index);
@@ -2767,12 +2768,12 @@ bool blockchain_storage::get_target_outs_for_postzarcanum(const COMMAND_RPC_GET_
{
//perfectly we would need to find transaction's output on the given height, with the given probability
- //of being coinbase(coinbase outputs should be included less in decoy selection algorithm)
+ //of being coinbase(coinbase outputs should be included less in decoy selection algorithm)
bool is_coinbase = (crypto::rand() % 101) > req.coinbase_percents ? false : true;
//TODO: Consider including PoW coinbase to transactions(does it needed?)
-
- // convert offset to estimated height
+
+ // convert offset to estimated height
uint64_t estimated_h = this->get_current_blockchain_size() - 1 - offset;
//make sure it's after zc hardfork
if (estimated_h < m_core_runtime_config.hard_forks.m_height_the_hardfork_n_active_after[ZANO_HARDFORK_04_ZARCANUM])
@@ -2785,7 +2786,7 @@ bool blockchain_storage::get_target_outs_for_postzarcanum(const COMMAND_RPC_GET_
//try to find output around given H
std::vector selected_global_indexes;
auto process_tx = [&](const crypto::hash& tx_id) {
-
+
auto tx_ptr = m_db_transactions.find(tx_id);
CHECK_AND_ASSERT_THROW_MES(tx_ptr, "internal error: tx_id " << tx_id << " around estimated_h = " << estimated_h << " not found in db");
//go through tx outputs
@@ -2798,14 +2799,14 @@ bool blockchain_storage::get_target_outs_for_postzarcanum(const COMMAND_RPC_GET_
const tx_out_zarcanum& z_out = boost::get(tx_ptr->tx.vout[i]);
// NOTE: second part of condition (mix_attr >= CURRENCY_TO_KEY_OUT_FORCED_MIX_LOWER_BOUND && ..) might be not accurate
- // since the wallet might want to request more inputs then it planning to do mixins. For now let's keep it this way and fix
+ // since the wallet might want to request more inputs then it planning to do mixins. For now let's keep it this way and fix
// it if we see the problems about it.
if (z_out.mix_attr == CURRENCY_TO_KEY_OUT_FORCED_NO_MIX || (z_out.mix_attr >= CURRENCY_TO_KEY_OUT_FORCED_MIX_LOWER_BOUND && z_out.mix_attr < details.offsets.size()))
{
continue;
}
- // skip spent outptus
+ // skip spent outptus
if (tx_ptr->m_spent_flags[i])
{
continue;
@@ -2817,11 +2818,11 @@ bool blockchain_storage::get_target_outs_for_postzarcanum(const COMMAND_RPC_GET_
}
// add output
- // note: code that will process selected_global_indes will be revisiting transactions entries to obtain all
- // needed data, that should work relatively effective because of on-top-of-db cache keep daya unserialized
+ // note: code that will process selected_global_indes will be revisiting transactions entries to obtain all
+ // needed data, that should work relatively effective because of on-top-of-db cache keep daya unserialized
selected_global_indexes.push_back(tx_ptr->m_global_output_indexes[i]);
}
-
+
};
while (selected_global_indexes.size() < TARGET_RANDOM_OUTS_SELECTIOM_POOL_MIN)
@@ -2841,7 +2842,7 @@ bool blockchain_storage::get_target_outs_for_postzarcanum(const COMMAND_RPC_GET_
}
if(estimated_h)
estimated_h--;
- else
+ else
{
//likely unusual situation when blocks enumerated all way back to genesis
//let's check if we have at least something
@@ -2866,7 +2867,7 @@ bool blockchain_storage::get_random_outs_for_amounts2(const COMMAND_RPC_GET_RAND
{
CRITICAL_REGION_LOCAL(m_read_lock);
LOG_PRINT_L3("[get_random_outs_for_amounts] amounts: " << req.amounts.size());
- std::map amounts_to_up_index_limit_cache;
+ std::map amounts_to_up_index_limit_cache;
uint64_t count_zarcanum_blocks = 0;
if(is_hardfork_active(ZANO_HARDFORK_04_ZARCANUM))
count_zarcanum_blocks = this->get_current_blockchain_size() - m_core_runtime_config.hard_forks.m_height_the_hardfork_n_active_after[ZANO_HARDFORK_04_ZARCANUM];
@@ -2999,7 +3000,7 @@ bool blockchain_storage::find_blockchain_supplement(const std::listbl))
{
@@ -3038,36 +3039,36 @@ bool blockchain_storage::forecast_difficulty(std::vector timestamps;
std::vector cumulative_difficulties;
-
+
uint64_t blocks_size = m_db_blocks.size();
size_t count = 0;
-
+
uint64_t max_block_height_for_this_type = 0;
uint64_t min_block_height_for_this_type = UINT64_MAX;
wide_difficulty_type last_block_diff_for_this_type = 0;
-
+
for (uint64_t cur_ind = blocks_size - 1; cur_ind != 0 && count < DIFFICULTY_WINDOW; cur_ind--)
{
auto beiptr = m_db_blocks[cur_ind];
bool is_pos_bl = is_pos_block(beiptr->bl);
if (pos != is_pos_bl)
continue;
-
+
if (max_block_height_for_this_type < beiptr->height)
max_block_height_for_this_type = beiptr->height;
if (min_block_height_for_this_type > beiptr->height)
min_block_height_for_this_type = beiptr->height;
if (last_block_diff_for_this_type == 0)
last_block_diff_for_this_type = beiptr->difficulty;
-
+
timestamps.push_back(beiptr->bl.timestamp);
cumulative_difficulties.push_back(beiptr->cumulative_diff_precise);
++count;
}
-
+
if (count != DIFFICULTY_WINDOW)
return false;
-
+
const uint64_t target_seconds = pos ? DIFFICULTY_POS_TARGET : DIFFICULTY_POW_TARGET;
const uint64_t avg_interval = std::max(static_cast(1), (max_block_height_for_this_type - min_block_height_for_this_type) / count);
uint64_t height = max_block_height_for_this_type;
@@ -3078,10 +3079,10 @@ bool blockchain_storage::forecast_difficulty(std::vector summary;
for (size_t i = start_index; i < m_db_blocks.size() && i < end_index; i++)
- {
+ {
auto block_ptr = m_db_blocks[i];
//only coin holders can vote
if(!is_pos_block(block_ptr->bl))
@@ -3171,7 +3172,7 @@ bool blockchain_storage::get_pos_votes(uint64_t start_index, uint64_t end_index,
}
//------------------------------------------------------------------
std::string blockchain_storage::get_blockchain_string(uint64_t start_index, uint64_t end_index) const
-{
+{
std::stringstream ss;
CRITICAL_REGION_LOCAL(m_read_lock);
if (start_index >= m_db_blocks.size())
@@ -3232,7 +3233,7 @@ void blockchain_storage::print_blockchain_with_tx(uint64_t start_index, uint64_t
if (tx_it == m_db_transactions.end())
{
LOG_ERROR("internal error: tx id " << m_db_blocks[i]->bl.tx_hashes[j] << " not found in transactions index");
- continue;
+ continue;
}
ss << "[id]:" << m_db_blocks[i]->bl.tx_hashes[j] << ENDL << currency::obj_to_json_str(tx_it->tx) << ENDL;
}
@@ -3248,7 +3249,7 @@ void blockchain_storage::print_blockchain_index() const
// CRITICAL_REGION_LOCAL(m_blockchain_lock);
// BOOST_FOREACH(const blocks_by_id_index::value_type& v, m_db_blocks_index)
// ss << "id\t\t" << v.first << " height" << v.second << ENDL << "";
-//
+//
// LOG_PRINT_L0("Current blockchain index:" << ENDL << ss.str());
}
//------------------------------------------------------------------
@@ -3266,7 +3267,7 @@ void blockchain_storage::print_db_cache_perfeormance_data() const
<< " native_db_seriz: " << container_name.get_performance_data_native().set_serialize_t_time.get_avg()
- LOG_PRINT_L0("DB_PERFORMANCE_DATA: " << ENDL
+ LOG_PRINT_L0("DB_PERFORMANCE_DATA: " << ENDL
DB_CONTAINER_PERF_DATA_ENTRY(m_db_blocks) << ENDL
DB_CONTAINER_PERF_DATA_ENTRY(m_db_blocks_index) << ENDL
DB_CONTAINER_PERF_DATA_ENTRY(m_db_transactions) << ENDL
@@ -3304,7 +3305,7 @@ void blockchain_storage::print_last_n_difficulty_numbers(uint64_t n) const
std::stringstream ss;
std::list> pos_blocks;
std::list> pow_blocks;
-
+
get_last_n_x_blocks(n, true, pos_blocks);
get_last_n_x_blocks(n, false, pow_blocks);
ss << "PoS blocks difficulty:" << ENDL;
@@ -3334,7 +3335,7 @@ void blockchain_storage::print_blockchain_outs_stats() const
};
std::map outputs_stats;
-
+
const uint64_t subitems_cnt = m_db_outputs.size();
uint64_t progress = 0;
@@ -3370,11 +3371,11 @@ void blockchain_storage::print_blockchain_outs_stats() const
auto& stat = outputs_stats[amount];
++stat.total;
-
+
bool spent = p_tx->m_spent_flags[output_entry.out_no];
if (!spent)
++stat.unspent;
-
+
if (!spent)// && p_tx->tx.vout[output_entry.out_no].target.type() == typeid(txout_to_key))
{
VARIANT_SWITCH_BEGIN(p_tx->tx.vout[output_entry.out_no]);
@@ -3421,13 +3422,13 @@ void blockchain_storage::print_blockchain_outs(const std::string& file) const
// {
// if (vals[i].second >= it_tx->second.m_spent_flags.size())
// {
-// LOG_ERROR("Tx with id " << vals[i].first << " in global index have wrong entry in global index, offset in tx = " << vals[i].second
-// << ", it_tx->second.m_spent_flags.size()=" << it_tx->second.m_spent_flags.size()
+// LOG_ERROR("Tx with id " << vals[i].first << " in global index have wrong entry in global index, offset in tx = " << vals[i].second
+// << ", it_tx->second.m_spent_flags.size()=" << it_tx->second.m_spent_flags.size()
// << ", it_tx->second.tx.vin.size()=" << it_tx->second.tx.vin.size());
// }
// used = it_tx->second.m_spent_flags[vals[i].second];
// }
-//
+//
// ss << "\t" << vals[i].first << ": " << vals[i].second << ",used:" << used << ENDL;
// }
// }
@@ -3451,18 +3452,18 @@ bool blockchain_storage::find_blockchain_supplement(const std::listh = m_db_blocks[i]->bl.prev_id;
resp.m_block_ids.back().cumul_size = m_db_blocks[i]->block_cumulative_size;
pprevinfo = &resp.m_block_ids.back();
- }
+ }
if (pprevinfo)
pprevinfo->h = get_block_hash(m_db_blocks[--i]->bl);
@@ -3495,17 +3496,17 @@ bool blockchain_storage::get_est_height_from_date(uint64_t date, uint64_t& res_h
uint64_t calculated_estimated_height = (date - get_blockchain_launch_timestamp()) / DIFFICULTY_TOTAL_TARGET;
-
+
if (date > m_db_blocks[m_db_blocks.size() - 1]->bl.timestamp)
{
//that suspicious but also could be(in case someone just created wallet offline in
//console and then got it synchronyzing and last block had a little timestamp shift)
- //let's just return 1 day behind for safety reasons.
+ //let's just return 1 day behind for safety reasons.
if (m_db_blocks.size() > 1440)
{
res_h = m_db_blocks.size() - 1440;
}
- else
+ else
{
//likely impossible, but just in case
res_h = 0;
@@ -3528,7 +3529,7 @@ bool blockchain_storage::get_est_height_from_date(uint64_t date, uint64_t& res_h
while (true)
{
iteration_coun++;
- if (iteration_coun > 29) // Log2(CURRENCY_MAX_BLOCK_NUMBER)
+ if (iteration_coun > 29) // Log2(CURRENCY_MAX_BLOCK_NUMBER)
{
LOG_ERROR("Internal error: too much iterations on get_est_height_from_date, date = " << date);
return true;
@@ -3537,14 +3538,14 @@ bool blockchain_storage::get_est_height_from_date(uint64_t date, uint64_t& res_h
if (ts > high_boundary)
{
//we moved too much forward
-
+
current_height_boundary = calculated_estimated_height;
- CHECK_AND_ASSERT_MES(current_height_boundary >= current_low_boundary, true,
+ CHECK_AND_ASSERT_MES(current_height_boundary >= current_low_boundary, true,
"Internal error: current_hight_boundary(" << current_height_boundary << ") > current_low_boundary("<< current_low_boundary << ")");
uint64_t offset = (current_height_boundary - current_low_boundary)/2;
if (offset <= 2)
{
- //something really wrong with distribution of blocks, just use current_low_boundary to be sure that we didn't mess any transactions
+ //something really wrong with distribution of blocks, just use current_low_boundary to be sure that we didn't mess any transactions
res_h = current_low_boundary;
return true;
}
@@ -3562,7 +3563,7 @@ bool blockchain_storage::get_est_height_from_date(uint64_t date, uint64_t& res_h
uint64_t offset = (current_height_boundary - current_low_boundary) / 2;
if (offset <= 2)
{
- //something really wrong with distribution of blocks, just use current_low_boundary to be sure that we didn't mess any transactions
+ //something really wrong with distribution of blocks, just use current_low_boundary to be sure that we didn't mess any transactions
res_h = current_low_boundary;
return true;
}
@@ -3590,7 +3591,7 @@ bool blockchain_storage::find_blockchain_supplement(const std::list >());
@@ -3884,7 +3885,7 @@ std::string blockchain_storage::get_alias_by_address(const account_public_addres
{
return *(alias_ptr->begin());
}
-
+
return "";
}
//------------------------------------------------------------------
@@ -3906,7 +3907,7 @@ bool blockchain_storage::pop_alias_info(const extra_alias_entry& ai)
CHECK_AND_ASSERT_MES(ai.m_alias.size(), false, "empty name in pop_alias_info");
auto alias_history_ptr = m_db_aliases.find(ai.m_alias);
CHECK_AND_ASSERT_MES(alias_history_ptr && alias_history_ptr->size(), false, "empty name list in pop_alias_info");
-
+
auto addr_to_alias_ptr = m_db_addr_to_alias.find(alias_history_ptr->back().m_address);
if (addr_to_alias_ptr)
{
@@ -3937,7 +3938,7 @@ bool blockchain_storage::pop_alias_info(const extra_alias_entry& ai)
local_alias_hist.pop_back();
if(local_alias_hist.size())
m_db_aliases.set(ai.m_alias, local_alias_hist);
- else
+ else
m_db_aliases.erase(ai.m_alias);
if (local_alias_hist.size())
@@ -3964,7 +3965,7 @@ bool blockchain_storage::put_alias_info(const transaction & tx, extra_alias_entr
auto alias_history_ptr_ = m_db_aliases.get(ai.m_alias);
if (alias_history_ptr_)
local_alias_history = *alias_history_ptr_;
-
+
if (!local_alias_history.size())
{
@@ -3992,12 +3993,12 @@ bool blockchain_storage::put_alias_info(const transaction & tx, extra_alias_entr
//make_tx_extra_alias_entry(signed_buff, ai, true);
std::string old_address = currency::get_account_address_as_str(local_alias_history.back().m_address);
bool r = crypto::check_signature(get_sign_buff_hash_for_alias_update(ai), local_alias_history.back().m_address.spend_public_key, ai.m_sign.back());
- CHECK_AND_ASSERT_MES(r, false, "Failed to check signature, alias update failed." << ENDL
+ CHECK_AND_ASSERT_MES(r, false, "Failed to check signature, alias update failed." << ENDL
<< "alias: " << ai.m_alias << ENDL
<< "signed_buff_hash: " << get_sign_buff_hash_for_alias_update(ai) << ENDL
<< "public key: " << local_alias_history.back().m_address.spend_public_key << ENDL
<< "new_address: " << get_account_address_as_str(ai.m_address) << ENDL
- << "signature: " << epee::string_tools::pod_to_hex(ai.m_sign) << ENDL
+ << "signature: " << epee::string_tools::pod_to_hex(ai.m_sign) << ENDL
<< "alias_history.size() = " << local_alias_history.size());
//update adr-to-alias db
@@ -4048,7 +4049,7 @@ bool blockchain_storage::put_alias_info(const transaction & tx, extra_alias_entr
auto addr_to_alias_ptr_2 = m_db_addr_to_alias.get(local_alias_history.back().m_address);
if (addr_to_alias_ptr_2)
addr_to_alias_local2 = *addr_to_alias_ptr_2;
-
+
addr_to_alias_local2.insert(ai.m_alias);
m_db_addr_to_alias.set(local_alias_history.back().m_address, addr_to_alias_local2);
@@ -4181,7 +4182,7 @@ bool blockchain_storage::put_asset_info(const transaction& tx, const crypto::has
return true;
}
//------------------------------------------------------------------
-void blockchain_storage::set_event_handler(i_core_event_handler* event_handler) const
+void blockchain_storage::set_event_handler(i_core_event_handler* event_handler) const
{
if (event_handler == nullptr)
{
@@ -4193,7 +4194,7 @@ void blockchain_storage::set_event_handler(i_core_event_handler* event_handler)
m_event_handler = event_handler;
m_services_mgr.set_event_handler(event_handler);
}
-
+
}
//------------------------------------------------------------------
i_core_event_handler* blockchain_storage::get_event_handler() const
@@ -4215,7 +4216,7 @@ uint64_t blockchain_storage::validate_alias_reward(const transaction& tx, const
//------------------------------------------------------------------
bool blockchain_storage::prevalidate_alias_info(const transaction& tx, const extra_alias_entry& eae)
{
-
+
bool r = validate_alias_name(eae.m_alias);
CHECK_AND_ASSERT_MES(r, false, "failed to validate alias name!");
bool already_have_alias = false;
@@ -4226,7 +4227,7 @@ bool blockchain_storage::prevalidate_alias_info(const transaction& tx, const ext
{
already_have_alias = true;
}
-
+
}
//auto alias_history_ptr_ = m_db_aliases.get(eae.m_alias);
if (!already_have_alias)
@@ -4308,7 +4309,7 @@ bool blockchain_storage::process_blockchain_tx_attachments(const transaction& tx
//------------------------------------------------------------------
uint64_t blockchain_storage::get_tx_fee_median() const
-{
+{
uint64_t h = m_db_blocks.size();
if (m_current_fee_median_effective_index != get_tx_fee_median_effective_index(h))
{
@@ -4337,7 +4338,7 @@ uint64_t blockchain_storage::get_alias_coast(const std::string& alias) const
uint64_t blockchain_storage::get_tx_fee_window_value_median() const
{
// calc it every time and cache it so it won't recalculated before next block
- // it's effective because it's not affect sync time and needed only when node is synced
+ // it's effective because it's not affect sync time and needed only when node is synced
// and processing transactions
misc_utils::median_helper mh;
@@ -4394,7 +4395,7 @@ namespace currency
m_db_spent_keys(m_db_spent_keys),
m_tx_id(tx_id),
m_bl_id(bl_id),
- m_bl_height(bl_height),
+ m_bl_height(bl_height),
m_max_mixins_count(max_mixins_count)
{}
@@ -4458,13 +4459,13 @@ bool blockchain_storage::add_transaction_from_block(const transaction& tx, const
TIME_MEASURE_START_PD(tx_append_rl_wait);
CRITICAL_REGION_LOCAL(m_read_lock);
TIME_MEASURE_FINISH_PD_COND(need_to_profile, tx_append_rl_wait);
-
+
TIME_MEASURE_START_PD(tx_append_is_expired);
CHECK_AND_ASSERT_MES(!is_tx_expired(tx), false, "Transaction can't be added to the blockchain since it's already expired. tx expiration time: " << get_tx_expiration_time(tx) << ", blockchain median time: " << get_tx_expiration_median());
TIME_MEASURE_FINISH_PD_COND(need_to_profile, tx_append_is_expired);
CHECK_AND_ASSERT_MES(validate_tx_for_hardfork_specific_terms(tx, tx_id, bl_height), false, "tx " << tx_id << ": hardfork-specific validation failed");
-
+
TIME_MEASURE_START_PD(tx_process_extra);
bool r = process_blockchain_tx_extra(tx, tx_id);
CHECK_AND_ASSERT_MES(r, false, "failed to process_blockchain_tx_extra");
@@ -4484,7 +4485,7 @@ bool blockchain_storage::add_transaction_from_block(const transaction& tx, const
purge_transaction_keyimages_from_blockchain(tx, false);
bool r = unprocess_blockchain_tx_extra(tx);
CHECK_AND_ASSERT_MES(r, false, "failed to unprocess_blockchain_tx_extra");
-
+
unprocess_blockchain_tx_attachments(tx, bl_height, timestamp);
return false;
@@ -4521,7 +4522,7 @@ bool blockchain_storage::add_transaction_from_block(const transaction& tx, const
r = push_transaction_to_global_outs_index(tx, tx_id, ch_e.m_global_output_indexes);
CHECK_AND_ASSERT_MES(r, false, "failed to return push_transaction_to_global_outs_index tx id " << tx_id);
TIME_MEASURE_FINISH_PD_COND(need_to_profile, tx_push_global_index);
-
+
//store everything to db
TIME_MEASURE_START_PD(tx_store_db);
m_db_transactions.set(tx_id, ch_e);
@@ -4536,7 +4537,7 @@ bool blockchain_storage::add_transaction_from_block(const transaction& tx, const
TIME_MEASURE_FINISH_PD_COND(need_to_profile, tx_print_log);
//@#@ del me
-// LOG_PRINT_L0("APPEND_TX_TIME_INNER: " << m_performance_data.tx_append_rl_wait.get_last_val()
+// LOG_PRINT_L0("APPEND_TX_TIME_INNER: " << m_performance_data.tx_append_rl_wait.get_last_val()
// << " | " << m_performance_data.tx_append_is_expired.get_last_val()
// << " | " << m_performance_data.tx_process_extra.get_last_val()
// << " | " << m_performance_data.tx_process_attachment.get_last_val()
@@ -4579,7 +4580,7 @@ bool blockchain_storage::check_tx_inputs(const transaction& tx, const crypto::ha
bool blockchain_storage::rebuild_tx_fee_medians()
{
uint64_t sz = m_db_blocks.size();
- m_db.begin_transaction();
+ m_db.begin_transaction();
LOG_PRINT_L0("Started reinitialization of median fee...");
math_helper::once_a_time_seconds<10> log_idle;
@@ -4603,13 +4604,13 @@ bool blockchain_storage::rebuild_tx_fee_medians()
}
new_bei.this_block_tx_fee_median = epee::misc_utils::median(fees);
m_db_blocks.set(i, new_bei);
-
-
+
+
//prepare median helper for next block
if(new_bei.this_block_tx_fee_median)
blocks_median.push_item(new_bei.this_block_tx_fee_median, i);
- //create callbacks
+ //create callbacks
bool is_pos_allowed_l = i >= m_core_runtime_config.pos_minimum_heigh;
uint64_t period = is_pos_allowed_l ? ALIAS_COAST_PERIOD : ALIAS_COAST_PERIOD / 2;
@@ -4659,7 +4660,7 @@ uint64_t blockchain_storage::get_tx_fee_median_effective_index(uint64_t h)const
return h - (h % ALIAS_MEDIAN_RECALC_INTERWAL);
}
//------------------------------------------------------------------
-uint64_t blockchain_storage::tx_fee_median_for_height(uint64_t h)const
+uint64_t blockchain_storage::tx_fee_median_for_height(uint64_t h)const
{
uint64_t effective_index = get_tx_fee_median_effective_index(h);
CHECK_AND_ASSERT_THROW_MES(effective_index < m_db_blocks.size(), "internal error: effective_index= " << effective_index << " while m_db_blocks.size()=" << m_db_blocks.size());
@@ -4689,12 +4690,12 @@ bool blockchain_storage::validate_all_aliases_for_new_median_mode()
//validate alias coast
uint64_t median_fee = tx_fee_median_for_height(i);
uint64_t fee_for_alias = get_alias_coast_from_fee(tei.m_alias.m_alias, median_fee);
-
+
//validate the price had been paid
uint64_t burnt_amount = 0;
if (!check_native_coins_amount_burnt_in_outs(tx_ptr->tx, fee_for_alias, &burnt_amount))
{
- LOG_PRINT_RED_L0("[" << i << "]Detected collision on alias: " << tei.m_alias.m_alias
+ LOG_PRINT_RED_L0("[" << i << "]Detected collision on alias: " << tei.m_alias.m_alias
<< ", expected fee: " << print_money_brief(fee_for_alias) << " (median: " << print_money_brief(median_fee) << ")"
<< " found reward: " << (tx_ptr->tx.version <= TRANSACTION_VERSION_PRE_HF4 ? print_money_brief(burnt_amount) : std::string("hidden")) << "; tx_id: " << tx_id);
}
@@ -4707,7 +4708,7 @@ bool blockchain_storage::validate_all_aliases_for_new_median_mode()
return true;
}
//------------------------------------------------------------------
-bool blockchain_storage::print_tx_outputs_lookup(const crypto::hash& tx_id)const
+bool blockchain_storage::print_tx_outputs_lookup(const crypto::hash& tx_id)const
{
CRITICAL_REGION_LOCAL(m_read_lock);
auto tx_ptr = m_db_transactions.find(tx_id);
@@ -4731,10 +4732,10 @@ bool blockchain_storage::print_tx_outputs_lookup(const crypto::hash& tx_id)const
continue;
usage_stat[o.amount][tx_ptr->m_global_output_indexes[i]];
VARIANT_CASE_CONST(tx_out_zarcanum, toz)
- //@#@
+ //@#@
VARIANT_SWITCH_END();
}
-
+
LOG_PRINT_L0("Lookup in all transactions....");
for (uint64_t i = 0; i != m_db_blocks.size(); i++)
{
@@ -4774,11 +4775,11 @@ bool blockchain_storage::print_tx_outputs_lookup(const crypto::hash& tx_id)const
ss << "[" << print_money(amount.first) << ":" << index.first << "]" << ENDL ;
for (auto& list_entry : index.second)
{
- ss << " " << list_entry.first << ": " << list_entry.second << ENDL;
+ ss << " " << list_entry.first << ": " << list_entry.second << ENDL;
}
}
}
-
+
LOG_PRINT_L0("Results: " << ENDL << strm_tx.str() << ENDL << ss.str());
return true;
@@ -4801,7 +4802,7 @@ bool check_tx_explicit_asset_id_rules(const transaction& tx, bool all_tx_ins_hav
CHECK_AND_ASSERT_MES(r, false, "output #" << j << " has a non-explicit asset id in a tx where all inputs have an explicit native asset id");
}
}
- else // otherwise all outputs must have hidden asset id (unless they burn money by sending them to null pubkey)
+ else // otherwise all outputs must have hidden asset id (unless they burn money by sending them to null pubkey)
{
for(size_t j = 0, k = tx.vout.size(); j < k; ++j)
{
@@ -4824,7 +4825,7 @@ bool blockchain_storage::have_tx_keyimges_as_spent(const transaction &tx) const
if (have_tx_keyimg_as_spent(ki))
{
return true;
- }
+ }
}
else if (in.type() == typeid(txin_multisig))
{
@@ -4853,7 +4854,7 @@ bool blockchain_storage::check_tx_inputs(const transaction& tx, const crypto::ha
{
size_t sig_index = 0;
max_used_block_height = 0;
- bool all_tx_ins_have_explicit_native_asset_ids = true;
+bool all_tx_ins_have_explicit_native_asset_ids = true;
auto local_check_key_image = [&](const crypto::key_image& ki) -> bool
{
@@ -4981,7 +4982,7 @@ struct outputs_visitor
outputs_visitor(std::vector& results_collector,
const blockchain_storage& bch,
- uint64_t& source_max_unlock_time_for_pos_coinbase,
+ uint64_t& source_max_unlock_time_for_pos_coinbase,
blockchain_storage::scan_for_keys_context& scan_context)
: m_results_collector(results_collector)
, m_bch(bch)
@@ -4993,7 +4994,7 @@ struct outputs_visitor
{
//check tx unlock time
uint64_t source_out_unlock_time = get_tx_unlock_time(source_tx, out_i);
- //let coinbase sources for PoS block to have locked inputs, the outputs supposed to be locked same way, except the reward
+ //let coinbase sources for PoS block to have locked inputs, the outputs supposed to be locked same way, except the reward
if (is_coinbase(validated_tx) && is_pos_miner_tx(validated_tx)) // @#@ consider changing to one call to is_pos_coinbase()
{
CHECK_AND_ASSERT_MES(should_unlock_value_be_treated_as_block_height(source_out_unlock_time), false, "source output #" << out_i << " is locked by time, not by height, which is not allowed for PoS coinbase");
@@ -5074,7 +5075,7 @@ bool blockchain_storage::check_input_signature(const transaction& tx,
CRITICAL_REGION_LOCAL(m_read_lock);
TIME_MEASURE_START_PD(tx_check_inputs_loop_ch_in_val_sig);
-
+
if(m_is_in_checkpoint_zone)
return true;
@@ -5087,7 +5088,7 @@ bool blockchain_storage::check_input_signature(const transaction& tx,
CHECK_AND_ASSERT_MES(tx.signatures.size() > actual_sig_index, false, "Failed to check s.size(){" << tx.signatures.size() << "} > actual_sig_index {" << actual_sig_index << "}" );
-
+
CHECK_AND_ASSERT_MES(tx.signatures[actual_sig_index].type() == typeid(NLSAG_sig), false, "Unexpected type of sig in check_input_signature: " << tx.signatures[actual_sig_index].type().name());
const std::vector& sig = boost::get(tx.signatures[actual_sig_index]).s;
@@ -5185,7 +5186,7 @@ bool blockchain_storage::check_ms_input(const transaction& tx, size_t in_index,
VARIANT_SWITCH_BEGIN(tx.signatures[in_index]);
VARIANT_CASE_CONST(void_sig, v);
VARIANT_CASE_CONST(NLSAG_sig, sig)
- {
+ {
const std::vector& input_signatures = sig.s;
size_t expected_signatures_count = txin.sigs_count;
@@ -5234,7 +5235,7 @@ bool blockchain_storage::check_ms_input(const transaction& tx, size_t in_index,
VARIANT_SWITCH_END();
-
+
return true;
#undef LOC_CHK
@@ -5270,7 +5271,7 @@ bool blockchain_storage::check_tx_input(const transaction& tx, size_t in_index,
return true;
#undef LOC_CHK
-}
+}
//------------------------------------------------------------------
bool blockchain_storage::check_tx_input(const transaction& tx, size_t in_index, const txin_htlc& txin, const crypto::hash& tx_prefix_hash, uint64_t& max_related_block_height)const
{
@@ -5294,7 +5295,7 @@ bool blockchain_storage::check_tx_input(const transaction& tx, size_t in_index,
{
//doing sha256 hash
crypto::hash sha256 = crypto::sha256_hash(txin.hltc_origin.data(), txin.hltc_origin.size());
- CHECK_AND_ASSERT_THROW_MES(sha256 == related_out.htlc_hash, "htlc hash missmatched for tx: " << get_transaction_hash(tx)
+ CHECK_AND_ASSERT_THROW_MES(sha256 == related_out.htlc_hash, "htlc hash missmatched for tx: " << get_transaction_hash(tx)
<< " calculated hash: " << sha256 << " expected hash(related_out.htlc_hash): " << related_out.htlc_hash);
}
else
@@ -5310,6 +5311,7 @@ bool blockchain_storage::check_tx_input(const transaction& tx, size_t in_index,
//TIME_MEASURE_FINISH_PD(tx_check_inputs_loop_ch_in_get_keys_loop);
+
std::vector output_keys_ptrs;
output_keys_ptrs.reserve(output_keys.size());
for (auto& ptr : output_keys)
@@ -5469,7 +5471,7 @@ std::shared_ptr blockchain_storage::find_key_imag
auto block_entry = m_db_blocks[*ki_index_ptr];
if (!block_entry)
{
- LOG_ERROR("Internal error: broken index, key image " << ki
+ LOG_ERROR("Internal error: broken index, key image " << ki
<< " reffered to height " << *ki_index_ptr << " but couldnot find block on this height");
return std::shared_ptr();
}
@@ -5567,7 +5569,7 @@ bool blockchain_storage::fill_tx_rpc_inputs(tx_rpc_extended_info& tei, const tra
}
else if (ao.type() == typeid(ref_by_id))
{
- //disable for the reset at the moment
+ //disable for the reset at the moment
auto tx_ptr = get_tx_chain_entry(boost::get(ao).tx_id);
if (!tx_ptr || tx_ptr->m_global_output_indexes.size() <= boost::get(ao).n)
{
@@ -5668,7 +5670,7 @@ bool blockchain_storage::prune_aged_alt_blocks()
//------------------------------------------------------------------
bool blockchain_storage::validate_pos_block(const block& b, const crypto::hash& id, bool for_altchain) const
{
- //validate
+ //validate
wide_difficulty_type basic_diff = get_next_diff_conditional(true);
return validate_pos_block(b, basic_diff, id, for_altchain);
}
@@ -5683,11 +5685,11 @@ bool blockchain_storage::validate_pos_block(const block& b, wide_difficulty_type
//------------------------------------------------------------------
#define POS_STAKE_TO_DIFF_COEFF 100 // total_coins_in_minting * POS_STAKE_TO_DIFF_COEFF =~ pos_difficulty
-void blockchain_storage::get_pos_mining_estimate(uint64_t amount_coins,
- uint64_t time,
- uint64_t& estimate_result,
- uint64_t& pos_diff_and_amount_rate,
- std::vector& days) const
+void blockchain_storage::get_pos_mining_estimate(uint64_t amount_coins,
+ uint64_t time,
+ uint64_t& estimate_result,
+ uint64_t& pos_diff_and_amount_rate,
+ std::vector& days) const
{
estimate_result = 0;
if (!is_pos_allowed())
@@ -5704,7 +5706,7 @@ void blockchain_storage::get_pos_mining_estimate(uint64_t amount_coins,
epee::critical_region_t read_lock_region(m_read_lock);
size_t estimated_pos_blocks_count_per_day = CURRENCY_BLOCKS_PER_DAY / 2; // 50% of all blocks in a perfect world
-
+
uint64_t pos_ts_min = UINT64_MAX, pos_ts_max = 0;
size_t pos_blocks_count = 0;
uint64_t pos_total_minted_money = 0;
@@ -5779,7 +5781,7 @@ bool blockchain_storage::validate_tx_for_hardfork_specific_terms(const transacti
CHECK_AND_ASSERT_MES(el.type() != typeid(tx_receiver), false, "tx " << tx_id << " contains tx_receiver which is not allowed on height " << block_height);
CHECK_AND_ASSERT_MES(el.type() != typeid(extra_alias_entry), false, "tx " << tx_id << " contains extra_alias_entry which is not allowed on height " << block_height);
return true;
- };
+ };
auto is_allowed_before_hardfork3 = [&](const auto& el) -> bool
{
@@ -5805,7 +5807,7 @@ bool blockchain_storage::validate_tx_for_hardfork_specific_terms(const transacti
CHECK_AND_ASSERT_MES(el.type() != typeid(tx_out_bare), false, "tx " << tx_id << " contains tx_out_bare which is not allowed on height " << block_height);
return true;
};
-
+
//inputs
for (const auto& in : tx.vin)
{
@@ -5862,12 +5864,12 @@ bool blockchain_storage::validate_tx_for_hardfork_specific_terms(const transacti
if (var_is_after_hardfork_4_zone && !is_allowed_after_hardfork4(el))
return false;
}
-
+
// TODO @#@# consider: 1) tx.proofs, 2) new proof data structures
if (var_is_after_hardfork_4_zone)
- {
+ {
CHECK_AND_ASSERT_MES(tx.version > TRANSACTION_VERSION_PRE_HF4, false, "HF4: tx with version " << tx.version << " is not allowed");
if (is_pos_miner_tx(tx))
@@ -5911,7 +5913,7 @@ bool blockchain_storage::validate_pos_coinbase_outs_unlock_time(const transactio
else
return true;
}
-
+
uint64_t block_height = get_block_height(miner_tx);
CHECK_AND_ASSERT_MES(m_core_runtime_config.is_hardfork_active_for_height(1, block_height), false, "error in block [" << block_height << "]: etc_tx_details_unlock_time was not found but etc_tx_details_unlock_time2 can exist only after hard fork 1 at height " << m_core_runtime_config.hard_forks.get_str_height_the_hardfork_active_after(1));
@@ -5919,9 +5921,9 @@ bool blockchain_storage::validate_pos_coinbase_outs_unlock_time(const transactio
etc_tx_details_unlock_time2 ut2 = AUTO_VAL_INIT(ut2);
bool found = get_type_in_variant_container(miner_tx.extra, ut2);
CHECK_AND_ASSERT_MES(found, false, "etc_tx_details_unlock_time2 was not found in tx extra");
- CHECK_AND_ASSERT_MES(ut2.unlock_time_array.size() == miner_tx.vout.size(), false, "ut2.unlock_time_array.size()<" << ut2.unlock_time_array.size()
+ CHECK_AND_ASSERT_MES(ut2.unlock_time_array.size() == miner_tx.vout.size(), false, "ut2.unlock_time_array.size()<" << ut2.unlock_time_array.size()
<< "> != miner_tx.vout.size()<" << miner_tx.vout.size() << ">");
-
+
uint64_t amount_of_coins_in_unlock_in_range = 0; // amount of outputs locked for at least the same time
for (uint64_t i = 0; i != miner_tx.vout.size(); i++)
@@ -5934,11 +5936,11 @@ bool blockchain_storage::validate_pos_coinbase_outs_unlock_time(const transactio
VARIANT_CASE_CONST(tx_out_bare, o)
amount_of_coins_in_unlock_in_range += o.amount;
VARIANT_CASE_CONST(tx_out_zarcanum, toz)
- //@#@
+ //@#@
VARIANT_SWITCH_END();
}
}
-
+
if (amount_of_coins_in_unlock_in_range >= staked_amount)
return true;
LOG_ERROR("amount_of_coins_in_unlock_in_range<" << amount_of_coins_in_unlock_in_range << "> is less then staked_amount<" << staked_amount);
@@ -5946,16 +5948,16 @@ bool blockchain_storage::validate_pos_coinbase_outs_unlock_time(const transactio
}
//------------------------------------------------------------------
-bool blockchain_storage::validate_pos_block(const block& b,
- wide_difficulty_type basic_diff,
- uint64_t& amount,
- wide_difficulty_type& final_diff,
- crypto::hash& kernel_hash,
- const crypto::hash& id,
- bool for_altchain,
+bool blockchain_storage::validate_pos_block(const block& b,
+ wide_difficulty_type basic_diff,
+ uint64_t& amount,
+ wide_difficulty_type& final_diff,
+ crypto::hash& kernel_hash,
+ const crypto::hash& id,
+ bool for_altchain,
const alt_chain_type& alt_chain,
uint64_t split_height
- )const
+ )const
{
bool is_pos = is_pos_block(b);
CHECK_AND_ASSERT_MES(is_pos, false, "is_pos_block() returned false validate_pos_block()");
@@ -6007,7 +6009,7 @@ bool blockchain_storage::validate_pos_block(const block& b,
const txin_zc_input& stake_input = boost::get(b.miner_tx.vin[1]);
CHECK_AND_ASSERT_MES(b.miner_tx.signatures.size() == 1, false, "incorrect number of stake input signatures: " << b.miner_tx.signatures.size());
CHECK_AND_ASSERT_MES(b.miner_tx.signatures[0].type() == typeid(zarcanum_sig), false, "incorrect sig 0 type: " << b.miner_tx.signatures[0].type().name());
-
+
//std::stringstream ss;
if (!for_altchain)
{
@@ -6035,7 +6037,7 @@ bool blockchain_storage::validate_pos_block(const block& b,
CHECK_AND_ASSERT_MES(r, false, "get_output_keys_for_input_with_checks failed for stake input");
CHECK_AND_ASSERT_MES(scan_contex.zc_outs.size() == stake_input.key_offsets.size(), false, "incorrect number of referenced outputs found: " << scan_contex.zc_outs.size() << ", while " << stake_input.key_offsets.size() << " is expected.");
// make sure that all referring inputs are either older then, or the same age as, the most resent PoW block.
- CHECK_AND_ASSERT_MES(max_related_block_height <= last_pow_block_height, false, "stake input refs' max related block height is " << max_related_block_height << " while last PoW block height is " << last_pow_block_height);
+ CHECK_AND_ASSERT_MES(max_related_block_height <= last_pow_block_height, false, "stake input refs' max related block height is " << max_related_block_height << " while last PoW block height is " << last_pow_block_height);
TIME_MEASURE_FINISH_PD(pos_validate_get_out_keys_for_inputs);
@@ -6134,7 +6136,7 @@ wide_difficulty_type blockchain_storage::get_adjusted_cumulative_difficulty_for_
return next_diff;
uint64_t i = sz - 1;
-
+
for (; i < sz && !(last_pow_diff && last_pos_diff); i--)
{
if (is_pos_block(m_db_blocks[i]->bl))
@@ -6307,7 +6309,7 @@ bool blockchain_storage::collect_rangeproofs_data_from_tx(const transaction& tx,
}
CHECK_AND_ASSERT_MES(out_index_offset == tx.vout.size(), false, "range proof elements count doesn't match with outputs count: " << out_index_offset << " != " << tx.vout.size());
CHECK_AND_ASSERT_MES(range_proofs_count > 0, false, "transaction " << get_transaction_hash(tx) << " doesn't have range proofs");
- CHECK_AND_ASSERT_MES(range_proofs_count == 1 || (get_tx_flags(tx) & TX_FLAG_SIGNATURE_MODE_SEPARATE), false, "transaction " << get_transaction_hash(tx)
+ CHECK_AND_ASSERT_MES(range_proofs_count == 1 || (get_tx_flags(tx) & TX_FLAG_SIGNATURE_MODE_SEPARATE), false, "transaction " << get_transaction_hash(tx)
<< " doesn't have TX_FLAG_SIGNATURE_MODE_SEPARATE but has range_proofs_count = " << range_proofs_count);
return true;
@@ -6352,7 +6354,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
m_is_in_checkpoint_zone = false;
crypto::hash proof_hash = null_hash;
- uint64_t pos_coinstake_amount = UINT64_MAX;
+ uint64_t pos_coinstake_amount = UINT64_MAX;
wide_difficulty_type this_coin_diff = 0;
bool is_pos_bl = is_pos_block(bl);
//check if PoS allowed in this height
@@ -6385,9 +6387,9 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
if (!check_hash(proof_hash, current_diffic))
{
LOG_ERROR("Block with id: " << id << ENDL
- << "PoW hash: " << proof_hash << ENDL
+ << "PoW hash: " << proof_hash << ENDL
<< "nonce: " << bl.nonce << ENDL
- << "header_mining_hash: " << get_block_header_mining_hash(bl) << ENDL
+ << "header_mining_hash: " << get_block_header_mining_hash(bl) << ENDL
<< "expected difficulty: " << current_diffic);
bvc.m_verification_failed = true;
return false;
@@ -6400,7 +6402,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
size_t cumulative_block_size = 0;
size_t coinbase_blob_size = get_object_blobsize(bl.miner_tx);
- /*
+ /*
instead of complicated two-phase template construction and adjustment of cumulative size with block reward we
use CURRENCY_COINBASE_BLOB_RESERVED_SIZE as penalty-free coinbase transaction reservation.
*/
@@ -6409,7 +6411,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
cumulative_block_size += coinbase_blob_size;
LOG_PRINT_CYAN("Big coinbase transaction detected: coinbase_blob_size = " << coinbase_blob_size, LOG_LEVEL_0);
}
-
+
std::vector block_fees;
block_fees.reserve(bl.tx_hashes.size());
//process transactions
@@ -6457,14 +6459,14 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
{
LOG_PRINT_L0("Block with id: " << id << " has at least one transaction with wrong semantic, tx_id: " << tx_id);
purge_block_data_from_blockchain(bl, tx_processed_count);
- //add_block_as_invalid(bl, id);
+ //add_block_as_invalid(bl, id);
bvc.m_verification_failed = true;
return false;
}
append_per_block_increments_for_tx(tx, gindices);
-
- //If we under checkpoints, attachments, ring signatures and proofs should be pruned
+
+ //If we under checkpoints, attachments, ring signatures and proofs should be pruned
if(m_is_in_checkpoint_zone)
{
tx.attachment.clear();
@@ -6641,17 +6643,17 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
return false;
}
//this used only in pre-hardfork 1
- bei.cumulative_diff_adjusted += cumulative_diff_delta;
+ bei.cumulative_diff_adjusted += cumulative_diff_delta;
//////////////////////////////////////////////////////////////////////////
- // rebuild cumulative_diff_precise_adjusted for whole period
+ // rebuild cumulative_diff_precise_adjusted for whole period
// cumulative_diff_precise_adjusted - native cumulative difficulty adjusted ONLY by sequence_factor
wide_difficulty_type diff_precise_adj = correct_difficulty_with_sequence_factor(sequence_factor, current_diffic);
bei.cumulative_diff_precise_adjusted = last_x_h ? m_db_blocks[last_x_h]->cumulative_diff_precise_adjusted + diff_precise_adj : diff_precise_adj;
//////////////////////////////////////////////////////////////////////////
- //etc
+ //etc
if (already_generated_coins < burned_coins)
{
LOG_ERROR("Condition failed: already_generated_coins(" << already_generated_coins << ") >= burned_coins(" << burned_coins << ")");
@@ -6681,7 +6683,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
{
if (bei.height == 0)
bei.effective_tx_fee_median = 0;
- else
+ else
{
LOG_PRINT_L0("Recalculating median fee...");
std::vector blocks_medians;
@@ -6738,23 +6740,23 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
}
//explanation of this code will be provided later with public announce
set_lost_tx_unmixable_for_height(bei.height);
-
+
LOG_PRINT_L1("+++++ BLOCK SUCCESSFULLY ADDED " << (is_pos_bl ? "[PoS]" : "[PoW]") << "["<< static_cast(bei.bl.major_version) << "." << static_cast(bei.bl.minor_version) << "] "<< " Sq: " << sequence_factor
<< ENDL << "id:\t" << id << timestamp_str_entry.str()
<< ENDL << powpos_str_entry.str()
<< ENDL << "HEIGHT " << bei.height << ", difficulty: " << current_diffic << ", cumul_diff_precise: " << bei.cumulative_diff_precise << ", cumul_diff_precise_adj: " << bei.cumulative_diff_precise_adjusted << " (+" << cumulative_diff_delta << ")"
- << ENDL << "block reward: " << print_money_brief(base_reward + fee_summary) << " (" << print_money_brief(base_reward) << " + " << print_money_brief(fee_summary)
+ << ENDL << "block reward: " << print_money_brief(base_reward + fee_summary) << " (" << print_money_brief(base_reward) << " + " << print_money_brief(fee_summary)
<< ")" << ", coinbase_blob_size: " << coinbase_blob_size << ", cumulative size: " << cumulative_block_size << ", tx_count: " << bei.bl.tx_hashes.size()
- << ", timing: " << block_processing_time_0_ms << "ms"
- << "(micrsec:" << block_processing_time_1
+ << ", timing: " << block_processing_time_0_ms << "ms"
+ << "(micrsec:" << block_processing_time_1
<< "(" << target_calculating_time_2 << "(" << m_performance_data.target_calculating_enum_blocks.get_last_val() << "/" << m_performance_data.target_calculating_calc.get_last_val() << ")"
- << "/" << longhash_calculating_time_3 << pos_validation_str_entry.str()
- << "/" << insert_time_4
+ << "/" << longhash_calculating_time_3<< pos_validation_str_entry.str()
+ << "/" << insert_time_4
<< "/" << all_txs_insert_time_5
<< "/" << etc_stuff_6
<< "/" << tx_total_inputs_processing_time << " of " << tx_total_inputs_count
- << "/(" << m_performance_data.validate_miner_transaction_time.get_last_val() << "|"
+ << "/(" << m_performance_data.validate_miner_transaction_time.get_last_val() << "|"
<< m_performance_data.collect_rangeproofs_data_from_tx_time.get_last_val() << "|"
<< m_performance_data.verify_multiple_zc_outs_range_proofs_time.get_last_val() << "~"
<< range_proofs_agregated.size()
@@ -6917,8 +6919,8 @@ bool blockchain_storage::prevalidate_block(const block& bl)
if (bl.minor_version > CURRENT_BLOCK_MINOR_VERSION)
{
//this means that binary block is compatible, but semantics got changed due to hardfork, daemon should be updated
- LOG_PRINT_MAGENTA("Block's MINOR_VERSION is: " << bl.minor_version
- << ", while current build supports not bigger then " << CURRENT_BLOCK_MINOR_VERSION
+ LOG_PRINT_MAGENTA("Block's MINOR_VERSION is: " << bl.minor_version
+ << ", while current build supports not bigger then " << CURRENT_BLOCK_MINOR_VERSION
<< ", please make sure you using latest version.", LOG_LEVEL_0
);
return false;
@@ -6958,7 +6960,7 @@ bool blockchain_storage::add_new_block(const block& bl, block_verification_conte
//check that block refers to chain tail
-
+
if (!(bl.prev_id == get_top_block_id()))
{
//chain switching or wrong block
@@ -6994,7 +6996,7 @@ bool blockchain_storage::add_new_block(const block& bl, block_verification_conte
if (m_event_handler) m_event_handler->on_complete_events();
return res;
- }
+ }
catch (const std::exception& ex)
{
bvc.m_verification_failed = true;
@@ -7036,7 +7038,7 @@ bool blockchain_storage::truncate_blockchain(uint64_t to_height)
return true;
}
//------------------------------------------------------------------
-bool blockchain_storage::calc_tx_cummulative_blob(const block& bl)const
+bool blockchain_storage::calc_tx_cummulative_blob(const block& bl)const
{
uint64_t cummulative_size_pool = 0;
uint64_t cummulative_size_calc = 0;
@@ -7079,7 +7081,7 @@ bool blockchain_storage::calc_tx_cummulative_blob(const block& bl)const
{
LOG_PRINT_RED("BLOB SIZE MISMATCH IN TX: " << h << " calculated_sz: " << calculated_sz
<< " serialized_size: " << serialized_size, LOG_LEVEL_0);
- }
+ }
}
cummulative_size_calc += calculated_sz;
cummulative_size_serialized += serialized_size;
@@ -7088,7 +7090,7 @@ bool blockchain_storage::calc_tx_cummulative_blob(const block& bl)const
}
LOG_PRINT_MAGENTA("CUMMULATIVE_BLOCK_SIZE_TRACE: " << get_block_hash(bl) << ENDL
- << "cummulative_size_calc: " << cummulative_size_calc << ENDL
+ << "cummulative_size_calc: " << cummulative_size_calc << ENDL
<< "cummulative_size_serialized: " << cummulative_size_serialized << ENDL
<< "cummulative_size_pool: " << cummulative_size_pool << ENDL
<< ss.str(), LOG_LEVEL_0);
@@ -7138,10 +7140,10 @@ bool blockchain_storage::build_stake_modifier(stake_modifier_type& sm, const alt
return true;
}
//------------------------------------------------------------------
-bool blockchain_storage::build_kernel(const crypto::key_image& ki,
- stake_kernel& kernel,
- const stake_modifier_type& stake_modifier,
- uint64_t timestamp)const
+bool blockchain_storage::build_kernel(const crypto::key_image& ki,
+ stake_kernel& kernel,
+ const stake_modifier_type& stake_modifier,
+ uint64_t timestamp)const
{
CRITICAL_REGION_LOCAL(m_read_lock);
kernel = stake_kernel();
@@ -7284,7 +7286,7 @@ void blockchain_storage::calculate_local_gindex_lookup_table_for_height(uint64_t
{
auto p = m_db_per_block_gindex_incs.get(h);
CHECK_AND_ASSERT_THROW_MES(p, "null p for height " << h);
-
+
for (auto& el : p->increments)
gindexes[el.amount] += el.increment;
@@ -7308,7 +7310,7 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
const crypto::hash& bl_id,
const crypto::hash& input_tx_hash,
size_t input_index,
- uint64_t split_height,
+ uint64_t split_height,
const alt_chain_type& alt_chain,
const std::unordered_set& alt_chain_block_ids,
uint64_t& ki_lookuptime,
@@ -7357,7 +7359,7 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
CHECK_AND_ASSERT_MES(p == nullptr || *p >= split_height, false, "key image " << input_key_image << " has been already spent in main chain at height " << *p << ", split height: " << split_height);
TIME_MEASURE_START(ki_lookup_time);
- //check key_image in altchain
+ //check key_image in altchain
//check among this alt block already collected key images first
if (collected_keyimages.find(input_key_image) != collected_keyimages.end())
{
@@ -7367,7 +7369,7 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
}
auto ki_it = m_altblocks_keyimages.find(input_key_image);
if (ki_it != m_altblocks_keyimages.end())
- {
+ {
//have some entry for this key image. Check if this key image belongs to this alt chain
const std::list& key_image_block_ids = ki_it->second;
for (auto& h : key_image_block_ids)
@@ -7388,17 +7390,17 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
std::vector abs_key_offsets = relative_output_offsets_to_absolute(input_key_offsets);
CHECK_AND_ASSERT_MES(abs_key_offsets.size() > 0 && abs_key_offsets.size() == input_key_offsets.size(), false, "internal error: abs_key_offsets.size()==" << abs_key_offsets.size() << ", input_key_offsets.size()==" << input_key_offsets.size());
// eventually we should found all public keys for all outputs this input refers to, for checking ring signature
- std::vector pub_keys(abs_key_offsets.size(), null_pkey);
+ std::vector pub_keys(abs_key_offsets.size(), null_pkey);
//
// let's try to resolve references and populate pub keys container for check_tokey_input()
//
uint64_t global_outs_for_amount = 0;
- //figure out if this amount touched alt_chain amount's index and if it is, get
+ //figure out if this amount touched alt_chain amount's index and if it is, get
bool amount_touched_altchain = false;
//auto abg_it = abei.gindex_lookup_table.find(input_to_key.amount);
//if (abg_it == abei.gindex_lookup_table.end())
-
+
if (!alt_chain.empty())
{
auto abg_it = alt_chain.back()->second.gindex_lookup_table.find(input_amount);
@@ -7410,16 +7412,16 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
}
else
{
- //quite easy,
+ //quite easy,
global_outs_for_amount = m_db_outputs.get_item_size(input_amount);
}
}
else
{
- //quite easy,
+ //quite easy,
global_outs_for_amount = m_db_outputs.get_item_size(input_amount);
}
-
+
CHECK_AND_ASSERT_MES(pub_keys.size() == abs_key_offsets.size(), false, "pub_keys.size()==" << pub_keys.size() << " != abs_key_offsets.size()==" << abs_key_offsets.size()); // just a little bit of paranoia
std::vector pub_key_pointers;
@@ -7435,9 +7437,9 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
{
uint64_t offset_gindex = boost::get(off);
CHECK_AND_ASSERT_MES(amount_touched_altchain || (offset_gindex < global_outs_for_amount), false,
- "invalid global output index " << offset_gindex << " for amount=" << input_amount <<
- ", max is " << global_outs_for_amount <<
- ", referred to by offset #" << pk_n <<
+ "invalid global output index " << offset_gindex << " for amount=" << input_amount <<
+ ", max is " << global_outs_for_amount <<
+ ", referred to by offset #" << pk_n <<
", amount_touched_altchain = " << amount_touched_altchain);
if (amount_touched_altchain)
{
@@ -7457,10 +7459,9 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
//GOT IT!!
//TODO: At the moment we ignore check of mix_attr against mixing to simplify alt chain check, but in future consider it for stronger validation
uint64_t local_offset = offset_gindex - it_aag->second;
- auto& alt_keys = (*alt_it)->second.outputs_pub_keys;
+ auto& alt_keys = (*alt_it)->second.outputs_pub_keys;
CHECK_AND_ASSERT_MES(local_offset < alt_keys[input_amount].size(), false, "Internal error: local_offset=" << local_offset << " while alt_keys[" << input_amount << " ].size()=" << alt_keys.size());
const output_key_or_htlc_v& out_in_alt = alt_keys[input_amount][local_offset];
-
/*
here we do validation against compatibility of input and output type
@@ -7475,7 +7476,7 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
CHECK_AND_ASSERT_MES(height_of_current_alt_block > height_of_source_block, false, "Intenral error: height_of_current_alt_block > height_of_source_block failed");
bool r = is_output_allowed_for_input(out_in_alt, input_v, height_of_current_alt_block - height_of_source_block);
CHECK_AND_ASSERT_MES(r, false, "Input and output incompatible type");
-
+
if (out_in_alt.type() == typeid(crypto::public_key))
{
pk = boost::get(out_in_alt);
@@ -7555,7 +7556,7 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
}
}
VARIANT_CASE_CONST(tx_out_zarcanum, toz)
- //@#@
+ //@#@
VARIANT_SWITCH_END();
}
@@ -7615,7 +7616,7 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
pub_key_pointers.push_back(&pk);
}
VARIANT_CASE_CONST(tx_out_zarcanum, toz)
- //@#@
+ //@#@
VARIANT_SWITCH_END();
}
@@ -7636,7 +7637,7 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
}
else
{
- // TODO @#@# properly handle ZC inputs! check_tx_input below isn't working because of incorrectly assembled ring
+ // TODO @#@# properly handle ZC inputs! check_tx_input below isn't working because of incorrectly assembled ring
/*
uint64_t max_related_block_height = 0;
bool all_tx_ins_have_explicit_asset_ids = true; // stub for now, TODO @#@#
@@ -7663,7 +7664,7 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
}
}
-
+
// TODO: consider checking input_tx for valid extra attachment info as it's checked in check_tx_inputs()
return true;
}
@@ -7697,7 +7698,7 @@ bool blockchain_storage::is_output_allowed_for_input(const txout_target_v& out_v
return true;
}
//------------------------------------------------------------------
-bool blockchain_storage::is_output_allowed_for_input(const txout_htlc& out_v, const txin_v& in_v, uint64_t top_minus_source_height)const
+bool blockchain_storage::is_output_allowed_for_input(const txout_htlc& out_v, const txin_v& in_v, uint64_t top_minus_source_height)const
{
bool htlc_expired = out_v.expiration > (top_minus_source_height) ? false : true;
if (!htlc_expired)
@@ -7770,7 +7771,7 @@ bool blockchain_storage::validate_alt_block_ms_input(const transaction& input_tx
CRITICAL_REGION_LOCAL(m_read_lock);
bool r = false;
- CHECK_AND_ASSERT_MES(input_index < input_tx.vin.size()
+ CHECK_AND_ASSERT_MES(input_index < input_tx.vin.size()
&& input_tx.vin[input_index].type() == typeid(txin_multisig), false, "invalid ms input index: " << input_index << " or type");
const txin_multisig& input = boost::get(input_tx.vin[input_index]);
@@ -7784,13 +7785,13 @@ bool blockchain_storage::validate_alt_block_ms_input(const transaction& input_tx
const crypto::hash& source_tx_id = p->tx_id;
auto p_source_tx = m_db_transactions.get(source_tx_id);
CHECK_AND_ASSERT_MES(p_source_tx != nullptr, false, "source tx for ms output " << source_tx_id << " was not found, ms out id: " << input.multisig_out_id);
-
+
if (p_source_tx->m_keeper_block_height < split_height)
{
// cases g1, g2
return check_ms_input(input_tx, input_index, input, input_tx_hash, p_source_tx->tx, p->out_no);
}
-
+
// p_source_tx is above split_height in main chain B, so it can't be a source for this input
// do nohting here and proceed to alt chain scan for possible cases b4, g4, g5
}
@@ -7836,7 +7837,7 @@ bool blockchain_storage::validate_alt_block_ms_input(const transaction& input_tx
}
}
VARIANT_CASE_CONST(tx_out_zarcanum, toz)
- //@#@
+ //@#@
VARIANT_SWITCH_END();
}
return true;
@@ -7864,7 +7865,7 @@ bool blockchain_storage::validate_alt_block_ms_input(const transaction& input_tx
}
//------------------------------------------------------------------
bool blockchain_storage::get_transaction_from_pool_or_db(const crypto::hash& tx_id, std::shared_ptr& tx_ptr, uint64_t min_allowed_block_height /* = 0 */) const
-{
+{
tx_ptr.reset(new transaction());
if (!m_tx_pool.get_transaction(tx_id, *tx_ptr)) // first try to get from the pool
@@ -7882,7 +7883,7 @@ bool blockchain_storage::get_transaction_from_pool_or_db(const crypto::hash& tx_
return true;
}
//------------------------------------------------------------------
-bool blockchain_storage::update_alt_out_indexes_for_tx_in_block(const transaction& tx, alt_block_extended_info& abei) const
+bool blockchain_storage::update_alt_out_indexes_for_tx_in_block(const transaction& tx, alt_block_extended_info& abei) const
{
//add tx outputs to gindex_lookup_table
for (auto ov : tx.vout)
@@ -7911,7 +7912,7 @@ bool blockchain_storage::update_alt_out_indexes_for_tx_in_block(const transactio
//TODO: At the moment we ignore check of mix_attr again mixing to simplify alt chain check, but in future consider it for stronger validation
}
VARIANT_CASE_CONST(tx_out_zarcanum, toz)
- //@#@
+ //@#@
VARIANT_SWITCH_END();
}
return true;
@@ -7924,7 +7925,7 @@ bool blockchain_storage::validate_alt_block_txs(const block& b, const crypto::ha
std::unordered_set alt_chain_block_ids;
txs_by_id_and_height_altchain alt_chain_tx_ids;
-
+
alt_chain_block_ids.insert(id);
// prepare data structure for output global indexes tracking within current alt chain
if (alt_chain.size())
@@ -8021,7 +8022,7 @@ bool blockchain_storage::validate_alt_block_txs(const block& b, const crypto::ha
}
CHECK_AND_ASSERT_MES(validate_tx_for_hardfork_specific_terms(tx, tx_id, height), false, "tx " << tx_id << ": hardfork-specific validation failed");
-
+
// Updating abei (and not updating alt_chain) during this cycle is safe because txs in the same block can't reference one another,
// so only valid references are either to previous alt blocks (accessed via alt_chain) or to main chain blocks.
update_alt_out_indexes_for_tx_in_block(tx, abei);
diff --git a/src/currency_core/currency_core.cpp b/src/currency_core/currency_core.cpp
index 876c2d17..149375c0 100644
--- a/src/currency_core/currency_core.cpp
+++ b/src/currency_core/currency_core.cpp
@@ -15,7 +15,7 @@ using namespace epee;
#include "common/util.h"
#include "warnings.h"
#include "crypto/crypto.h"
-#include "currency_core/currency_config.h"
+#include "currency_config.h"
#include "currency_format_utils.h"
#include "misc_language.h"
#include "string_coding.h"
@@ -24,7 +24,7 @@ using namespace epee;
#define MINIMUM_REQUIRED_FREE_SPACE_BYTES (1024 * 1024 * 100)
DISABLE_VS_WARNINGS(4355)
-#undef LOG_DEFAULT_CHANNEL
+#undef LOG_DEFAULT_CHANNEL
#define LOG_DEFAULT_CHANNEL "core"
ENABLE_CHANNEL_BY_DEFAULT("core");
namespace currency
@@ -253,7 +253,7 @@ namespace currency
return false;
}
TIME_MEASURE_FINISH_MS(parse_tx_time);
-
+
TIME_MEASURE_START_MS(check_tx_semantic_time);
if(!validate_tx_semantic(tx, tx_blob.size()))
{
@@ -277,7 +277,7 @@ namespace currency
st_inf.blockchain_height = m_blockchain_storage.get_current_blockchain_size();
st_inf.tx_pool_size = m_mempool.get_transactions_count();
st_inf.top_block_id_str = epee::string_tools::pod_to_hex(m_blockchain_storage.get_top_block_id());
-
+
std::list blocks;
m_blockchain_storage.get_blocks(m_blockchain_storage.get_current_blockchain_size() - pr.chain_len, static_cast(pr.chain_len), blocks);
for (auto& b : blocks)
@@ -366,12 +366,12 @@ namespace currency
return m_blockchain_storage.create_block_template(params, resp);
}
//-----------------------------------------------------------------------------------------------
- bool core::find_blockchain_supplement(const std::list& qblock_ids, NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp) const
+ bool core::find_blockchain_supplement(const std::list& qblock_ids, NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp) const
{
return m_blockchain_storage.find_blockchain_supplement(qblock_ids, resp);
}
//-----------------------------------------------------------------------------------------------
- bool core::find_blockchain_supplement(const std::list& qblock_ids, std::list > >& blocks, uint64_t& total_height, uint64_t& start_height, size_t max_count) const
+ bool core::find_blockchain_supplement(const std::list& qblock_ids, std::list > >& blocks, uint64_t& total_height, uint64_t& start_height, size_t max_count) const
{
return m_blockchain_storage.find_blockchain_supplement(qblock_ids, blocks, total_height, start_height, max_count);
}
@@ -616,12 +616,12 @@ namespace currency
return m_blockchain_storage.get_short_chain_history(ids);
}
//-----------------------------------------------------------------------------------------------
- bool core::handle_get_objects(NOTIFY_REQUEST_GET_OBJECTS::request& arg, NOTIFY_RESPONSE_GET_OBJECTS::request& rsp, currency_connection_context& context)const
+ bool core::handle_get_objects(NOTIFY_REQUEST_GET_OBJECTS::request& arg, NOTIFY_RESPONSE_GET_OBJECTS::request& rsp, currency_connection_context& context)const
{
return m_blockchain_storage.handle_get_objects(arg, rsp);
}
//-----------------------------------------------------------------------------------------------
- crypto::hash core::get_block_id_by_height(uint64_t height)const
+ crypto::hash core::get_block_id_by_height(uint64_t height)const
{
return m_blockchain_storage.get_block_id_by_height(height);
}
@@ -651,14 +651,14 @@ namespace currency
if(!m_starter_message_showed)
{
LOG_PRINT_L0(ENDL
- << "**********************************************************************" << ENDL
- << "The daemon will start synchronizing with the network. It may take up to several hours." << ENDL
+ << "**********************************************************************" << ENDL
+ << "The daemon will start synchronizing with the network. It may take up to several hours." << ENDL
<< ENDL
<< "You can adjust verbosity by using command: \"set_log \", where 0 is the least verbose and 3 is the most." << ENDL
<< ENDL
<< "Use \"help\" command to list all available commands." << ENDL
<< ENDL
- << "Note: in case you need to interrupt the process, use \"exit\" command. Otherwise, the current progress might not be saved." << ENDL
+ << "Note: in case you need to interrupt the process, use \"exit\" command. Otherwise, the current progress might not be saved." << ENDL
<< "**********************************************************************");
m_starter_message_showed = true;
}
diff --git a/src/currency_core/currency_format_utils.cpp b/src/currency_core/currency_format_utils.cpp
index 8eb17e2d..f4e8a27b 100644
--- a/src/currency_core/currency_format_utils.cpp
+++ b/src/currency_core/currency_format_utils.cpp
@@ -66,7 +66,7 @@ namespace currency
}
return true;
}
-
+
// okay, have some ZC inputs
CHECK_AND_ASSERT_MES(zc_ins_count == ogc.pseudo_outs_plus_real_out_blinding_masks.size(), false, "zc_ins_count != pseudo_outs_plus_real_out_blinding_masks");
@@ -84,7 +84,7 @@ namespace currency
{
const crypto::public_key H = ogc.asset_ids[j].to_public_key();
const crypto::point_t& T = ogc.blinded_asset_ids[j];
-
+
std::vector ring;
ring.reserve(zc_ins_count);
size_t secret_index = SIZE_MAX;
@@ -172,7 +172,7 @@ namespace currency
if (is_asset_emitting_transaction(tx, &ado))
{
crypto::point_t asset_id_pt{};
- CHECK_AND_ASSERT_MES(get_or_calculate_asset_id(ado, &asset_id_pt, nullptr), false, "get_or_calculate_asset_id failed"); // TODO @#@# expensive operation, consider caching
+ CHECK_AND_ASSERT_MES(get_or_calculate_asset_id(ado, &asset_id_pt, nullptr), false, "get_or_calculate_asset_id failed"); // TODO @#@# expensive operation, consider caching
pseudo_outs_blinded_asset_ids.emplace_back(asset_id_pt); // additional ring member for asset emitting tx
}
@@ -368,7 +368,7 @@ namespace currency
bool pos /* = false */,
const pos_entry& pe /* = pos_entry() */, // only pe.stake_unlock_time and pe.stake_amount are used now, TODO: consider refactoring -- sowle
tx_generation_context* ogc_ptr /* = nullptr */,
- const keypair* tx_one_time_key_to_use /* = nullptr */,
+ const keypair* tx_one_time_key_to_use /* = nullptr */,
const std::vector& destinations_ /* = std::vector() */
)
{
@@ -388,7 +388,7 @@ namespace currency
{
block_reward += fee;
}
-
+
if (!destinations.size())
{
//
@@ -454,7 +454,7 @@ namespace currency
if (!add_tx_extra_userdata(tx, extra_nonce))
return false;
- //at this moment we do apply_unlock_time only for coin_base transactions
+ //at this moment we do apply_unlock_time only for coin_base transactions
apply_unlock_time(destinations, tx);
//we always add extra_padding with 2 bytes length to make possible for get_block_template to adjust cumulative size
tx.extra.push_back(extra_padding());
@@ -504,7 +504,7 @@ namespace currency
tx_gen_context.amount_commitments_sum += tx_gen_context.amount_commitments[output_index];
++output_index;
}
-
+
if (tx.attachment.size())
add_attachments_info_to_extra(tx.extra, tx.attachment);
@@ -521,7 +521,7 @@ namespace currency
if (tx.version > TRANSACTION_VERSION_PRE_HF4 && !pos)
{
// This is for PoW blocks only, because PoS blocks proofs are handled in wallet2::prepare_and_sign_pos_block() due to the necessity of making Zarcanum proofs first
- //
+ //
// tx hash should be sealed by now
crypto::hash tx_id = get_transaction_hash(tx);
@@ -684,7 +684,7 @@ namespace currency
}
return true;
}
-
+
// pre-HF4 txs
return check_tx_bare_balance(tx, additional_inputs_amount_and_fees_for_mining_tx);
}
@@ -824,7 +824,7 @@ namespace currency
if (ts < WALLET_BRAIN_DATE_OFFSET)
return false;
-
+
creation_timestamp = ts;
}
@@ -854,7 +854,7 @@ namespace currency
uint64_t amount_in = 0;
uint64_t amount_out = get_outs_money_amount(tx);
-
+
for(auto& in : tx.vin)
amount_in += get_amount_from_variant(in);
@@ -870,9 +870,9 @@ namespace currency
fee += ztd.fee;
return true; // continue
};
-
+
bool r = process_type_in_variant_container(tx.extra, cb, false);
-
+
if (!r)
{
fee = 0;
@@ -1147,7 +1147,7 @@ namespace currency
//a.meta_info;
//if (a.owner != b.owner) return false;
if (new_ado.hidden_supply != prev_ado.hidden_supply) return false;
-
+
return true;
}
//---------------------------------------------------------------
@@ -1200,12 +1200,12 @@ namespace currency
crypto::scalar_t amount_mask = crypto::hash_helper_t::hs(CRYPTO_HDS_OUT_AMOUNT_MASK, h);
out.encrypted_amount = de.amount ^ amount_mask.m_u64[0];
-
+
CHECK_AND_ASSERT_MES(~de.flags & tx_destination_entry_flags::tdef_explicit_native_asset_id || de.asset_id == currency::native_coin_asset_id, false, "explicit_native_asset_id may be used only with native asset id");
asset_blinding_mask = de.flags & tx_destination_entry_flags::tdef_explicit_native_asset_id ? 0 : crypto::hash_helper_t::hs(CRYPTO_HDS_OUT_ASSET_BLINDING_MASK, h); // s = Hs(domain_sep, Hs(8 * r * V, i))
blinded_asset_id = crypto::point_t(de.asset_id) + asset_blinding_mask * crypto::c_point_X;
out.blinded_asset_id = (crypto::c_scalar_1div8 * blinded_asset_id).to_public_key(); // T = 1/8 * (H_asset + s * X)
-
+
amount_blinding_mask = de.flags & tx_destination_entry_flags::tdef_zero_amount_blinding_mask ? 0 : crypto::hash_helper_t::hs(CRYPTO_HDS_OUT_AMOUNT_BLINDING_MASK, h); // y = Hs(domain_sep, Hs(8 * r * V, i))
amount_commitment = de.amount * blinded_asset_id + amount_blinding_mask * crypto::c_point_G;
out.amount_commitment = (crypto::c_scalar_1div8 * amount_commitment).to_public_key(); // E = 1/8 * e * T + 1/8 * y * G
@@ -1221,10 +1221,10 @@ namespace currency
out.stealth_address = (h * crypto::c_point_G + crypto::point_t(apa.spend_public_key)).to_public_key();
out.concealing_point = (crypto::hash_helper_t::hs(CRYPTO_HDS_OUT_CONCEALING_POINT, h) * crypto::point_t(apa.view_public_key)).to_public_key(); // Q = 1/8 * Hs(domain_sep, Hs(8 * r * V, i) ) * 8 * V
-
+
crypto::scalar_t amount_mask = crypto::hash_helper_t::hs(CRYPTO_HDS_OUT_AMOUNT_MASK, h);
out.encrypted_amount = de.amount ^ amount_mask.m_u64[0];
-
+
CHECK_AND_ASSERT_MES(~de.flags & tx_destination_entry_flags::tdef_explicit_native_asset_id || de.asset_id == currency::native_coin_asset_id, false, "explicit_native_asset_id may be used only with native asset id");
asset_blinding_mask = de.flags & tx_destination_entry_flags::tdef_explicit_native_asset_id ? 0 : crypto::hash_helper_t::hs(CRYPTO_HDS_OUT_ASSET_BLINDING_MASK, h); // s = Hs(domain_sep, Hs(8 * r * V, i))
blinded_asset_id = crypto::point_t(de.asset_id) + asset_blinding_mask * crypto::c_point_X;
@@ -1243,7 +1243,7 @@ namespace currency
DBG_VAL_PRINT(amount_blinding_mask);
DBG_VAL_PRINT(amount_mask);
DBG_VAL_PRINT(amount_commitment);
-
+
if (de.addr.front().is_auditable())
out.mix_attr = CURRENCY_TO_KEY_OUT_FORCED_NO_MIX; // override mix_attr to 1 for auditable target addresses
else
@@ -1251,7 +1251,7 @@ namespace currency
uint16_t hint = get_derivation_hint(reinterpret_cast(derivation));
if (deriv_cache.count(hint) == 0)
- {
+ {
tx.extra.push_back(make_tx_derivation_hint_from_uint16(hint));
deriv_cache.insert(hint);
}
@@ -1283,7 +1283,7 @@ namespace currency
uint16_t hint = get_derivation_hint(derivation);
if (deriv_cache.count(hint) == 0)
- {
+ {
tx.extra.push_back(make_tx_derivation_hint_from_uint16(hint));
deriv_cache.insert(hint);
}
@@ -1321,7 +1321,7 @@ namespace currency
if (htlc_dest.htlc_hash == null_hash)
{
//we use deterministic origin, to make possible access origin on different wallets copies
-
+
result.htlc_origin = generate_origin_for_htlc(htlc, self);
//calculate hash
@@ -1351,7 +1351,7 @@ namespace currency
tk.mix_attr = CURRENCY_TO_KEY_OUT_FORCED_NO_MIX; // override mix_attr to 1 for auditable target addresses
else
tk.mix_attr = tx_outs_attr;
-
+
out.target = tk;
}
else
@@ -1398,14 +1398,14 @@ namespace currency
eai.cnt = attachment.size();
}
//---------------------------------------------------------------
- bool construct_tx(const account_keys& sender_account_keys,
+ bool construct_tx(const account_keys& sender_account_keys,
const std::vector& sources,
const std::vector& destinations,
- const std::vector& attachments,
+ const std::vector& attachments,
transaction& tx,
uint64_t tx_version,
uint64_t unlock_time,
- uint8_t tx_outs_attr,
+ uint8_t tx_outs_attr,
bool shuffle)
{
crypto::secret_key one_time_secret_key = AUTO_VAL_INIT(one_time_secret_key);
@@ -1538,7 +1538,7 @@ namespace currency
const crypto::key_derivation& rkey;
std::vector& rdecrypted_att;
decrypt_attach_visitor(const crypto::key_derivation& key,
- std::vector& decrypted_att,
+ std::vector& decrypted_att,
const account_keys& acc_keys,
bool is_income,
const transaction& tx,
@@ -1546,8 +1546,8 @@ namespace currency
rkey(key),
m_tx(tx),
m_is_income(is_income),
- rdecrypted_att(decrypted_att),
- m_acc_keys(acc_keys),
+ rdecrypted_att(decrypted_att),
+ m_acc_keys(acc_keys),
m_tx_onetime_pubkey(tx_onetime_pubkey)
{}
void operator()(const tx_comment& comment)
@@ -1572,7 +1572,7 @@ namespace currency
{
return; // this field invisible for sender
}
- //decrypting derivation
+ //decrypting derivation
derivation_local = *(crypto::key_derivation*)&sa.security[0];
crypto::chacha_crypt(derivation_local, m_acc_keys.spend_secret_key);
}
@@ -1591,7 +1591,7 @@ namespace currency
else
{
crypto::chacha_crypt(local_sa.body, derivation_local);
- }
+ }
}
if (sa.flags&TX_SERVICE_ATTACHMENT_DEFLATE_BODY)
@@ -1733,11 +1733,11 @@ namespace currency
for (auto& a : tx.attachment)
boost::apply_visitor(v, a);
-
+
return true;
}
- const crypto::public_key onetime_pub = get_tx_pub_key_from_extra(tx);
-
+const crypto::public_key onetime_pub = get_tx_pub_key_from_extra(tx);
+
decrypt_payload_items(derivation, tx.extra, decrypted_items, is_income, tx, acc_keys, onetime_pub);
decrypt_payload_items(derivation, tx.attachment, decrypted_items, is_income, tx, acc_keys, onetime_pub);
return true;
@@ -1922,7 +1922,7 @@ namespace currency
{
//
//find target account to encrypt attachment.
- //for now we use just firs target account that is not sender,
+ //for now we use just firs target account that is not sender,
//in case if there is no real targets we use sender credentials to encrypt attachments
account_public_address crypt_destination_addr = get_crypt_address_from_destinations(sender_account_keys, destinations);
@@ -2182,9 +2182,9 @@ namespace currency
return native_coin_asset_descriptor;
}
- bool construct_tx_handle_ado(const account_keys& sender_account_keys,
- const finalize_tx_param& ftp,
- asset_descriptor_operation& ado,
+ bool construct_tx_handle_ado(const account_keys& sender_account_keys,
+ const finalize_tx_param& ftp,
+ asset_descriptor_operation& ado,
tx_generation_context& gen_context,
const keypair& tx_key,
std::vector& shuffled_dsts)
@@ -2198,7 +2198,7 @@ namespace currency
// old:
// asset_control_key = Hs(CRYPTO_HDS_ASSET_CONTROL_KEY, 8 * tx_key.sec * sender_account_keys.account_address.spend_public_key, 0)
// ado.descriptor.owner = asset_control_key * G
-
+
ado.descriptor.owner = sender_account_keys.account_address.spend_public_key;
CHECK_AND_ASSERT_MES(get_or_calculate_asset_id(ado, &gen_context.ao_asset_id_pt, &gen_context.ao_asset_id), false, "get_or_calculate_asset_id failed");
@@ -2252,7 +2252,7 @@ namespace currency
ado.amount_commitment = (crypto::c_scalar_1div8 * gen_context.ao_amount_commitment).to_public_key();
if (ftp.pevents_dispatcher) ftp.pevents_dispatcher->RAISE_DEBUG_EVENT(wde_construct_tx_handle_asset_descriptor_operation_before_burn{ &ado });
-
+
}
else
{
@@ -2323,7 +2323,7 @@ namespace currency
const uint8_t& tx_outs_attr = ftp.tx_outs_attr;
const bool& shuffle = ftp.shuffle;
const uint64_t& flags = ftp.flags;
-
+
bool r = false;
transaction& tx = result.tx;
crypto::secret_key& one_time_tx_secret_key = result.one_time_key;
@@ -2348,7 +2348,7 @@ namespace currency
if (flags != 0)
set_tx_flags(tx, flags);
- //generate key pair
+ //generate key pair
if (expiration_time != 0)
set_tx_expiration_time(tx, expiration_time);
}
@@ -2474,7 +2474,7 @@ namespace currency
if (src_entr.is_zc())
{
- // if at least one decoy output of a ZC input has a non-explicit asset id, then we can't say that all inputs are obviously native coins
+ // if at least one decoy output of a ZC input has a non-explicit asset id, then we can't say that all inputs are obviously native coins
for (const tx_source_entry::output_entry& oe : in_context.outputs)
{
if (crypto::point_t(oe.blinded_asset_id).modify_mul8() != currency::native_coin_asset_id_pt)
@@ -2515,7 +2515,7 @@ namespace currency
CHECK_AND_ASSERT_MES(gen_context.tx_key.pub != null_pkey && gen_context.tx_key.sec != null_skey, false, "In append mode both public and secret keys must be provided");
//separately encrypt attachments without putting extra
- result.derivation = get_encryption_key_derivation(true, tx, sender_account_keys);
+ result.derivation = get_encryption_key_derivation(true, tx, sender_account_keys);
crypto::key_derivation& derivation = result.derivation;
CHECK_AND_ASSERT_MES(derivation != null_derivation, false, "failed to generate_key_derivation");
bool was_attachment_crypted_entries = false;
@@ -2545,7 +2545,7 @@ namespace currency
}
-
+
//
// OUTs
//
@@ -2569,7 +2569,7 @@ namespace currency
if (shuffle)
std::sort(shuffled_dsts.begin(), shuffled_dsts.end(), [](const tx_destination_entry& de1, const tx_destination_entry& de2) { return de1.amount < de2.amount; });
- // TODO: consider "Shuffle" inputs
+ // TODO: consider "Shuffle" inputs
// construct outputs
uint64_t native_coins_output_sum = 0;
@@ -2660,7 +2660,7 @@ namespace currency
if (tx.attachment.size())
add_attachments_info_to_extra(tx.extra, tx.attachment);
}
-
+
//
// generate proofs and signatures
@@ -2677,7 +2677,7 @@ namespace currency
size_t i_mapped = inputs_mapping[i_];
const tx_source_entry& source_entry = sources[i_mapped];
crypto::hash tx_hash_for_signature = prepare_prefix_hash_for_sign(tx, i_ + input_starter_index, tx_prefix_hash);
- CHECK_AND_ASSERT_MES(tx_hash_for_signature != null_hash, false, "prepare_prefix_hash_for_sign failed");
+ CHECK_AND_ASSERT_MES(tx_hash_for_signature != null_hash, false, "prepare_prefix_hash_for_sign failed");
std::stringstream ss_ring_s;
if (source_entry.is_zc())
@@ -2733,8 +2733,8 @@ namespace currency
aop.opt_amount_commitment_g_proof = aop_g_sig;
tx.proofs.emplace_back(std::move(aop));
}
- if(ftp.need_to_generate_ado_proof)
- {
+ if(ftp.need_to_generate_ado_proof)
+ {
asset_operation_ownership_proof aoop = AUTO_VAL_INIT(aoop);
if (ftp.pthirdparty_sign_handler)
@@ -2745,7 +2745,7 @@ namespace currency
}
else
{
- //generate signature by wallet account
+ //generate signature by wallet account
r = crypto::generate_schnorr_sig(tx_prefix_hash, ftp.ado_current_asset_owner, sender_account_keys.spend_secret_key, aoop.gss);
CHECK_AND_ASSERT_MES(r, false, "Failed to sign ado proof");
}
@@ -2794,7 +2794,7 @@ namespace currency
VARIANT_CASE_CONST(tx_out_bare, o)
reward += o.amount;
VARIANT_CASE_CONST(tx_out_zarcanum, o)
- //@#@
+ //@#@
VARIANT_SWITCH_END();
}
reward -= income;
@@ -2828,7 +2828,7 @@ namespace currency
password_used = false;
}
uint64_t timestamp = count_of_weeks * WALLET_BRAIN_DATE_QUANTUM + WALLET_BRAIN_DATE_OFFSET;
-
+
return timestamp;
}
//---------------------------------------------------------------
@@ -2896,7 +2896,7 @@ namespace currency
size_t participant_index = std::find(out_ms.keys.begin(), out_ms.keys.end(), ms_in_ephemeral_key.pub) - out_ms.keys.begin();
LOC_CHK(participant_index < out_ms.keys.size(), "Can't find given participant's ms key in ms output keys list");
LOC_CHK(ms_input_index < tx.signatures.size(), "transaction does not have signatures vector entry for ms input #" << ms_input_index);
-
+
LOC_CHK(tx.signatures[ms_input_index].type() == typeid(NLSAG_sig), "Wrong type of signature");
auto& sigs = boost::get(tx.signatures[ms_input_index]).s;
LOC_CHK(!sigs.empty(), "empty signatures container");
@@ -2904,7 +2904,7 @@ namespace currency
bool extra_signature_expected = (get_tx_flags(tx) & TX_FLAG_SIGNATURE_MODE_SEPARATE) && ms_input_index == tx.vin.size() - 1;
size_t allocated_sigs_for_participants = extra_signature_expected ? sigs.size() - 1 : sigs.size();
LOC_CHK(participant_index < allocated_sigs_for_participants, "participant index (" << participant_index << ") is out of bound: " << allocated_sigs_for_participants); // NOTE: this may fail if the input has already been fully signed and 'sigs' was compacted
-
+
crypto::hash tx_hash_for_signature = prepare_prefix_hash_for_sign(tx, ms_input_index, get_transaction_hash(tx));
LOC_CHK(tx_hash_for_signature != null_hash, "failed to prepare_prefix_hash_for_sign");
@@ -2969,7 +2969,7 @@ namespace currency
in.type() == typeid(txin_to_key) ||
in.type() == typeid(txin_multisig) ||
in.type() == typeid(txin_htlc) ||
- in.type() == typeid(txin_zc_input),
+ in.type() == typeid(txin_zc_input),
false, "wrong input type: " << in.type().name() << ", in transaction " << get_transaction_hash(tx));
}
return true;
@@ -2978,7 +2978,7 @@ namespace currency
/*
bool add_padding_to_tx(transaction& tx, size_t count)
{
-
+
WARNING: potantially unsafe implementation!
1) requires extra_padding being previously added to tx's extra;
2) transaction size may increase by more than 'count' bytes due to varint encoding (thus, if 'count' is 128 it will add 129 bytes)
@@ -3039,7 +3039,7 @@ namespace currency
VARIANT_CASE_CONST(tx_out_bare, out)
{
CHECK_AND_NO_ASSERT_MES(0 < out.amount, false, "zero amount output in transaction id=" << get_transaction_hash(tx));
-
+
VARIANT_SWITCH_BEGIN(out.target);
VARIANT_CASE_CONST(txout_to_key, tk)
if (!check_key(tk.key))
@@ -3253,7 +3253,7 @@ namespace currency
return false;
return true;
- }
+ }
//---------------------------------------------------------------
bool lookup_acc_outs(const account_keys& acc, const transaction& tx, std::vector& outs, crypto::key_derivation& derivation)
{
@@ -3515,7 +3515,7 @@ namespace currency
return ts;
}
}
-
+
// next try etc_tx_time
etc_tx_time t = AUTO_VAL_INIT(t);
if (get_type_in_variant_container(b.miner_tx.extra, t))
@@ -3564,7 +3564,7 @@ namespace currency
//------------------------------------------------------------------
#define ANTI_OVERFLOW_AMOUNT 1000000
-#define GET_PERECENTS_BIG_NUMBERS(per, total) (per/ANTI_OVERFLOW_AMOUNT)*100 / (total/ANTI_OVERFLOW_AMOUNT)
+#define GET_PERECENTS_BIG_NUMBERS(per, total) (per/ANTI_OVERFLOW_AMOUNT)*100 / (total/ANTI_OVERFLOW_AMOUNT)
void print_reward_change()
{
@@ -3587,7 +3587,7 @@ namespace currency
std::cout << std::left
<< std::setw(10) << day
<< std::setw(19) << print_money(emission_reward)
- << std::setw(4) << print_money(already_generated_coins)
+ << std::setw(4) << print_money(already_generated_coins)
<< "(POS: " << boost::lexical_cast(GET_PERECENTS_BIG_NUMBERS(total_generated_in_year_by_pos, money_was_at_begining_of_year)) << "%"
<< ", POW: " << boost::lexical_cast(GET_PERECENTS_BIG_NUMBERS(total_generated_in_year_by_pow, money_was_at_begining_of_year)) << "%)"
@@ -3622,7 +3622,7 @@ namespace currency
{
// std::cout << std::endl << "Reward change for 20 days:" << std::endl;
// std::cout << std::setw(10) << std::left << "day" << std::setw(19) << "block reward" << std::setw(19) << "generated coins" << std::endl;
-//
+//
// const boost::multiprecision::uint128_t& already_generated_coins = PREMINE_AMOUNT;
// //uint64_t total_money_supply = TOTAL_MONEY_SUPPLY;
// uint64_t h = 0;
@@ -3630,15 +3630,15 @@ namespace currency
// {
// uint64_t emission_reward = 0;
// get_block_reward(h % 2, 0, 0, already_generated_coins, emission_reward, h, (already_generated_coins - PREMINE_AMOUNT) * 140);
-//
+//
// std::cout << std::left
// << std::setw(10) << day
// << std::setw(19) << print_money(emission_reward)
// << std::setw(4) << print_money(already_generated_coins)//std::string(std::to_string(GET_PERECENTS_BIG_NUMBERS((already_generated_coins), total_money_supply)) + "%")
// << std::endl;
-//
-//
-//
+//
+//
+//
// for (size_t i = 0; i != 720; i++)
// {
// h++;
@@ -3649,7 +3649,7 @@ namespace currency
// }
// }
}
-
+
std::string print_reward_change_first_blocks(size_t n_of_first_blocks)
{
std::stringstream ss;
@@ -3691,7 +3691,7 @@ namespace currency
//------------------------------------------------------------------
void print_currency_details()
{
- //for future forks
+ //for future forks
std::cout << "Currency name: \t\t" << CURRENCY_NAME << "(" << CURRENCY_NAME_SHORT << ")" << std::endl;
std::cout << "Money supply: \t\t " << CURRENCY_BLOCK_REWARD * CURRENCY_BLOCKS_PER_DAY * 365 << " coins per year" << std::endl;
@@ -3725,10 +3725,12 @@ namespace currency
#ifndef TESTNET
// std::string genesis_coinbase_tx_hex((const char*)&ggenesis_tx_raw, sizeof(ggenesis_tx_raw));
-#else
+#else
std::string genesis_coinbase_tx_hex = "";
#endif
+ // Testnet proof phrase: "It takes advantage of the nature of information being easy to spread but hard to stifle. - Satoshi Nakamoto"
+
//genesis proof phrase: "Liverpool beat Barcelona: Greatest Champions League comebacks of all time"
//taken from: https://www.bbc.com/sport/football/48163330
//sha3-256 from proof phrase: a074236b1354901d5dbc029c0ac4c05c948182c34f3030f32b0c93aee7ba275c (included in genesis block)
@@ -3967,7 +3969,7 @@ namespace currency
}
else// if (ao.type() == typeid(ref_by_id))
{
- //disable for the reset at the moment
+ //disable for the reset at the moment
entry_to_fill.global_indexes.back() = std::numeric_limits::max();
}
}
@@ -3987,7 +3989,7 @@ namespace currency
{
entry_to_fill.multisig_count = boost::get(tx.signatures[tei.ins.size() - 1]).s.size();
}
-
+
}
}
return true;
@@ -4034,7 +4036,7 @@ namespace currency
gindices[amount] += 1;
}
VARIANT_CASE_CONST(tx_out_zarcanum, o)
- //@#@
+ //@#@
VARIANT_SWITCH_END();
}
}
@@ -4072,7 +4074,7 @@ namespace currency
{
if (!height)
return PREMINE_AMOUNT;
-
+
return CURRENCY_BLOCK_REWARD;
}
//-----------------------------------------------------------------------------------------------
@@ -4152,12 +4154,12 @@ namespace currency
std::string get_account_address_as_str(const account_public_address& addr)
{
if (addr.flags == 0)
- return tools::base58::encode_addr(CURRENCY_PUBLIC_ADDRESS_BASE58_PREFIX, t_serializable_object_to_blob(addr.to_old())); // classic Zano address
+ return tools::base58::encode_addr(CURRENCY_PUBLIC_ADDRESS_BASE58_PREFIX, t_serializable_object_to_blob(addr.to_old())); // classic Lethean address
if (addr.flags & ACCOUNT_PUBLIC_ADDRESS_FLAG_AUDITABLE)
- return tools::base58::encode_addr(CURRENCY_PUBLIC_AUDITABLE_ADDRESS_BASE58_PREFIX, t_serializable_object_to_blob(addr)); // new format Zano address (auditable)
-
- return tools::base58::encode_addr(CURRENCY_PUBLIC_ADDRESS_BASE58_PREFIX, t_serializable_object_to_blob(addr)); // new format Zano address (normal)
+ return tools::base58::encode_addr(CURRENCY_PUBLIC_AUDITABLE_ADDRESS_BASE58_PREFIX, t_serializable_object_to_blob(addr)); // new format Lethean address (auditable)
+
+ return tools::base58::encode_addr(CURRENCY_PUBLIC_ADDRESS_BASE58_PREFIX, t_serializable_object_to_blob(addr)); // new format Lethean address (normal)
}
//-----------------------------------------------------------------------
bool is_address_like_wrapped(const std::string& addr)
@@ -4170,12 +4172,12 @@ namespace currency
std::string get_account_address_and_payment_id_as_str(const account_public_address& addr, const payment_id_t& payment_id)
{
if (addr.flags == 0)
- return tools::base58::encode_addr(CURRENCY_PUBLIC_INTEG_ADDRESS_BASE58_PREFIX, t_serializable_object_to_blob(addr.to_old()) + payment_id); // classic integrated Zano address
+ return tools::base58::encode_addr(CURRENCY_PUBLIC_INTEG_ADDRESS_BASE58_PREFIX, t_serializable_object_to_blob(addr.to_old()) + payment_id); // classic integrated Lethean address
if (addr.flags & ACCOUNT_PUBLIC_ADDRESS_FLAG_AUDITABLE)
- return tools::base58::encode_addr(CURRENCY_PUBLIC_AUDITABLE_INTEG_ADDRESS_BASE58_PREFIX, t_serializable_object_to_blob(addr) + payment_id); // new format integrated Zano address (auditable)
-
- return tools::base58::encode_addr(CURRENCY_PUBLIC_INTEG_ADDRESS_V2_BASE58_PREFIX, t_serializable_object_to_blob(addr) + payment_id); // new format integrated Zano address (normal)
+ return tools::base58::encode_addr(CURRENCY_PUBLIC_AUDITABLE_INTEG_ADDRESS_BASE58_PREFIX, t_serializable_object_to_blob(addr) + payment_id); // new format integrated Lethean address (auditable)
+
+ return tools::base58::encode_addr(CURRENCY_PUBLIC_INTEG_ADDRESS_V2_BASE58_PREFIX, t_serializable_object_to_blob(addr) + payment_id); // new format integrated Lethean address (normal)
}
//-----------------------------------------------------------------------
bool get_account_address_from_str(account_public_address& addr, const std::string& str)
@@ -4388,12 +4390,12 @@ namespace currency
size_t i = 0;
for (auto& p_out_k : output_keys_ptrs)
s << " " << std::setw(2) << i++ << " " << *p_out_k << ENDL;
-
+
s << " signatures (" << sig.size() << ")" << ENDL;
i = 0;
for (auto& sig_el : sig)
s << " " << std::setw(2) << i++ << " " << sig_el << ENDL;
-
+
return s.str();
}
@@ -4438,7 +4440,7 @@ namespace currency
{
if (a.cnt == b.cnt && a.hsh == b.hsh && a.sz == b.sz)
return true;
- else
+ else
return false;
}
//--------------------------------------------------------------------------------
@@ -4540,7 +4542,7 @@ namespace currency
// << ", a_pos_cumulative_difficulty:" << a_pos_cumulative_difficulty << ENDL
// << ", b_pos_cumulative_difficulty:" << b_pos_cumulative_difficulty << ENDL
// << ", a_pow_cumulative_difficulty:" << a_pow_cumulative_difficulty << ENDL
-// << ", b_pow_cumulative_difficulty:" << b_pow_cumulative_difficulty << ENDL
+// << ", b_pow_cumulative_difficulty:" << b_pow_cumulative_difficulty << ENDL
// );
// }
TRY_ENTRY();
@@ -4549,7 +4551,7 @@ namespace currency
CATCH_ENTRY_WITH_FORWARDING_EXCEPTION();
}
//--------------------------------------------------------------------------------
- // Note: we adjust formula and introduce multiplier,
+ // Note: we adjust formula and introduce multiplier,
// that let us never dive into floating point calculations (which we can't use in consensus)
// this multiplier should be greater than max multiprecision::uint128_t power 2
@@ -4585,7 +4587,7 @@ namespace currency
// << ", a_pos_cumulative_difficulty:" << a_pos_cumulative_difficulty << ENDL
// << ", b_pos_cumulative_difficulty:" << b_pos_cumulative_difficulty << ENDL
// << ", a_pow_cumulative_difficulty:" << a_pow_cumulative_difficulty << ENDL
- // << ", b_pow_cumulative_difficulty:" << b_pow_cumulative_difficulty << ENDL
+ // << ", b_pow_cumulative_difficulty:" << b_pow_cumulative_difficulty << ENDL
// );
// }
TRY_ENTRY();
diff --git a/src/currency_core/difficulty.cpp b/src/currency_core/difficulty.cpp
index b0bdfac0..c3a02c9f 100644
--- a/src/currency_core/difficulty.cpp
+++ b/src/currency_core/difficulty.cpp
@@ -14,7 +14,7 @@
#include "common/int-util.h"
#include "crypto/hash.h"
-#include "currency_core/currency_config.h"
+#include "currency_config.h"
#include "difficulty.h"
#include "profile_tools.h"
@@ -55,7 +55,7 @@ namespace currency {
return a + b < a || (c && a + b == (uint64_t)-1);
}
-
+
#if defined(_MSC_VER)
#ifdef max
#undef max
@@ -98,7 +98,7 @@ namespace currency {
return false;
// usual slow check
boost::multiprecision::uint512_t hashVal = 0;
- for(int i = 0; i < 4; i++)
+ for(int i = 0; i < 4; i++)
{
hashVal <<= 64;
hashVal |= swap64le(((const uint64_t *) &h)[3-i]);
@@ -155,7 +155,7 @@ namespace currency {
cut_end = cut_begin + (REDEF_DIFFICULTY_WINDOW - (REDEF_DIFFICULTY_CUT_OLD + REDEF_DIFFICULTY_CUT_LAST));
if (cut_end > length)
cut_end = length;
-
+
}
CHECK_AND_ASSERT_THROW_MES(/*cut_begin >= 0 &&*/ cut_begin + 2 <= cut_end && cut_end <= length, "validation in next_difficulty is failed");
}
@@ -201,11 +201,11 @@ namespace currency {
CHECK_AND_ASSERT_MES(length <= DIFFICULTY_WINDOW, 0, "length <= DIFFICULTY_WINDOW check failed, length=" << length);
sort(timestamps.begin(), timestamps.end(), std::greater());
-
+
static_assert(2 * DIFFICULTY_CUT <= DIFFICULTY_WINDOW - 2, "Cut length is too large");
wide_difficulty_type dif_slow = get_adjustment_for_zone(timestamps, cumulative_difficulties, target_seconds, DIFFICULTY_WINDOW, DIFFICULTY_CUT/2, DIFFICULTY_CUT/2);
wide_difficulty_type dif_medium = get_adjustment_for_zone(timestamps, cumulative_difficulties, target_seconds, DIFFICULTY_WINDOW/3, DIFFICULTY_CUT / 8, DIFFICULTY_CUT / 12);
- wide_difficulty_type dif_fast = get_adjustment_for_zone(timestamps, cumulative_difficulties, target_seconds, DIFFICULTY_WINDOW/18, DIFFICULTY_CUT / 10, 2);
+ wide_difficulty_type dif_fast = get_adjustment_for_zone(timestamps, cumulative_difficulties, target_seconds, DIFFICULTY_WINDOW/18, DIFFICULTY_CUT / 10, 2);
uint64_t devider = 1;
wide_difficulty_type summ = dif_slow;
if (dif_medium != 0)
diff --git a/src/currency_core/genesis.cpp b/src/currency_core/genesis.cpp
index a58dcb4e..30841508 100644
--- a/src/currency_core/genesis.cpp
+++ b/src/currency_core/genesis.cpp
@@ -8,13 +8,13 @@
namespace currency
{
#ifndef TESTNET
- const genesis_tx_raw_data ggenesis_tx_raw = { {
- 0xa080801a00000101,0x800326b0b4a0f2fd,0xeebe5a6d44a03ed5,0x0e146a5322076dcf,0x992269ec1e34796e,0x003b14d1fe6c757e,0xb0b4a0f2fda08080,0xfd92adf982e70326,0xd8d4b6458b60e1a4,0xa69adb9475e808ed,0x4c383fcedfb6e20a,0xf2fda08080003458,0x8b177f0326b0b4a0,0xef9769ed70d152cd,0x04097d0daa65d123,0x9cd9f8e708f25bbc,0x8080005dfb23beac,0x0326b0b4a0f2fda0,0x6752077f8e75fc8a,0x437f68e0bf774836,0x5a38b52ff21c01c0,0x2d3727ec82ce1425,0xb4f89aecdce08000,0xa07d9fe35f0326b0,0x6c742533eb3b4261,0xfc2ed631332e5e16,0x3d025449393e538b,0x93dc80800015e433,0x70a20307d0ffc2e0,0xb81808dc5029bd46,0x04129413283e31f1,0x143e631cc81020b0,0x80008519d1377ae3,0x05c6c5bc97b1a080,0xf71887a841a72a03,0x681b659b8d2832d4,0x5677f9b15d11d1e6,0xffb2ad80c02a341c,0xbc97b1a08080003f,0xf9cebe7c0305c6c5,0xee223954dc682820,0x8194d2bac0dff6d6,0x86d8a55a30e30183,0xa08080006775f5f0,0x220305c6c5bc97b1,0x3c36e1ebdcee584a,0x4e9ed1a89532ef46,0xf0cb8b411bf6d579,0x00d0e6392ada64d4,0xc6c5bc97b1a08080,0x2fc2b05779450305,0xc9cf47618cc5283e,0xa9e088224807a77e,0xda854e29d2f49646,0x97b1a08080002e74,0xed35180305c6c5bc,0xa78d5545117b8293,0x5c3f8babc16e7062,0xef9324ecd7f86e39,0x808000231900ee9c,0x0305c6c5bc97b1a0,0x0c5bfd9450e89e30,0x194b86e8316970bc,0x5dd8c2e3c2af6ff1,0x4d2ba46f683df89c,0xc5bc97b1a0808000,0xc7cc22ad390305c6,0x891b500cb0799642,0xf5884473a7c01f07,0xeb88d74972d8e36f,0x91ed808000b5d239,0x535a0302fddecd95,0x791c7275cd15d685,0xc2536511d4132e01,0x0c9ad1ee9196aa77,0x80002d55a4efc7d3,0x018e8df2b7f0a080,0x0848b53f974a6a03,0x96b2572cb6015b7d,0xa71b18d2755de52c,0x075e4ca4bd0e4487,0xef93bf82808000ca,0xe23077bc730308f0,0x266a622b7bd9de26,0x4b80410b36c32203,0xb3026d0a2610916c,0xfe8480800084746d,0x6f34b90311e1dea6,0xeb38aee70a8febba,0x8b45df519f0df12e,0x258f0a71e83385da,0x8080000b85701a76,0xdf0308f0ef93bf82,0xb3170ab580f881a3,0x07f0a33f0756a3f4,0xf0721645b2b2bd7b,0x00b0077e03f43a85,0x08f0ef93bf828080,0xf91c1f6308c00f03,0x901a68f4adcc918b,0xad0346f5b7869662,0xd3ed49961fccd915,0xafeaa69a808000f0,0x2c99a01fe90301e3,0xd28642bcae6728d9,0xa6f38c4c630c2b6c,0x2c8a361de6b9294f,0xa69a8080002191e8,0xe134670301e3afea,0x6cf0798aeae985c8,0x4c9b90e1ff211b81,0xc32a954ce05a738b,0x8080009fd2412c6f,0x790301e3afeaa69a,0xb3b0062d6c27a6bb,0x12e133832172b705,0xf3f7d1dfdf336fb8,0x00922d0a879c6027,0x03c6dfd4ccb48080,0x7aa13f278feecf03,0x464f78f86a3e4553,0xa5a464e65c4cf651,0x18f07e7ed8bdd351,0xef93bf82808000dd,0x70b4e3ebae0308f0,0x74c452ecdce312d9,0xca3fb591982461fc,0x3e01aaf9b53ede69,0xfe84808000a4fa65,0x20e5ba0311e1dea6,0xb3e07ec0aabd06a5,0x7bf14a03bf83ccfd,0x6024154f95fd3220,0x808000c13077fa8b,0x5c580316deb183e9,0xc2c948248ab422c3,0xebd3db36bad27d52,0x5fe30392c1525a4e,0x1e00952287d66a6d,0x163df474d5ba8816,0x86f8892015449a71,0x22c93333d9ecb472,0x64fa5516bddfebb3,0x3234373061401303,0x3934353331623633,0x3063626435643130,0x6334636130633932,0x3831383439633530,0x3330336634336332,0x3963306232336630,0x3261623765656133,0x80c9170015633537,0x4c17fba117829117,0x17624a17d2f21711,0xfec81731f9178ced,0x9c17624117a36017,0x1786df17edda1708,0x9ffa17d6e1171b42,0x8b17aa69177ff417,0x179815170a83170c,0xc7e8171ce317da27 },
- { 0x17,0x86,0xd6,0x0e,0x0a,0x00,0x00 } };
+const genesis_tx_raw_data ggenesis_tx_raw = {{
+ 0xe980800100000101,0xfbfa3a0316deb183,0x0e4d0bf7103b2df2,0x682df55627fc33ed,0xcd945b3d70689611,0x16050066b218269a,0x34af8b24a9c955d2,0x3f514b3a2be34ee9,0xb6525b442410e776,0x256d4d83666fb42a,0x6b61742074496b13,0x6e61766461207365,0x20666f2065676174,0x7574616e20656874,0x6e6920666f206572,0x6f6974616d726f66,0x20676e696562206e,0x206f742079736165,0x6220646165727073,0x2064726168207475,0x6c66697473206f74,0x746153202d202e65,0x6b614e206968736f,0x0b00156f746f6d61},
+ {0x02,0x8a,0x56,0x0e,0x0a,0x00,0x00}};
#else
- const genesis_tx_raw_data ggenesis_tx_raw = {{
- 0xd880800500000101,0x0301f2ee9fa8ff8a,0xac88983c159856b0,0x6334c7d1b567f262,0x284f7f961a7b1266,0x8c0c68c45bab62fc,0xe1dea6fe84808000,0x337be98b45240311,0xab6cd1e4c66e5a33,0x70e889d98e70fd57,0xb97de43fb09861d4,0xf9f0cde08000d574,0x0270187703048dba,0xcac58027c0851473,0xaa10d864c4c87b46,0x820d371e2ba469e8,0xfea08000fce35acc,0x357903049598bddf,0x15df9e58bd0002aa,0xc940a97b60484e8d,0xf94f171e77d0b2d9,0x80003602c681487a,0x0304c38fbab1f8e0,0xc2529eba91cf7476,0x0bbee139aab295f9,0xf1cb8c58a828a2ca,0xcac8f5469af83932,0x5c8a1027cc160900,0x50bdcc9348baf32a,0xa7bd03751819d9fd,0xd6acc8dbbb0d9b29,0x3730614013368b02,0x3533316236333234,0x6264356431303934,0x6361306339323063,0x3834396335306334,0x3366343363323831,0x3062323366303330,0x6237656561333963,0x1700156335373261,0xce5017baa917a8f0,0x0a0eefcc17975617},
- {0x00,0x00}};
+const genesis_tx_raw_data ggenesis_tx_raw = {{
+ 0xe980800100000101,0xfbfa3a0316deb183,0x0e4d0bf7103b2df2,0x682df55627fc33ed,0xcd945b3d70689611,0x16050066b218269a,0x34af8b24a9c955d2,0x3f514b3a2be34ee9,0xb6525b442410e776,0x256d4d83666fb42a,0x6b61742074496b13,0x6e61766461207365,0x20666f2065676174,0x7574616e20656874,0x6e6920666f206572,0x6f6974616d726f66,0x20676e696562206e,0x206f742079736165,0x6220646165727073,0x2064726168207475,0x6c66697473206f74,0x746153202d202e65,0x6b614e206968736f,0x0b00156f746f6d61},
+ {0x02,0x8a,0x56,0x0e,0x0a,0x00,0x00}};
#endif
}
diff --git a/src/currency_core/genesis.h b/src/currency_core/genesis.h
index 8ea77d89..df33b37d 100644
--- a/src/currency_core/genesis.h
+++ b/src/currency_core/genesis.h
@@ -4,24 +4,23 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#pragma once
+#pragma once
#include
namespace currency
{
#pragma pack(push, 1)
#ifndef TESTNET
- struct genesis_tx_raw_data
- {
- uint64_t const v[161];
- uint8_t const r[7];
- };
-
+ struct genesis_tx_raw_data
+ {
+ uint64_t const v[42];
+ uint8_t const r[2];
+ };
#else
- struct genesis_tx_raw_data
- {
- uint64_t const v[42];
- uint8_t const r[2];
- };
+ struct genesis_tx_raw_data
+ {
+ uint64_t const v[24];
+ uint8_t const r[7];
+ };
#endif
#pragma pack(pop)
extern const genesis_tx_raw_data ggenesis_tx_raw;
diff --git a/src/currency_core/genesis_acc.cpp b/src/currency_core/genesis_acc.cpp
index f49a9c0a..4df462e1 100644
--- a/src/currency_core/genesis_acc.cpp
+++ b/src/currency_core/genesis_acc.cpp
@@ -10,48 +10,21 @@
namespace currency
{
#ifndef TESTNET
- const std::string ggenesis_tx_pub_key_str = "88bad574f43d16719a44152089f88672b4ecd93333c922b3ebdfbd1655fa6403";
- const crypto::public_key ggenesis_tx_pub_key = epee::string_tools::parse_tpod_from_hex_string(ggenesis_tx_pub_key_str);
- const genesis_tx_dictionary_entry ggenesis_dict[26] = {
- { 898363347618325980ULL,7 },
- { 1234271292339965434ULL,1 },
- { 2785329203593578547ULL,12 },
- { 2912579291078040461ULL,18 },
- { 3515932779881697835ULL,17 },
- { 4955366495399988463ULL,11 },
- { 5233257582118330150ULL,5 },
- { 5931539148443336682ULL,24 },
- { 6436517662239927298ULL,19 },
- { 6604452700210763953ULL,13 },
- { 7200550178847042641ULL,15 },
- { 8712326356392296687ULL,9 },
- { 8863158309745010598ULL,4 },
- { 9048445805125559105ULL,16 },
- { 9527474759752332295ULL,2 },
- { 9647541513390373765ULL,20 },
- { 9921730437908704447ULL,8 },
- { 10751885755236960099ULL,25 },
- { 11032572278436047420ULL,22 },
- { 11109691972771859220ULL,0 },
- { 13554174209305230569ULL,23 },
- { 14297297752337562678ULL,3 },
- { 15636081871140663679ULL,21 },
- { 15951161519112687845ULL,6 },
- { 17146058209502212345ULL,14 },
- { 17472133472787764818ULL,10 }
- };
-#else
- const std::string ggenesis_tx_pub_key_str = "cc27108a5c2af3ba4893ccbd50fdd919187503bda7299b0dbbdbc8acd6028b36";
- const crypto::public_key ggenesis_tx_pub_key = epee::string_tools::parse_tpod_from_hex_string(ggenesis_tx_pub_key_str);
- const genesis_tx_dictionary_entry ggenesis_dict[5] = {
- { 4413532107669521528ULL, 2 },
- { 4848259848862559835ULL, 4 },
- { 4891306118630423916ULL, 1 },
- { 6536034028979999929ULL, 0 },
- { 15528122346224653564ULL, 3 }
+const std::string ggenesis_tx_pub_key_str = "d255c9a9248baf34e94ee32b3a4b513f76e71024445b52b62ab46f66834d6d25";
+const crypto::public_key ggenesis_tx_pub_key = epee::string_tools::parse_tpod_from_hex_string(ggenesis_tx_pub_key_str);
+extern const genesis_tx_dictionary_entry ggenesis_dict[1];
+const genesis_tx_dictionary_entry ggenesis_dict[1] = {
+ {1056117391700764468ULL,0}
};
-#endif
-
+#else
+ const std::string ggenesis_tx_pub_key_str = "d255c9a9248baf34e94ee32b3a4b513f76e71024445b52b62ab46f66834d6d25";
+ const crypto::public_key ggenesis_tx_pub_key = epee::string_tools::parse_tpod_from_hex_string(ggenesis_tx_pub_key_str);
+ extern const genesis_tx_dictionary_entry ggenesis_dict[1];
+ const genesis_tx_dictionary_entry ggenesis_dict[1] = {
+ {1056117391700764468ULL,0}
+ };
+#endif
+
}
diff --git a/src/currency_core/genesis_acc.h b/src/currency_core/genesis_acc.h
index f26ee95f..c923f8c4 100644
--- a/src/currency_core/genesis_acc.h
+++ b/src/currency_core/genesis_acc.h
@@ -23,9 +23,9 @@ struct genesis_tx_dictionary_entry {
#pragma pack(pop)
#ifndef TESTNET
-extern const genesis_tx_dictionary_entry ggenesis_dict[26];
+extern const genesis_tx_dictionary_entry ggenesis_dict[1];
#else
-extern const genesis_tx_dictionary_entry ggenesis_dict[5];
+extern const genesis_tx_dictionary_entry ggenesis_dict[1];
#endif
extern const crypto::public_key ggenesis_tx_pub_key;
diff --git a/src/currency_core/tx_pool.cpp b/src/currency_core/tx_pool.cpp
index 94a69124..4619dd54 100644
--- a/src/currency_core/tx_pool.cpp
+++ b/src/currency_core/tx_pool.cpp
@@ -12,7 +12,7 @@
#include "common/db_backend_selector.h"
#include "tx_pool.h"
#include "currency_boost_serialization.h"
-#include "currency_core/currency_config.h"
+#include "currency_config.h"
#include "blockchain_storage.h"
#include "common/boost_serialization_helper.h"
#include "common/int-util.h"
@@ -37,7 +37,7 @@ DISABLE_VS_WARNINGS(4244 4345 4503) //'boost::foreach_detail_::or_' : decorated
#define CONFLICT_KEY_IMAGE_SPENT_DEPTH_TO_REMOVE_TX_FROM_POOL 50 // if there's a conflict in key images between tx in the pool and in the blockchain this much depth in required to remove correspongin tx from pool
-#undef LOG_DEFAULT_CHANNEL
+#undef LOG_DEFAULT_CHANNEL
#define LOG_DEFAULT_CHANNEL "tx_pool"
ENABLE_CHANNEL_BY_DEFAULT("tx_pool");
@@ -52,7 +52,7 @@ namespace currency
m_db(nullptr, m_dummy_rw_lock),
m_db_transactions(m_db),
m_db_black_tx_list(m_db),
- m_db_solo_options(m_db),
+ m_db_solo_options(m_db),
// m_db_key_images_set(m_db),
m_db_alias_names(m_db),
m_db_alias_addresses(m_db),
@@ -69,13 +69,13 @@ namespace currency
}
const txin_multisig& ms_in = boost::get(tx.vin[0]);
- crypto::hash related_tx_id = null_hash; uint64_t out_no = 0;
+ crypto::hash related_tx_id = null_hash; uint64_t out_no = 0;
if (!m_blockchain.get_multisig_id_details(ms_in.multisig_out_id, related_tx_id, out_no))
{
LOG_ERROR("Related multisig tx not found, multisig_out_id=" << ms_in.multisig_out_id);
return false;
}
-
+
auto related_tx_ptr = m_blockchain.get_tx_chain_entry(related_tx_id);
if (!related_tx_ptr)
{
@@ -83,7 +83,7 @@ namespace currency
<< "(discovered by reviewing tx " << get_transaction_hash(tx) <<") tx not found in blockchain, multisig_out_id=" << ms_in.multisig_out_id);
return false;
}
-
+
if (get_tx_fee(tx) < get_tx_fee(related_tx_ptr->tx))
{
LOG_ERROR("Tx " << get_transaction_hash(tx) << " fee=" << get_tx_fee(tx) << " less then parent multisig tx " << related_tx_id << " fee= " << get_tx_fee(related_tx_ptr->tx));
@@ -109,7 +109,6 @@ namespace currency
// defaults
tvc.m_added_to_pool = false;
tvc.m_verification_failed = true;
-
if (!kept_by_block && !from_core && m_blockchain.is_in_checkpoint_zone())
{
// BCS is in CP zone, tx verification is impossible until it gets synchronized
@@ -139,7 +138,7 @@ namespace currency
", diff: " << epee::misc_utils::get_time_interval_string(ts_median + TX_EXPIRATION_MEDIAN_SHIFT - tx_expiration_time) << ")");
tvc.m_verification_failed = true;
return false;
- }
+ }
TIME_MEASURE_FINISH_PD(expiration_validate_time);
@@ -170,7 +169,7 @@ namespace currency
{
if(!validate_tx_semantic(tx, blob_size))
- {
+ {
// tx semantics check failed
LOG_PRINT_RED_L0("Transaction " << id << " semantics check failed ");
tvc.m_verification_failed = true;
@@ -188,13 +187,13 @@ namespace currency
{
//if (is_valid_contract_finalization_tx(tx))
//{
- // that means tx has less fee then allowed by current tx pull rules, but this transaction is actually
- // a finalization of contract, and template of this contract finalization tx was prepared actually before
+ // that means tx has less fee then allowed by current tx pull rules, but this transaction is actually
+ // a finalization of contract, and template of this contract finalization tx was prepared actually before
// fee rules had been changed, so it's ok, let it in.
//}
//else
{
- // this tx has no fee
+ // this tx has no fee
LOG_PRINT_RED_L0("Transaction " << id << " has too small fee: " << print_money_brief(tx_fee) << ", minimum fee: " << print_money_brief(m_blockchain.get_core_runtime_config().tx_pool_min_fee));
tvc.m_verification_failed = false;
tvc.m_should_be_relayed = false;
@@ -225,7 +224,6 @@ namespace currency
TIME_MEASURE_FINISH_PD(check_inputs_time);
do_insert_transaction(tx, id, blob_size, kept_by_block, tx_fee, ch_inp_res ? max_used_block_id : null_hash, ch_inp_res ? max_used_block_height : 0);
-
TIME_MEASURE_FINISH_PD(tx_processing_time);
tvc.m_added_to_pool = true;
tvc.m_should_be_relayed = ch_inp_res; // relay tx only if it has valid inputs (i.e. do not relay kept_by_block tx with wrong inputs)
@@ -348,7 +346,7 @@ namespace currency
extra_alias_entry eai2 = AUTO_VAL_INIT(eai2);
bool already_have_alias_registered = m_blockchain.get_alias_info(eai.m_alias, eai2);
//size_t alias_size = eai.m_alias.size();
-
+
if (!is_in_block && !eai.m_sign.size() && already_have_alias_registered)
{
LOG_PRINT_L0("Alias \"" << eai.m_alias << "\" already registered in blockchain, transaction rejected");
@@ -360,8 +358,8 @@ namespace currency
if (!is_in_block && !eai.m_sign.size() &&
prev_alias.size())
{
- LOG_PRINT_L0("Address \"" << get_account_address_as_str(eai.m_address)
- << "\" already registered with \""<< prev_alias
+ LOG_PRINT_L0("Address \"" << get_account_address_as_str(eai.m_address)
+ << "\" already registered with \""<< prev_alias
<< "\" alias in blockchain (new alias: \"" << eai.m_alias << "\"), transaction rejected");
r = false;
return false; // stop handling
@@ -408,10 +406,10 @@ namespace currency
//---------------------------------------------------------------------------------
bool tx_memory_pool::take_tx(const crypto::hash &id, transaction &tx, size_t& blob_size, uint64_t& fee)
{
-
+
m_db_transactions.begin_transaction();
misc_utils::auto_scope_leave_caller seh = misc_utils::create_scope_leave_handler([&](){m_db_transactions.commit_transaction();});
-
+
auto txe_tr = m_db_transactions.find(id);
if (txe_tr == m_db_transactions.end())
return false;
@@ -431,13 +429,13 @@ namespace currency
}
//---------------------------------------------------------------------------------
bool tx_memory_pool::remove_stuck_transactions()
- {
+ {
if (!CRITICAL_SECTION_TRY_LOCK(m_remove_stuck_txs_lock))
return true;
CRITICAL_REGION_LOCAL(m_remove_stuck_txs_lock);
CRITICAL_SECTION_UNLOCK(m_remove_stuck_txs_lock);// release try_lock iteration
-
+
m_db_transactions.begin_transaction();
misc_utils::auto_scope_leave_caller seh = misc_utils::create_scope_leave_handler([&](){m_db_transactions.commit_transaction(); });
@@ -450,14 +448,14 @@ namespace currency
transaction tx;
bool kept_by_block;
};
-
+
std::vector to_delete;
const uint64_t tx_expiration_ts_median = m_blockchain.get_tx_expiration_median();
m_db_transactions.enumerate_items([&](uint64_t i, const crypto::hash& h, const tx_details &tx_entry)
{
- //never remove transactions which related to alt blocks,
- //or we can get network split as a worst case (impossible to switch to
+ //never remove transactions which related to alt blocks,
+ //or we can get network split as a worst case (impossible to switch to
//altchain if it won, and node stuck forever).
if (m_blockchain.is_tx_related_to_altblock(h))
return true;
@@ -503,7 +501,7 @@ namespace currency
return true;
});
-
+
for (auto& e : to_delete)
{
m_db_transactions.erase(e.hash);
@@ -514,7 +512,7 @@ namespace currency
return true;
}
//---------------------------------------------------------------------------------
- size_t tx_memory_pool::get_transactions_count() const
+ size_t tx_memory_pool::get_transactions_count() const
{
return m_db_transactions.size();
}
@@ -628,7 +626,7 @@ namespace currency
m_blockchain.fill_tx_rpc_details(trei, ptei->tx, nullptr, id, ptei->receive_time, false);
return true;
- }
+ }
//---------------------------------------------------------------------------------
bool tx_memory_pool::get_transaction(const crypto::hash& id, transaction& tx) const
{
@@ -703,7 +701,7 @@ namespace currency
}
//---------------------------------------------------------------------------------
bool tx_memory_pool::have_tx(const crypto::hash &id) const
- {
+ {
if(m_db_transactions.get(id))
return true;
@@ -746,21 +744,21 @@ namespace currency
}
return false;
}
- //---------------------------------------------------------------------------------
+ //---------------------------------------------------------------------------------
bool tx_memory_pool::on_tx_add(crypto::hash tx_id, const transaction& tx, bool kept_by_block)
{
insert_key_images(tx_id, tx, kept_by_block);
insert_alias_info(tx);
return true;
}
- //---------------------------------------------------------------------------------
+ //---------------------------------------------------------------------------------
bool tx_memory_pool::on_tx_remove(const crypto::hash &id, const transaction& tx, bool kept_by_block)
{
remove_key_images(id, tx, kept_by_block);
remove_alias_info(tx);
return true;
}
- //---------------------------------------------------------------------------------
+ //---------------------------------------------------------------------------------
bool tx_memory_pool::insert_alias_info(const transaction& tx)
{
tx_extra_info ei = AUTO_VAL_INIT(ei);
@@ -774,10 +772,10 @@ namespace currency
return true;
}
- //---------------------------------------------------------------------------------
+ //---------------------------------------------------------------------------------
bool tx_memory_pool::remove_alias_info(const transaction& tx)
{
-
+
tx_extra_info ei = AUTO_VAL_INIT(ei);
bool r = parse_and_validate_tx_extra(tx, ei);
CHECK_AND_ASSERT_MES(r, false, "failed to validate transaction extra on unprocess_blockchain_tx_extra");
@@ -789,7 +787,7 @@ namespace currency
return true;
}
- //---------------------------------------------------------------------------------
+ //---------------------------------------------------------------------------------
bool tx_memory_pool::remove_key_images(const crypto::hash &tx_id, const transaction& tx, bool kept_by_block)
{
CRITICAL_REGION_LOCAL(m_key_images_lock);
@@ -797,7 +795,7 @@ namespace currency
{
crypto::key_image k_image = AUTO_VAL_INIT(k_image);
if (get_key_image_from_txin_v(in, k_image))
- {
+ {
auto it_map = epee::misc_utils::it_get_or_insert_value_initialized(m_key_images, k_image);
auto& id_set = it_map->second;
size_t count_before = id_set.size();
@@ -816,7 +814,7 @@ namespace currency
}
//---------------------------------------------------------------------------------
bool tx_memory_pool::get_key_images_from_tx_pool(key_image_cache& key_images) const
- {
+ {
m_db_transactions.enumerate_items([&](uint64_t i, const crypto::hash& h, const tx_details &tx_entry)
{
for (auto& in : tx_entry.tx.vin)
@@ -854,7 +852,7 @@ namespace currency
//---------------------------------------------------------------------------------
void tx_memory_pool::purge_transactions()
{
-
+
m_db.begin_transaction();
m_db_transactions.clear();
m_db.commit_transaction();
@@ -871,7 +869,7 @@ namespace currency
CIRITCAL_OPERATION(m_key_images,clear());
}
//---------------------------------------------------------------------------------
- bool tx_memory_pool::is_transaction_ready_to_go(tx_details& txd, const crypto::hash& id)const
+ bool tx_memory_pool::is_transaction_ready_to_go(tx_details& txd, const crypto::hash& id)const
{
//not the best implementation at this time, sorry :(
@@ -914,7 +912,7 @@ namespace currency
{
return false;
}
-
+
if (!check_tx_multisig_ins_and_outs(txd.tx, false))
return false;
@@ -923,7 +921,7 @@ namespace currency
return true;
}
//---------------------------------------------------------------------------------
- bool tx_memory_pool::have_key_images(const std::unordered_set& k_images, const transaction& tx)const
+ bool tx_memory_pool::have_key_images(const std::unordered_set& k_images, const transaction& tx)const
{
LOCAL_READONLY_TRANSACTION();
for(size_t i = 0; i!= tx.vin.size(); i++)
@@ -952,14 +950,14 @@ namespace currency
return true;
}
//---------------------------------------------------------------------------------
- std::string tx_memory_pool::print_pool(bool short_format)const
+ std::string tx_memory_pool::print_pool(bool short_format)const
{
std::stringstream ss;
if (short_format)
{
std::list> txs;
{
-
+
m_db_transactions.enumerate_items([&txs](uint64_t i, const crypto::hash& h, const tx_details &tx_entry) { txs.push_back(std::make_pair(h, tx_entry)); return true; });
}
if (txs.empty())
@@ -967,7 +965,7 @@ namespace currency
// sort output by receive time
txs.sort([](const std::pair& lhs, const std::pair& rhs) -> bool { return lhs.second.receive_time < rhs.second.receive_time; });
ss << "# | transaction id | size | fee | ins | outs | outs money | live_time | max used block | last failed block | kept by a block?" << ENDL;
- // 1234 f99fe6d4335fc0ddd69e6880a4d95e0f6ea398de0324a6837021a61c6a31cacd 87157 0.10000111 2000 2000 112000.12345678 d0.h10.m16.s17 123456 <12345..> 123456 <12345..> YES
+ // 1234 f99fe6d4335fc0ddd69e6880a4d95e0f6ea398de0324a6837021a61c6a31cacd 87157 0.10000111 2000 2000 112000.12345678 d0.h10.m16.s17 123456 <12345..> 123456 <12345..> YES
size_t i = 0;
for (auto& tx : txs)
{
@@ -990,9 +988,9 @@ namespace currency
}
return ss.str();
}
-
+
// long format
-
+
m_db_transactions.enumerate_items([&](uint64_t i, const crypto::hash& h, const tx_details &tx_entry)
{
auto& txd = tx_entry;
@@ -1012,32 +1010,32 @@ namespace currency
return ss.str();
}
//---------------------------------------------------------------------------------
- bool tx_memory_pool::fill_block_template(block &bl,
- bool pos,
- size_t median_size,
+ bool tx_memory_pool::fill_block_template(block &bl,
+ bool pos,
+ size_t median_size,
const boost::multiprecision::uint128_t& already_generated_coins,
- size_t &total_size,
- uint64_t &fee,
- uint64_t height,
+ size_t &total_size,
+ uint64_t &fee,
+ uint64_t height,
const std::list& explicit_txs
)
{
LOCAL_READONLY_TRANSACTION();
//typedef transactions_container::value_type txv;
typedef std::pair > txv;
-
+
std::vector txs_v;
txs_v.reserve(m_db_transactions.size());
std::vector txs; // selected transactions, vector of indices of txs_v
-
- //keep getting it as a values cz db items cache will keep it as unserialised object stored by shared ptrs
+
+ //keep getting it as a values cz db items cache will keep it as unserialised object stored by shared ptrs
m_db_transactions.enumerate_keys([&](uint64_t i, crypto::hash& k){txs_v.resize(i + 1); txs_v[i].first = k; return true;});
txs.resize(txs_v.size(), SIZE_MAX);
-
+
for (uint64_t i = 0; i != txs_v.size(); i++)
- {
+ {
auto& k = txs_v[i].first;
txs_v[i].second = m_db_transactions.get(k);
if (!txs_v[i].second)
@@ -1048,8 +1046,8 @@ namespace currency
txs[i] = i;
}
-
-
+
+
std::sort(txs.begin(), txs.end(), [&txs_v](size_t a, size_t b) -> bool {
boost::multiprecision::uint128_t a_, b_;
a_ = boost::multiprecision::uint128_t(txs_v[a].second->fee) * txs_v[b].second->blob_size;
@@ -1073,7 +1071,7 @@ namespace currency
// scan txs for alias reg requests - if there are such requests, don't process alias updates
bool alias_regs_exist = false;
- for (auto txi : txs)
+ for (auto txi : txs)
{
tx_extra_info ei = AUTO_VAL_INIT(ei);
bool r = parse_and_validate_tx_extra(txs_v[txi].second->tx, ei);
@@ -1097,8 +1095,8 @@ namespace currency
{
txs[i] = SIZE_MAX;
continue;
- }
-
+ }
+
// alias checks
tx_extra_info ei = AUTO_VAL_INIT(ei);
bool r = parse_and_validate_tx_extra(tx.second->tx, ei);
@@ -1114,11 +1112,11 @@ namespace currency
}
}
- //is_transaction_ready_to_go can change tx_details in case of some errors, so we make local copy,
+ //is_transaction_ready_to_go can change tx_details in case of some errors, so we make local copy,
//do check if it's changed and reassign it to db if needed
tx_details local_copy_txd = *(tx.second);
bool is_tx_ready_to_go_result = is_transaction_ready_to_go(local_copy_txd, tx.first);
- if (!is_tx_ready_to_go_result &&
+ if (!is_tx_ready_to_go_result &&
(local_copy_txd.last_failed_height != tx.second->last_failed_height || local_copy_txd.last_failed_id != tx.second->last_failed_id))
{
m_db_transactions.begin_transaction();
@@ -1169,7 +1167,7 @@ namespace currency
}
}
}
- // add explicit transactions
+ // add explicit transactions
for (const auto& tx : explicit_txs)
{
fee += get_tx_fee(tx);
@@ -1212,7 +1210,7 @@ namespace currency
}
const std::string db_folder_path = dbbs.get_pool_db_folder_path();
-
+
LOG_PRINT_L0("Loading blockchain from " << db_folder_path << "...");
bool db_opened_okay = false;
@@ -1248,7 +1246,7 @@ namespace currency
if (m_db_storage_major_compatibility_version > 0 && m_db_storage_major_compatibility_version != TRANSACTION_POOL_MAJOR_COMPATIBILITY_VERSION)
{
need_reinit = true;
- LOG_PRINT_MAGENTA("Tx pool DB needs reinit because it has major compatibility ver is " << m_db_storage_major_compatibility_version << ", expected: " << TRANSACTION_POOL_MAJOR_COMPATIBILITY_VERSION, LOG_LEVEL_0);
+ LOG_PRINT_MAGENTA("Tx pool DB needs reinit because it has major compatibility ver is " << m_db_storage_major_compatibility_version << ", expected: " << TRANSACTION_POOL_MAJOR_COMPATIBILITY_VERSION, LOG_LEVEL_0);
}
if (need_reinit)
@@ -1296,7 +1294,7 @@ namespace currency
bool tx_memory_pool::load_keyimages_cache()
{
CRITICAL_REGION_LOCAL(m_key_images_lock);
- return get_key_images_from_tx_pool(m_key_images);
+ return get_key_images_from_tx_pool(m_key_images);
}
//---------------------------------------------------------------------------------
bool tx_memory_pool::deinit()
@@ -1366,9 +1364,9 @@ namespace currency
return false;
}
//---------------------------------------------------------------------------------
- bool tx_memory_pool::check_tx_multisig_ins_and_outs(const transaction& tx, bool check_against_pool_txs) const
+ bool tx_memory_pool::check_tx_multisig_ins_and_outs(const transaction& tx, bool check_against_pool_txs) const
{
-
+
LOCAL_READONLY_TRANSACTION();
std::vector ms_ids;
collect_multisig_ids_from_tx(tx, ms_ids);
@@ -1394,7 +1392,7 @@ namespace currency
LOG_PRINT_L0("Transaction " << get_transaction_hash(tx) << (el.is_input ? " : input #" : " : output #") << el.input_output_index << " has multisig id " << el.multisig_id <<
" that is already in the pool in tx " << get_transaction_hash(tx_entry.tx));
return false;
- }
+ }
return true;
});
if (has_found)
@@ -1406,7 +1404,7 @@ namespace currency
}
}
-#undef LOG_DEFAULT_CHANNEL
+#undef LOG_DEFAULT_CHANNEL
#define LOG_DEFAULT_CHANNEL NULL
diff --git a/src/gui/qt-daemon/application/gui_utils.cpp b/src/gui/gui_utils.cpp
similarity index 98%
rename from src/gui/qt-daemon/application/gui_utils.cpp
rename to src/gui/gui_utils.cpp
index 1a7b66bc..5e922e6d 100644
--- a/src/gui/qt-daemon/application/gui_utils.cpp
+++ b/src/gui/gui_utils.cpp
@@ -28,8 +28,8 @@
// #endif
#include
#include
-#include "currency_core/currency_config.h"
-#define GUI_LINK_NAME "Zano"
+#include "currency_config.h"
+#define GUI_LINK_NAME "Lethean"
#ifdef WIN32
#ifdef _WIN32_WINNT
@@ -245,24 +245,24 @@ namespace gui_tools
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// based on: https://github.com/Mozketo/LaunchAtLoginController/blob/master/LaunchAtLoginController.m
-
+
#include
#include
-
+
LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl);
LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl)
{
SInt32 macos_ver_maj, macos_ver_min;
Gestalt(gestaltSystemVersionMajor, &macos_ver_maj); // very old and deprecated, consider change
Gestalt(gestaltSystemVersionMinor, &macos_ver_min); // very old and deprecated, consider change
-
+
// loop through the list of startup items and try to find the bitcoin app
CFArrayRef listSnapshot = LSSharedFileListCopySnapshot(list, NULL);
for(int i = 0; i < CFArrayGetCount(listSnapshot); i++) {
LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(listSnapshot, i);
UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes;
CFURLRef currentItemURL = NULL;
-
+
#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= 10100
if (&LSSharedFileListItemCopyResolvedURL != NULL && (macos_ver_maj > 10 || (macos_ver_maj == 10 && macos_ver_min >= 10)))
currentItemURL = LSSharedFileListItemCopyResolvedURL(item, resolutionFlags, NULL); // this is available only on macOS 10.10-10.11 (then deprecated)
@@ -273,7 +273,7 @@ namespace gui_tools
#else
LSSharedFileListItemResolve(item, resolutionFlags, ¤tItemURL, NULL);
#endif
-
+
if(currentItemURL && CFEqual(currentItemURL, findUrl)) {
// found
CFRelease(currentItemURL);
@@ -285,7 +285,7 @@ namespace gui_tools
}
return NULL;
}
-
+
bool GetStartOnSystemStartup()
{
CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle());
@@ -293,13 +293,13 @@ namespace gui_tools
LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl);
return !!foundItem; // return boolified object
}
-
+
bool SetStartOnSystemStartup(bool fAutoStart)
{
CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle());
LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl);
-
+
if(fAutoStart && !foundItem) {
// add bitcoin app to startup item list
LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemBeforeFirst, NULL, NULL, bitcoinAppUrl, NULL, NULL);
diff --git a/src/gui/qt-daemon/application/gui_utils.h b/src/gui/gui_utils.h
similarity index 100%
rename from src/gui/qt-daemon/application/gui_utils.h
rename to src/gui/gui_utils.h
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
new file mode 100644
index 00000000..f00644ed
--- /dev/null
+++ b/src/gui/main.cpp
@@ -0,0 +1,49 @@
+#include "websocketclientwrapper.h"
+#include "websockettransport.h"
+#include "mainwindow.h"
+#include "include_base_utils.h"
+
+#include
+#include
+#include
+#include
+#ifdef Q_OS_DARWIN
+# include "urleventfilter.h"
+#endif
+int main(int argc, char** argv)
+{
+// epee::log_space::get_set_log_detalisation_level(true, LOG_LEVEL_0);
+// epee::log_space::get_set_need_thread_id(true, true);
+// epee::log_space::log_singletone::enable_channels("core,currency_protocol,tx_pool,p2p,wallet");
+
+ QApplication app(argc, argv, Qt::SubWindow);
+
+ // setup the QWebSocketServer
+ QWebSocketServer webSocketServer(QStringLiteral("Lethean GUI Backend Server"), QWebSocketServer::NonSecureMode);
+ if(!webSocketServer.listen(QHostAddress::LocalHost, 12345)) {
+ qWarning() << "Failed to open web socket server." << webSocketServer.errorString();
+ return 1;
+ }
+ WebSocketClientWrapper clientWrapper(&webSocketServer);
+
+ // setup the channel
+ QWebChannel channel;
+ QObject::connect(&clientWrapper, &WebSocketClientWrapper::clientConnected,
+ &channel, &QWebChannel::connectTo);
+ MainWindow viewer;
+
+ // register QObjects to be exposed to JavaScript
+ if(!viewer.init_backend(argc, argv)) {
+ return 1;
+ }
+
+ channel.registerObject(QStringLiteral("mediator_object"), &viewer);
+
+#ifdef Q_OS_DARWIN
+ URLEventFilter url_event_filter(&viewer);
+ app.installEventFilter(&url_event_filter);
+#endif
+ app.installNativeEventFilter(&viewer);
+
+ return app.exec();
+}
diff --git a/src/gui/qt-daemon/application/mainwindow.cpp b/src/gui/mainwindow.cpp
similarity index 89%
rename from src/gui/qt-daemon/application/mainwindow.cpp
rename to src/gui/mainwindow.cpp
index d2cc787c..0abeb5f7 100644
--- a/src/gui/qt-daemon/application/mainwindow.cpp
+++ b/src/gui/mainwindow.cpp
@@ -41,7 +41,7 @@ QString make_response_dbg(const T& r, const std::string& location)
return str.c_str();
}
-#define PREPARE_RESPONSE(rsp_type, var_name) view::api_response_t var_name = AUTO_VAL_INIT(var_name)
+#define PREPARE_RESPONSE(rsp_type, var_name) view::api_response_t var_name = AUTO_VAL_INIT(var_name)
#define MAKE_RESPONSE(r) (r.error_code == API_RETURN_CODE_OK || r.error_code == API_RETURN_CODE_TRUE) ? make_response(r) : make_response_dbg(r, LOCATION_STR)
#define LOG_API_TIMING() const char* pfunc_call_name = LOCAL_FUNCTION_DEF__; LOG_PRINT_BLUE("[API:" << pfunc_call_name << "]-->>", LOG_LEVEL_0); uint64_t ticks_before_start = epee::misc_utils::get_tick_count(); \
@@ -67,27 +67,6 @@ QString make_response_dbg(const T& r, const std::string& location)
}
#include "mainwindow.h"
-//
-// void MediatorObject::from_html_to_c(const QString &text)
-// {
-// from_c_to_html(text);
-// }
-//
-// template
-// struct InvokeWrapper {
-// R *receiver;
-// void (C::*memberFun)(Arg);
-// void operator()(Arg result) {
-// (receiver->*memberFun)(result);
-// }
-// };
-//
-// template
-// InvokeWrapper invoke(R *receiver, void (C::*memberFun)(Arg))
-// {
-// InvokeWrapper wrapper = { receiver, memberFun };
-// return wrapper;
-// }
std::wstring convert_to_lower_via_qt(const std::wstring& w)
@@ -100,8 +79,6 @@ MainWindow::MainWindow()
: m_gui_deinitialize_done_1(false)
, m_backend_stopped_2(false)
, m_system_shutdown(false)
- , m_view(nullptr)
- , m_channel(nullptr)
, m_ui_dispatch_id_counter(0)
{
#ifndef _MSC_VER
@@ -113,17 +90,7 @@ MainWindow::MainWindow()
MainWindow::~MainWindow()
{
m_backend.subscribe_to_core_events(nullptr);
- if (m_view)
- {
- m_view->page()->setWebChannel(nullptr);
- m_view = nullptr;
- }
- if (m_channel)
- {
- m_channel->deregisterObject(this);
- delete m_channel;
- m_channel = nullptr;
- }
+
if (m_ipc_worker.joinable())
{
m_ipc_worker.join();
@@ -288,12 +255,12 @@ QString MainWindow::call_rpc(const QString& params)
query_info.m_URI = "/json_rpc";
query_info.m_body = params.toStdString();
-
+
m_backend.get_rpc_server().handle_http_request(query_info, response_info, dummy_context);
if (response_info.m_response_code != 200)
{
- epee::json_rpc::error_response rsp;
- rsp.jsonrpc = "2.0";
+ epee::json_rpc::error_response rsp;
+ rsp.jsonrpc = "2.0";
rsp.error.code = response_info.m_response_code;
rsp.error.message = response_info.m_response_comment;
return QString::fromStdString(epee::serialization::store_t_to_json(static_cast(rsp)));
@@ -322,7 +289,7 @@ QString MainWindow::get_options()
void MainWindow::tray_quit_requested()
{
TRY_ENTRY();
- LOG_PRINT_MAGENTA("[GUI]->[HTML] tray_quit_requested", LOG_LEVEL_0);
+ LOG_PRINT_MAGENTA("[GUI]->[HTML] tray_quit_requested", LOG_LEVEL_0);
emit quit_requested("{}");
CATCH_ENTRY2(void());
}
@@ -331,7 +298,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
{
TRY_ENTRY();
LOG_PRINT_L0("[GUI] CLOSE EVENT");
- CHECK_AND_ASSERT_MES(m_gui_deinitialize_done_1 == m_backend_stopped_2, void(), "m_gui_deinitialize_done_1 != m_backend_stopped_2, m_gui_deinitialize_done_1 = " << m_gui_deinitialize_done_1
+ CHECK_AND_ASSERT_MES(m_gui_deinitialize_done_1 == m_backend_stopped_2, void(), "m_gui_deinitialize_done_1 != m_backend_stopped_2, m_gui_deinitialize_done_1 = " << m_gui_deinitialize_done_1
<< "m_backend_stopped_2 = " << m_backend_stopped_2);
@@ -344,7 +311,6 @@ void MainWindow::closeEvent(QCloseEvent *event)
}
else if (m_gui_deinitialize_done_1 && m_backend_stopped_2)
{
- store_pos(true);
store_app_config();
event->accept();
}
@@ -377,53 +343,6 @@ std::string state_to_text(int s)
CATCH_ENTRY2("");
}
-void MainWindow::changeEvent(QEvent *e)
-{
- TRY_ENTRY();
- switch (e->type())
- {
- case QEvent::WindowStateChange:
- {
- QWindowStateChangeEvent* event = static_cast< QWindowStateChangeEvent* >(e);
- qDebug() << "Old state: " << state_to_text(event->oldState()).c_str() << ", new state: " << state_to_text(this->windowState()).c_str();
-
- if (event->oldState() & Qt::WindowMinimized && !(this->windowState() & Qt::WindowMinimized))
- {
- qDebug() << "Window restored (to normal or maximized state)!";
- if (m_tray_icon)
- {
- //QTimer::singleShot(250, this, SLOT(show()));
- }
- restore_pos();
- }
- else if (!(event->oldState() & Qt::WindowMinimized) && (this->windowState() & Qt::WindowMinimized))
- {
- store_pos();
- qDebug() << "Window minimized";
- show_notification(m_localization[localization_id_minimized_title], m_localization[localization_id_minimized_text]);
- }
- else if (!(event->oldState() & Qt::WindowFullScreen) && (this->windowState() & Qt::WindowFullScreen))
- {
- //maximize
- store_window_pos();
- this->update();
- }
- else if ((event->oldState() & Qt::WindowFullScreen) && !(this->windowState() & Qt::WindowFullScreen))
- {
- //restore
- this->update();
- }
-
- break;
- }
- default:
- break;
- }
-
- QWidget::changeEvent(e);
- CATCH_ENTRY2(void());
-}
-
bool MainWindow::store_app_config()
{
TRY_ENTRY();
@@ -448,42 +367,21 @@ bool MainWindow::load_app_config()
bool MainWindow::init(const std::string& html_path)
{
TRY_ENTRY();
- //QtWebEngine::initialize();
- init_tray_icon(html_path);
- set_html_path(html_path);
m_threads_pool.init(2);
m_backend.subscribe_to_core_events(this);
bool r = QSslSocket::supportsSsl();
- if (r)
- {
+ if (r) {
LOG_PRINT_GREEN("[Support SSL]: YES", LOG_LEVEL_0);
- }
- else
- {
-// QMessageBox::question(this, "OpenSSL support disabled.", "OpenSSL support disabled.",
-// QMessageBox::Ok);
+ } else {
LOG_PRINT_RED("[Support SSL]: NO", LOG_LEVEL_0);
}
- //----
- this->setContextMenuPolicy(Qt::ContextMenuPolicy::NoContextMenu);
- m_view->setContextMenuPolicy(Qt::ContextMenuPolicy::NoContextMenu);
-
return true;
CATCH_ENTRY2(false);
}
-void MainWindow::on_menu_show()
-{
- TRY_ENTRY();
- qDebug() << "Context menu: show()";
- this->show();
- this->activateWindow();
- CATCH_ENTRY2(void());
-}
-
-void MainWindow::init_tray_icon(const std::string& html_path)
+void MainWindow::init_tray_icon()
{
TRY_ENTRY();
if (!QSystemTrayIcon::isSystemTrayAvailable())
@@ -492,40 +390,26 @@ void MainWindow::init_tray_icon(const std::string& html_path)
return;
}
-
- m_restore_action = std::unique_ptr(new QAction(tr("&Restore"), this));
- connect(m_restore_action.get(), SIGNAL(triggered()), this, SLOT(on_menu_show()));
-
m_quit_action = std::unique_ptr(new QAction(tr("&Quit"), this));
connect(m_quit_action.get(), SIGNAL(triggered()), this, SLOT(tray_quit_requested()));
- m_minimize_action = std::unique_ptr(new QAction(tr("minimizeAction"), this));
- connect(m_minimize_action.get(), SIGNAL(triggered()), this, SLOT(showMinimized()));
- m_tray_icon_menu = std::unique_ptr(new QMenu(this));
- m_tray_icon_menu->addAction(m_minimize_action.get());
+ m_tray_icon_menu = std::unique_ptr(new QMenu());
//m_tray_icon_menu->addAction(m_restore_action.get());
- m_tray_icon_menu->addSeparator();
m_tray_icon_menu->addAction(m_quit_action.get());
m_tray_icon = std::unique_ptr(new QSystemTrayIcon(this));
m_tray_icon->setContextMenu(m_tray_icon_menu.get());
-
//setup icon
#ifdef TARGET_OS_MAC
- m_normal_icon_path = html_path + "/files/app22macos.png"; // X11 tray icon size is 22x22
- m_blocked_icon_path = html_path + "/files/app22macos_blocked.png"; // X11 tray icon size is 22x22
+ QIcon qi( ":/lthn.png" );
#else
- m_normal_icon_path = html_path + "/files/app22windows.png"; // X11 tray icon size is 22x22
- m_blocked_icon_path = html_path + "/files/app22windows_blocked.png"; // X11 tray icon size
+ QIcon qi( ":/lthn.png" );
#endif
//setWindowIcon(QIcon(iconPath.c_str()));
- QIcon qi( QString::fromWCharArray(epee::string_encoding::utf8_to_wstring(m_normal_icon_path).c_str()) );
- qi.setIsMask(true);
+ //qi.setIsMask(true);
m_tray_icon->setIcon(qi);
- m_tray_icon->setToolTip(CURRENCY_NAME_BASE);
- connect(m_tray_icon.get(), SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
- this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
+ m_tray_icon->setToolTip( "Lethean Blockchain API Server");
m_tray_icon->show();
CATCH_ENTRY2(void());
}
@@ -682,35 +566,6 @@ QString MainWindow::on_request_quit()
CATCH_ENTRY2(API_RETURN_CODE_INTERNAL_ERROR);
}
-bool MainWindow::do_close()
-{
- TRY_ENTRY();
- this->close();
- return true;
- CATCH_ENTRY2(false);
-}
-
-bool MainWindow::show_inital()
-{
- TRY_ENTRY();
- if (load_app_config())
- restore_pos(true);
- else
- {
- m_config = AUTO_VAL_INIT(m_config);
- this->show();
- QSize sz = AUTO_VAL_INIT(sz);
- sz.setHeight(770);
- sz.setWidth(1200);
- this->resize(sz);
- store_window_pos();
- m_config.is_maximazed = false;
- m_config.is_showed = true;
- m_config.disable_notifications = false;
- }
- return true;
- CATCH_ENTRY2(false);
-}
bool MainWindow::on_backend_stopped()
{
@@ -721,7 +576,7 @@ bool MainWindow::on_backend_stopped()
// if (m_quit_requested)
// {
- /*bool r = */QMetaObject::invokeMethod(this, "do_close", Qt::QueuedConnection);
+// /*bool r = */QMetaObject::invokeMethod(this, "do_close", Qt::QueuedConnection);
// }
return true;
CATCH_ENTRY2(false);
@@ -747,14 +602,6 @@ bool MainWindow::update_daemon_status(const view::daemon_status_info& info)
}
-bool MainWindow::show_msg_box(const std::string& message)
-{
- TRY_ENTRY();
- QMessageBox::information(this, "Error", message.c_str(), QMessageBox::Ok);
- return true;
- CATCH_ENTRY2(false);
-}
-
void qt_log_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
QByteArray local_msg = msg.toLocal8Bit();
@@ -790,13 +637,13 @@ bool MainWindow::remove_ipc()
}
return true;
}
-
+
bool MainWindow::init_ipc_server()
{
- //in case previous instance wasn't close graceful, ipc channel will remain open and new creation will fail, so we
- //trying to close it anyway before open, to make sure there are no dead channels. If there are another running instance, it wom't
+ //in case previous instance wasn't close graceful, ipc channel will remain open and new creation will fail, so we
+ //trying to close it anyway before open, to make sure there are no dead channels. If there are another running instance, it wom't
//let channel to close, so it will fail later on creating channel
remove_ipc();
#define GUI_IPC_BUFFER_SIZE 10000
@@ -825,7 +672,7 @@ bool MainWindow::init_ipc_server()
buff.resize(recvd_size, '*');
handle_ipc_event(buff);//todo process token
}
- }
+ }
remove_ipc();
LOG_PRINT_L0("IPC Handling thread finished");
}
@@ -903,20 +750,12 @@ bool MainWindow::init_backend(int argc, char* argv[])
return false;
}
- if (!init_window())
- {
- this->show_msg_box("Failed to main screen launch, check logs for the more detais.");
- return false;
- }
-
if (!m_backend.init(this))
{
this->show_msg_box("Failed to initialize backend, check debug logs for more details.");
return false;
}
-
-
if (m_backend.is_qt_logs_enabled())
{
qInstallMessageHandler(qt_log_message_handler);
@@ -929,6 +768,8 @@ bool MainWindow::init_backend(int argc, char* argv[])
return false;
}
+ init_tray_icon();
+
return true;
CATCH_ENTRY2(false);
}
@@ -995,11 +836,11 @@ bool MainWindow::update_wallet_status(const view::wallet_status_info& wsi)
{
TRY_ENTRY();
m_wallet_states->operator [](wsi.wallet_id) = wsi.wallet_state;
-
+
std::string json_str_pub;
epee::serialization::store_t_to_json(static_cast(wsi), json_str_pub, 0, epee::serialization::eol_lf);
LOG_PRINT_L0(get_wallet_log_prefix(wsi.wallet_id) + "SENDING SIGNAL -> [update_wallet_status]:" << std::endl << json_str_pub);
-
+
std::string json_str;
epee::serialization::store_t_to_json(wsi, json_str, 0, epee::serialization::eol_lf);
QMetaObject::invokeMethod(this, "update_wallet_status", Qt::QueuedConnection, Q_ARG(QString, json_str.c_str()));
@@ -1069,7 +910,7 @@ bool MainWindow::update_wallets_info(const view::wallets_summary_info& wsi)
std::string json_str;
epee::serialization::store_t_to_json(wsi, json_str, 0, epee::serialization::eol_lf);
LOG_PRINT_L0("SENDING SIGNAL -> [update_wallets_info]"<< std::endl << json_str );
-
+
QMetaObject::invokeMethod(this, "update_wallets_info", Qt::QueuedConnection, Q_ARG(QString, json_str.c_str()));
return true;
CATCH_ENTRY2(false);
@@ -1123,7 +964,7 @@ bool MainWindow::money_transfer(const view::transfer_event_info& tei)
else if (tei.ti.unlock_time)
msg += m_localization[localization_id_locked];
-
+
show_notification(title, msg);
return true;
@@ -1154,21 +995,6 @@ bool MainWindow::wallet_sync_progress(const view::wallet_sync_progres_param& p)
CATCH_ENTRY2(false);
}
-bool MainWindow::set_html_path(const std::string& path)
-{
- TRY_ENTRY();
- //init_tray_icon(path);
-#ifdef _MSC_VER
- QString url = QString::fromUtf8(path.c_str()) + "/index.html";
- load_file(url);
-#else
-// load_file(QString((std::string("file://") + path + "/index.html").c_str()));
- load_file(QString((std::string("") + path + "/index.html").c_str()));
-#endif
- return true;
- CATCH_ENTRY2(false);
-}
-
bool MainWindow::pos_block_found(const currency::block& block_found)
{
TRY_ENTRY();
@@ -1353,7 +1179,7 @@ void MainWindow::on_core_event(const std::string event_name, const currency::cor
std::string get_events_que_json_string(const std::list& eq, std::string& methods_list)
{
TRY_ENTRY();
- //t the moment portable_storage is not supporting polymorphic objects lists, so
+ //t the moment portable_storage is not supporting polymorphic objects lists, so
//there is no hope to make serialization with variant list, lets handle it manual
std::stringstream ss;
ss << "{ \"events\" : [";
@@ -1385,13 +1211,13 @@ void MainWindow::on_complete_events()
TIME_MEASURE_START_MS(json_buff_generate_time);
std::string json_buff = get_events_que_json_string(m_events.m_que, methods_list);
TIME_MEASURE_FINISH_MS(json_buff_generate_time);
-
+
QMetaObject::invokeMethod(this, "on_core_event",
Qt::QueuedConnection,
Q_ARG(QString, QString(json_buff.c_str())));
TIME_MEASURE_FINISH_MS(core_events_handl_time);
- LOG_PRINT_L0("SENT SIGNAL -> [CORE_EVENTS]: " << m_events.m_que.size()
+ LOG_PRINT_L0("SENT SIGNAL -> [CORE_EVENTS]: " << m_events.m_que.size()
<< ", handle_time: " << core_events_handl_time << "(json: " << json_buff_generate_time << ")ms, json_buff size = " << json_buff.size() << ", methods: " << methods_list);
LOG_PRINT_L2("CORE_EVENTS sent signal details: " << ENDL << json_buff);
m_events.m_que.clear();
@@ -1451,7 +1277,7 @@ QString MainWindow::get_secure_app_data(const QString& param)
std::string filename = m_backend.get_config_folder() + "/" + GUI_SECURE_CONFIG_FILENAME;
std::string res_body;
- std::string rsp_code = tools::load_encrypted_file(filename, pwd.pass, res_body, APP_DATA_FILE_BINARY_SIGNATURE);
+ std::string rsp_code = tools::load_encrypted_file(filename, pwd.pass, res_body, APP_DATA_FILE_BINARY_SIGNATURE);
if (rsp_code != API_RETURN_CODE_OK)
{
view::api_response ar;
@@ -1510,7 +1336,7 @@ QString MainWindow::check_master_password(const QString& param)
crypto::hash master_password_hash = crypto::cn_fast_hash(&master_password_pre_hash, sizeof master_password_pre_hash);
crypto::hash pwd_pre_hash = crypto::cn_fast_hash(pwd.pass.c_str(), pwd.pass.length());
crypto::hash pwd_hash = crypto::cn_fast_hash(&pwd_pre_hash, sizeof pwd_pre_hash);
-
+
if (m_master_password != pwd.pass)
{
ar.error_code = API_RETURN_CODE_WRONG_PASSWORD;
@@ -1596,7 +1422,7 @@ QString MainWindow::store_to_file(const QString& path, const QString& buff)
return API_RETURN_CODE_ACCESS_DENIED;
}
-
+
CATCH_ENTRY2(API_RETURN_CODE_INTERNAL_ERROR);
}
@@ -1721,7 +1547,7 @@ QString MainWindow::set_log_level(const QString& param)
epee::log_space::get_set_log_detalisation_level(true, lvl.v);
default_ar.error_code = API_RETURN_CODE_OK;
LOG_PRINT("[LOG LEVEL]: set to " << lvl.v, LOG_LEVEL_MIN);
-
+
return MAKE_RESPONSE(default_ar);
CATCH_ENTRY_FAIL_API_RESPONCE();
}
@@ -1759,23 +1585,23 @@ QString MainWindow::set_enable_tor(const QString& param)
// QString path = QFileDialog::getOpenFileName(this, "Select file",
// "",
// "");
-//
+//
// if (!path.length())
// {
// ar.error_code = API_RETURN_CODE_CANCELED;
// return MAKE_RESPONSE(ar);
// }
-//
+//
// currency::COMMAND_RPC_GET_OFFERS_EX::response rp = AUTO_VAL_INIT(rp);
// ar.error_code = m_backend.get_all_offers(rp);
-//
+//
// std::string buff = epee::serialization::store_t_to_json(rp);
// bool r = file_io_utils::save_string_to_file(path.toStdString(), buff);
// if (!r)
// ar.error_code = API_RETURN_CODE_FAIL;
// else
// ar.error_code = API_RETURN_CODE_OK;
-//
+//
// return MAKE_RESPONSE(ar);
// }
@@ -1787,55 +1613,6 @@ QString MainWindow::webkit_launched_script()
CATCH_ENTRY2(API_RETURN_CODE_INTERNAL_ERROR);
}
////////////////////
-QString MainWindow::show_openfile_dialog(const QString& param)
-{
- TRY_ENTRY();
- view::system_filedialog_request ofdr = AUTO_VAL_INIT(ofdr);
- view::system_filedialog_response ofdres = AUTO_VAL_INIT(ofdres);
- if (!epee::serialization::load_t_from_json(ofdr, param.toStdString()))
- {
- ofdres.error_code = API_RETURN_CODE_BAD_ARG;
- return epee::serialization::store_t_to_json(ofdres, 0, epee::serialization::eol_lf).c_str();
- }
-
- QString path = QFileDialog::getOpenFileName(this, ofdr.caption.c_str(),
- ofdr.default_dir.c_str(),
- ofdr.filemask.c_str());
-
- if (!path.length())
- {
- ofdres.error_code = API_RETURN_CODE_CANCELED;
- return epee::serialization::store_t_to_json(ofdres, 0, epee::serialization::eol_lf).c_str();
- }
-
- ofdres.error_code = API_RETURN_CODE_OK;
- ofdres.path = path.toStdString();
- return MAKE_RESPONSE(ofdres);
- CATCH_ENTRY_FAIL_API_RESPONCE();
-}
-
-
-QString MainWindow::show_savefile_dialog(const QString& param)
-{
- TRY_ENTRY();
- PREPARE_ARG_FROM_JSON(view::system_filedialog_request, ofdr);
- view::system_filedialog_response ofdres = AUTO_VAL_INIT(ofdres);
-
- QString path = QFileDialog::getSaveFileName(this, ofdr.caption.c_str(),
- ofdr.default_dir.c_str(),
- ofdr.filemask.c_str());
-
- if (!path.length())
- {
- ofdres.error_code = API_RETURN_CODE_CANCELED;
- return epee::serialization::store_t_to_json(ofdres, 0, epee::serialization::eol_lf).c_str();
- }
-
- ofdres.error_code = API_RETURN_CODE_OK;
- ofdres.path = path.toStdString();
- return MAKE_RESPONSE(ofdres);
- CATCH_ENTRY_FAIL_API_RESPONCE();
-}
QString MainWindow::close_wallet(const QString& param)
{
@@ -2051,7 +1828,7 @@ QString MainWindow::push_offer(const QString& param)
ar.error_code = m_backend.push_offer(a.wallet_id, a.od, res_tx);
if (ar.error_code != API_RETURN_CODE_OK)
return MAKE_RESPONSE(ar);
-
+
ar.response_data.success = true;
ar.response_data.tx_hash = string_tools::pod_to_hex(currency::get_transaction_hash(res_tx));
ar.response_data.tx_blob_size = currency::get_object_blobsize(res_tx);
@@ -2340,43 +2117,6 @@ QString MainWindow::get_seed_phrase_info(const QString& param)
CATCH_ENTRY_FAIL_API_RESPONCE();
}
-void MainWindow::contextMenuEvent(QContextMenuEvent * event)
-{
- TRY_ENTRY();
-
- CATCH_ENTRY2(void());
-}
-QString MainWindow::print_text(const QString& param)
-{
- TRY_ENTRY();
- LOG_API_TIMING();
- PREPARE_ARG_FROM_JSON(view::print_text_param, ptp);
-
- //in >> htmlContent;
-
- QTextDocument *document = new QTextDocument();
- document->setHtml(ptp.html_text.c_str());
-
- QPrinter printer;
- default_ar.error_code = API_RETURN_CODE_CANCELED;
-
- QPrintDialog *dialog = new QPrintDialog(&printer, this);
- dialog->setOptions(QAbstractPrintDialog::PrintToFile);
- auto res = dialog->exec();
- if (res != QDialog::Accepted)
- {
- LOG_PRINT_L0("[PRINT_TEXT] exec != QDialog::Accepted, res=" << res);
- return MAKE_RESPONSE(default_ar);
- }
-
- document->print(&printer);
-
- delete document;
- default_ar.error_code = API_RETURN_CODE_OK;
- LOG_PRINT_L0("[PRINT_TEXT] default_ar.error_code = " << default_ar.error_code);
- return MAKE_RESPONSE(default_ar);
- CATCH_ENTRY_FAIL_API_RESPONCE();
-}
QString MainWindow::print_log(const QString& param)
{
@@ -2394,9 +2134,9 @@ void MainWindow::show_notification(const std::string& title, const std::string&
{
TRY_ENTRY();
LOG_PRINT_L1("system notification: \"" << title << "\", \"" << message << "\"");
-
+
// it's expected that title and message are utf-8 encoded!
-
+
#if !defined(__APPLE__)
// use Qt tray icon to show messages on Windows and Linux
CHECK_AND_ASSERT_MES(m_tray_icon != nullptr, (void)(0), "m_tray_icon is null!");
@@ -2407,5 +2147,13 @@ void MainWindow::show_notification(const std::string& title, const std::string&
#endif
CATCH_ENTRY2(void());
}
-
-
+QString MainWindow::get_wallet_info(const QString& param)
+{
+ TRY_ENTRY();
+ LOG_API_TIMING();
+ PREPARE_ARG_FROM_JSON(view::wallet_id_obj, waid);
+ PREPARE_RESPONSE(view::wallet_info, ar);
+ ar.error_code = m_backend.get_wallet_info(waid.wallet_id, ar.response_data);
+ return MAKE_RESPONSE(ar);
+ CATCH_ENTRY_FAIL_API_RESPONCE();
+}
diff --git a/src/gui/qt-daemon/application/mainwindow.h b/src/gui/mainwindow.h
similarity index 91%
rename from src/gui/qt-daemon/application/mainwindow.h
rename to src/gui/mainwindow.h
index ed980f7d..88c13b42 100644
--- a/src/gui/qt-daemon/application/mainwindow.h
+++ b/src/gui/mainwindow.h
@@ -32,15 +32,15 @@ QT_END_NAMESPACE
// class MediatorObject : public QObject
// {
// Q_OBJECT
-//
+//
// public:
-//
+//
// signals :
// /*!
// This signal is emitted from the C++ side and the text displayed on the HTML client side.
// */
// void from_c_to_html(const QString &text);
-//
+//
// public slots:
// /*!
// This slot is invoked from the HTML client side and the text displayed on the server side.
@@ -49,25 +49,24 @@ QT_END_NAMESPACE
// };
//
-class MainWindow : public QMainWindow,
+class MainWindow : public QObject,
public currency::i_core_event_handler,
- public view::i_view,
+ public view::i_view,
public QAbstractNativeEventFilter
{
Q_OBJECT
-public:
+ public:
MainWindow();
~MainWindow();
bool init_backend(int argc, char* argv[]);
- bool show_inital();
void show_notification(const std::string& title, const std::string& message);
bool handle_ipc_event(const std::string& arguments);
struct app_config
{
-
+
epee::kvserializable_pair m_window_position;
epee::kvserializable_pair m_window_size;
bool is_maximazed;
@@ -86,12 +85,9 @@ public:
protected slots:
void on_load_finished(bool ok);
- bool do_close();
public slots:
- QString show_openfile_dialog(const QString& param);
- QString show_savefile_dialog(const QString& param);
QString open_wallet(const QString& param);
QString get_my_offers(const QString& param);
QString get_fav_offers(const QString& param);
@@ -157,7 +153,6 @@ public:
QString toggle_autostart(const QString& param);
QString is_valid_restore_wallet_text(const QString& param);
QString get_seed_phrase_info(const QString& param);
- QString print_text(const QString& param);
QString print_log(const QString& param);
QString set_clipboard(const QString& param);
QString set_localization_strings(const QString str);
@@ -167,16 +162,15 @@ public:
QString get_exchange_last_top(const QString& params);
QString get_tx_pool_info();
QString get_default_fee();
- QString get_options();
+ QString get_options();
void bool_toggle_icon(const QString& param);
- QString add_custom_asset_id(const QString& param);
+QString add_custom_asset_id(const QString& param);
QString remove_custom_asset_id(const QString& param);
QString get_wallet_info(const QString& param);
QString create_ionic_swap_proposal(const QString& param);
QString get_ionic_swap_proposal_info(const QString& param);
QString accept_ionic_swap_proposal(const QString& param);
-
bool get_is_disabled_notifications();
bool set_is_disabled_notifications(const bool& param);
QString export_wallet_history(const QString& param);
@@ -184,15 +178,13 @@ public:
//QString check_available_sources(const QString& param);
QString open_url_in_browser(const QString& param);
- void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
void tray_quit_requested();
- void on_menu_show();
QString is_remnotenode_mode_preconfigured();
QString start_backend(const QString& params);
QString async_call(const QString& func_name, const QString& params);
QString sync_call(const QString& func_name, const QString& params);
-
+ QString get_wallet_info(const QString& param);
//for test purposes onlys
QString request_dummy();
@@ -223,7 +215,6 @@ private:
//------- i_view ---------
virtual bool update_daemon_status(const view::daemon_status_info& info);
virtual bool on_backend_stopped();
- virtual bool show_msg_box(const std::string& message);
virtual bool update_wallet_status(const view::wallet_status_info& wsi);
virtual bool update_wallets_info(const view::wallets_summary_info& wsi);
virtual bool money_transfer(const view::transfer_event_info& tei);
@@ -239,35 +230,24 @@ private:
void closeEvent(QCloseEvent *event);
- void contextMenuEvent(QContextMenuEvent * event);
- void changeEvent(QEvent *e);
void on_maximized();
bool handle_deeplink_params_in_commandline();
//void setOrientation(Qt::ScreenOrientation orientation);
-
-
- void init_tray_icon(const std::string& htmlPath);
+
+
+ void init_tray_icon();
bool set_html_path(const std::string& path);
void load_file(const QString &fileName);
- void store_pos(bool consider_showed = false);
- void store_window_pos();
- void restore_pos(bool consider_showed = false);
bool store_app_config();
bool load_app_config();
bool init_window();
bool init_ipc_server();
bool remove_ipc();
-
+
std::string get_wallet_log_prefix(size_t wallet_id) const { return m_backend.get_wallet_log_prefix(wallet_id); }
-
- //MediatorObject mo;
- // UI
- QWebEngineView *m_view;
- QWebChannel* m_channel;
-
// DATA
wallets_manager m_backend;
//std::atomic m_quit_requested;
@@ -279,7 +259,6 @@ private:
std::string m_master_password;
-
app_config m_config;
epee::locked_object> m_wallet_states;
@@ -287,7 +266,7 @@ private:
struct events_que_struct
{
std::list m_que;
-
+
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(m_que)
END_KV_SERIALIZE_MAP()
@@ -299,10 +278,10 @@ private:
enum localization_string_indices
{
// order is surprisingly important here! (see also updateLocalisation in AppController.js)
- localization_id_quit = 0,
+ localization_id_quit = 0,
localization_id_is_received,
- localization_id_is_confirmed,
- localization_id_income_transfer_unconfirmed,
+ localization_id_is_confirmed,
+ localization_id_income_transfer_unconfirmed,
localization_id_income_transfer_confirmed,
localization_id_mined,
localization_id_locked,
diff --git a/src/gui/qt-daemon/application/notification_helper.h b/src/gui/notification_helper.h
similarity index 100%
rename from src/gui/qt-daemon/application/notification_helper.h
rename to src/gui/notification_helper.h
diff --git a/src/gui/qt-daemon/application/notification_helper.mm b/src/gui/notification_helper.mm
similarity index 100%
rename from src/gui/qt-daemon/application/notification_helper.mm
rename to src/gui/notification_helper.mm
diff --git a/src/gui/qt-daemon/.gitignore b/src/gui/qt-daemon/.gitignore
deleted file mode 100644
index 8a9d35c8..00000000
--- a/src/gui/qt-daemon/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.user
diff --git a/src/gui/qt-daemon/Info.plist.in b/src/gui/qt-daemon/Info.plist.in
deleted file mode 100644
index 8b33aed9..00000000
--- a/src/gui/qt-daemon/Info.plist.in
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
- LSEnvironment
-
-
- BuildMachineOSBuild
- 14E46
- CFBundleDevelopmentRegion
- English
- CFBundleExecutable
- Zano
- CFBundleIconFile
- app.icns
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleLongVersionString
-
- CFBundlePackageType
- APPL
- CFBundleSignature
- ????
- CFBundleVersion
-
- CFBundleIdentifier
- Zano
- CSResourcesFileMapped
-
- DTCompiler
- com.apple.compilers.llvm.clang.1_0
- DTPlatformBuild
- 6E35b
- DTPlatformVersion
- GM
- DTSDKBuild
- 14D125
- DTSDKName
- macosx10.10
- DTXcode
- 0640
- DTXcodeBuild
- 6E35b
- LSRequiresCarbon
-
- NSHumanReadableCopyright
-
- NSHighResolutionCapable
- True
- CFBundleURLTypes
-
-
- CFBundleURLName
- ZanoApp
- CFBundleURLSchemes
-
- zano
-
-
-
-
-
-
diff --git a/src/gui/qt-daemon/app.icns b/src/gui/qt-daemon/app.icns
deleted file mode 100644
index 50e0fad5..00000000
Binary files a/src/gui/qt-daemon/app.icns and /dev/null differ
diff --git a/src/gui/qt-daemon/app.ico b/src/gui/qt-daemon/app.ico
deleted file mode 100644
index 34837e0e..00000000
Binary files a/src/gui/qt-daemon/app.ico and /dev/null differ
diff --git a/src/gui/qt-daemon/app.qrc b/src/gui/qt-daemon/app.qrc
deleted file mode 100644
index b828a450..00000000
--- a/src/gui/qt-daemon/app.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- app.ico
-
-
\ No newline at end of file
diff --git a/src/gui/qt-daemon/app.rc b/src/gui/qt-daemon/app.rc
deleted file mode 100644
index 05c8afbc..00000000
--- a/src/gui/qt-daemon/app.rc
+++ /dev/null
@@ -1,2 +0,0 @@
-
-IDI_ICON1 ICON DISCARDABLE "app.ico"
\ No newline at end of file
diff --git a/src/gui/qt-daemon/qtlogger.h b/src/gui/qt-daemon/qtlogger.h
deleted file mode 100644
index b1ff2e76..00000000
--- a/src/gui/qt-daemon/qtlogger.h
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (c) 2014-2018 Zano Project
-// Copyright (c) 2014-2018 The Louisdor Project
-// Distributed under the MIT/X11 software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#pragma once
-
-#include
-
-//#define QT_CONSOLE_STREAM qDebug()
-
-#define QT_CONSOLE_STREAM(s) \
-{std::stringstream ss; ss << s; fputs(ss.str().c_str(), stderr); fflush(stderr);}
-
-
-
-//fputs(buf.c_str(), stderr);
-//fflush(stderr);
-
-
-void customHandler(QtMsgType type, const char* msg) {
- fputs(msg, stderr);
- fflush(stderr);
-}
-
-
-class qt_console_stream : public epee::log_space::ibase_log_stream
-{
- QDebug db;
-public:
- qt_console_stream() : db(qDebug())
- {
- // Somewhere in your program
- //qInstallMsgHandler(customHandler);
- }
-
- ~qt_console_stream()
- {
- }
-
- int get_type(){ return LOGGER_CONSOLE; }
-
- inline void set_console_color(int color, bool bright)
- {
- switch (color)
- {
- case epee::log_space::console_color_default:
- if (bright)
- {QT_CONSOLE_STREAM("\033[1;37m");}
- else
- {QT_CONSOLE_STREAM("\033[0m");}
- break;
- case epee::log_space::console_color_white:
- if (bright)
- {QT_CONSOLE_STREAM("\033[1;37m");}
- else
- {QT_CONSOLE_STREAM("\033[0;37m");}
- break;
- case epee::log_space::console_color_red:
- if (bright)
- {QT_CONSOLE_STREAM("\033[1;31m");}
- else
- {QT_CONSOLE_STREAM("\033[0;31m");}
- break;
- case epee::log_space::console_color_green:
- if (bright)
- {QT_CONSOLE_STREAM("\033[1;32m");}
- else
- {QT_CONSOLE_STREAM("\033[0;32m");}
- break;
-
- case epee::log_space::console_color_blue:
- if (bright)
- {QT_CONSOLE_STREAM("\033[1;34m");}
- else
- {QT_CONSOLE_STREAM("\033[0;34m");}
- break;
-
- case epee::log_space::console_color_cyan:
- if (bright)
- {QT_CONSOLE_STREAM("\033[1;36m");}
- else
- {QT_CONSOLE_STREAM("\033[0;36m");}
- break;
-
- case epee::log_space::console_color_magenta:
- if (bright)
- {QT_CONSOLE_STREAM("\033[1;35m");}
- else
- {QT_CONSOLE_STREAM("\033[0;35m");}
- break;
-
- case epee::log_space::console_color_yellow:
- if (bright)
- {QT_CONSOLE_STREAM("\033[1;33m");}
- else
- {QT_CONSOLE_STREAM("\033[0;33m");}
- break;
-
- }
- }
-
- inline void reset_console_color()
- {
- {QT_CONSOLE_STREAM("\033[0m");}
- }
-
- virtual bool out_buffer(const char* buffer, int buffer_len, int log_level, int color, const char* plog_name = NULL)
- {
- if (plog_name)
- return true; //skip alternative logs from console
-
- set_console_color(color, log_level < 1);
-
- std::string buf(buffer, buffer_len);
- for (size_t i = 0; i != buf.size(); i++)
- {
- if (buf[i] == 7 || buf[i] == -107)
- buf[i] = '^';
- //remove \n
- //if (i == buf.size()-1)
- // buf[i] = ' ';
- }
-
- QT_CONSOLE_STREAM(buf.c_str());
-
-
- reset_console_color();
- return true;
- }
-
-
-};
diff --git a/src/gui/resources/app22macos.png b/src/gui/resources/app22macos.png
new file mode 100644
index 00000000..8fc0f796
Binary files /dev/null and b/src/gui/resources/app22macos.png differ
diff --git a/src/gui/resources/app22macos_blocked.png b/src/gui/resources/app22macos_blocked.png
new file mode 100644
index 00000000..d4ebb03f
Binary files /dev/null and b/src/gui/resources/app22macos_blocked.png differ
diff --git a/src/gui/resources/app22windows.png b/src/gui/resources/app22windows.png
new file mode 100644
index 00000000..e681d94f
Binary files /dev/null and b/src/gui/resources/app22windows.png differ
diff --git a/src/gui/resources/app22windows_blocked.png b/src/gui/resources/app22windows_blocked.png
new file mode 100644
index 00000000..1e309a5b
Binary files /dev/null and b/src/gui/resources/app22windows_blocked.png differ
diff --git a/src/gui/resources/desktop_linux_icon.png b/src/gui/resources/desktop_linux_icon.png
new file mode 100644
index 00000000..ad457440
Binary files /dev/null and b/src/gui/resources/desktop_linux_icon.png differ
diff --git a/src/gui/resources/files.qrc b/src/gui/resources/files.qrc
new file mode 100644
index 00000000..a42e00bb
--- /dev/null
+++ b/src/gui/resources/files.qrc
@@ -0,0 +1,7 @@
+
+
+ app22macos.png
+ app22windows.png
+ lthn.png
+
+
diff --git a/src/gui/resources/lthn.png b/src/gui/resources/lthn.png
new file mode 100644
index 00000000..0958f345
Binary files /dev/null and b/src/gui/resources/lthn.png differ
diff --git a/src/gui/qt-daemon/application/urleventfilter.cpp b/src/gui/urleventfilter.cpp
similarity index 100%
rename from src/gui/qt-daemon/application/urleventfilter.cpp
rename to src/gui/urleventfilter.cpp
diff --git a/src/gui/qt-daemon/application/urleventfilter.h b/src/gui/urleventfilter.h
similarity index 100%
rename from src/gui/qt-daemon/application/urleventfilter.h
rename to src/gui/urleventfilter.h
diff --git a/src/gui/websocketclientwrapper.cpp b/src/gui/websocketclientwrapper.cpp
new file mode 100644
index 00000000..68c1fb5c
--- /dev/null
+++ b/src/gui/websocketclientwrapper.cpp
@@ -0,0 +1,34 @@
+#include "websocketclientwrapper.h"
+#include "websockettransport.h"
+
+#include
+
+/*!
+ \brief Wraps connected QWebSockets clients in WebSocketTransport objects.
+
+ This code is all that is required to connect incoming WebSockets to the WebChannel. Any kind
+ of remote JavaScript client that supports WebSockets can thus receive messages and access the
+ published objects.
+*/
+
+/*!
+ Construct the client wrapper with the given parent.
+
+ All clients connecting to the QWebSocketServer will be automatically wrapped
+ in WebSocketTransport objects.
+*/
+WebSocketClientWrapper::WebSocketClientWrapper(QWebSocketServer *server, QObject *parent)
+ : QObject(parent)
+ , m_server(server)
+{
+ connect(server, &QWebSocketServer::newConnection,
+ this, &WebSocketClientWrapper::handleNewConnection);
+}
+
+/*!
+ Wrap an incoming WebSocket connection in a WebSocketTransport object.
+*/
+void WebSocketClientWrapper::handleNewConnection()
+{
+ emit clientConnected(new WebSocketTransport(m_server->nextPendingConnection()));
+}
diff --git a/src/gui/websocketclientwrapper.h b/src/gui/websocketclientwrapper.h
new file mode 100644
index 00000000..376fad9a
--- /dev/null
+++ b/src/gui/websocketclientwrapper.h
@@ -0,0 +1,29 @@
+#ifndef WEBSOCKETCLIENTWRAPPER_H
+#define WEBSOCKETCLIENTWRAPPER_H
+
+#include
+
+class WebSocketTransport;
+
+QT_BEGIN_NAMESPACE
+class QWebSocketServer;
+QT_END_NAMESPACE
+
+class WebSocketClientWrapper : public QObject
+{
+ Q_OBJECT
+
+ public:
+ explicit WebSocketClientWrapper(QWebSocketServer *server, QObject *parent = nullptr);
+
+ signals:
+ void clientConnected(WebSocketTransport *client);
+
+ private slots:
+ void handleNewConnection();
+
+ private:
+ QWebSocketServer *m_server;
+};
+
+#endif // WEBSOCKETCLIENTWRAPPER_H
diff --git a/src/gui/websockettransport.cpp b/src/gui/websockettransport.cpp
new file mode 100644
index 00000000..145ff8b3
--- /dev/null
+++ b/src/gui/websockettransport.cpp
@@ -0,0 +1,64 @@
+#include "websockettransport.h"
+
+#include
+#include
+#include
+#include
+
+/*!
+ \brief QWebChannelAbstractSocket implementation that uses a QWebSocket internally.
+
+ The transport delegates all messages received over the QWebSocket over its
+ textMessageReceived signal. Analogously, all calls to sendTextMessage will
+ be send over the QWebSocket to the remote client.
+*/
+
+/*!
+ Construct the transport object and wrap the given socket.
+
+ The socket is also set as the parent of the transport object.
+*/
+WebSocketTransport::WebSocketTransport(QWebSocket *socket)
+ : QWebChannelAbstractTransport(socket)
+ , m_socket(socket)
+{
+ connect(socket, &QWebSocket::textMessageReceived,
+ this, &WebSocketTransport::textMessageReceived);
+ connect(socket, &QWebSocket::disconnected,
+ this, &WebSocketTransport::deleteLater);
+}
+
+/*!
+ Destroys the WebSocketTransport.
+*/
+WebSocketTransport::~WebSocketTransport()
+{
+ m_socket->deleteLater();
+}
+
+/*!
+ Serialize the JSON message and send it as a text message via the WebSocket to the client.
+*/
+void WebSocketTransport::sendMessage(const QJsonObject &message)
+{
+ QJsonDocument doc(message);
+ m_socket->sendTextMessage(QString::fromUtf8(doc.toJson(QJsonDocument::Compact)));
+}
+
+/*!
+ Deserialize the stringified JSON messageData and emit messageReceived.
+*/
+void WebSocketTransport::textMessageReceived(const QString &messageData)
+{
+ QJsonParseError error;
+ QJsonDocument message = QJsonDocument::fromJson(messageData.toUtf8(), &error);
+ if (error.error) {
+ qWarning() << "Failed to parse text message as JSON object:" << messageData
+ << "Error is:" << error.errorString();
+ return;
+ } else if (!message.isObject()) {
+ qWarning() << "Received JSON message that is not an object: " << messageData;
+ return;
+ }
+ emit messageReceived(message.object(), this);
+}
diff --git a/src/gui/websockettransport.h b/src/gui/websockettransport.h
new file mode 100644
index 00000000..b3018385
--- /dev/null
+++ b/src/gui/websockettransport.h
@@ -0,0 +1,26 @@
+#ifndef WEBSOCKETTRANSPORT_H
+#define WEBSOCKETTRANSPORT_H
+
+#include
+
+QT_BEGIN_NAMESPACE
+class QWebSocket;
+QT_END_NAMESPACE
+
+class WebSocketTransport : public QWebChannelAbstractTransport
+{
+ Q_OBJECT
+ public:
+ explicit WebSocketTransport(QWebSocket *socket);
+ virtual ~WebSocketTransport();
+
+ void sendMessage(const QJsonObject &message) override;
+
+ private slots:
+ void textMessageReceived(const QString &message);
+
+ private:
+ QWebSocket *m_socket;
+};
+
+#endif // WEBSOCKETTRANSPORT_H
diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h
index 9ec3cc17..e372aad3 100644
--- a/src/p2p/net_node.h
+++ b/src/p2p/net_node.h
@@ -27,11 +27,11 @@
#include "math_helper.h"
#include "net_node_common.h"
#include "maintainers_info_boost_serialization.h"
-#include "currency_core/currency_config.h"
+#include "currency_config.h"
using namespace epee;
-#undef LOG_DEFAULT_CHANNEL
-#define LOG_DEFAULT_CHANNEL "p2p"
+#undef LOG_DEFAULT_CHANNEL
+#define LOG_DEFAULT_CHANNEL "p2p"
ENABLE_CHANNEL_BY_DEFAULT(LOG_DEFAULT_CHANNEL);
#define CURRENT_P2P_STORAGE_ARCHIVE_VER (CURRENCY_FORMATION_VERSION+13)
@@ -64,13 +64,13 @@ namespace nodetool
public:
typedef t_payload_net_handler payload_net_handler;
// Some code
- node_server(t_payload_net_handler& payload_handler):m_payload_handler(payload_handler),
- m_allow_local_ip(false),
- m_hide_my_port(false),
+ node_server(t_payload_net_handler& payload_handler):m_payload_handler(payload_handler),
+ m_allow_local_ip(false),
+ m_hide_my_port(false),
m_offline_mode(false),
- m_alert_mode(0),
+ m_alert_mode(0),
m_maintainers_entry_local(AUTO_VAL_INIT(m_maintainers_entry_local)),
- m_maintainers_info_local(AUTO_VAL_INIT(m_maintainers_info_local)),
+ m_maintainers_info_local(AUTO_VAL_INIT(m_maintainers_info_local)),
m_startup_time(time(nullptr)),
m_config{},
m_have_address(false),
@@ -99,7 +99,7 @@ namespace nodetool
template
void serialize(Archive &a, const t_version_type ver)
{
- if(ver < CURRENT_P2P_STORAGE_ARCHIVE_VER)
+ if(ver < CURRENT_P2P_STORAGE_ARCHIVE_VER)
return;
time_t local_time = time(nullptr);
a & local_time;
@@ -202,7 +202,7 @@ namespace nodetool
size_t get_random_index_with_fixed_probability(size_t max_index);
bool is_peer_id_used(const peerid_type id);
bool is_peer_used(const peerlist_entry& peer);
- bool is_addr_connected(const net_address& peer);
+ bool is_addr_connected(const net_address& peer);
template
bool try_ping(basic_node_data& node_data, p2p_connection_context& context, const t_callback& cb);
bool make_expected_connections_count(bool white_list, size_t expected_connections);
@@ -222,7 +222,7 @@ namespace nodetool
//debug functions
std::string print_connections_container();
-
+
typedef net_utils::boosted_tcp_server > net_server;
struct config
@@ -262,7 +262,7 @@ namespace nodetool
math_helper::once_a_time_seconds<1> m_connections_maker_interval;
math_helper::once_a_time_seconds<60*30, false> m_peerlist_store_interval;
math_helper::once_a_time_seconds<60> m_remove_dead_conn_interval;
-
+
/*this code is temporary here(to show regular message if need), until we get normal GUI*/
math_helper::once_a_time_seconds<60, false> m_calm_alert_interval;
math_helper::once_a_time_seconds<10, false> m_urgent_alert_interval;
@@ -289,7 +289,7 @@ namespace nodetool
maintainers_entry m_maintainers_entry_local;
uint8_t m_alert_mode;
critical_section m_maintainers_local_lock;
-
+
critical_section m_blocked_ips_lock;
std::map m_blocked_ips;
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 46a39ee5..77f1f518 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -22,7 +22,7 @@
namespace nodetool
{
//zero network before launch
- const static boost::uuids::uuid P2P_NETWORK_ID = { { 0x11, 0x10, 0x01, 0x11, 0x01, 0x01, 0x11, 0x01, 0x10, 0x11, P2P_NETWORK_ID_TESTNET_FLAG, 0x11, 0x01, 0x11, 0x21, P2P_NETWORK_ID_VER} };
+ const static boost::uuids::uuid P2P_NETWORK_ID = { { 0x03, 0x06, 0x09, 0x11, 0x03, 0x06, 0x09, 0x11, 0x10, 0x11, P2P_NETWORK_ID_TESTNET_FLAG, 0x11, 0x01, 0x11, 0x21, P2P_NETWORK_ID_VER} };
namespace
{
@@ -34,7 +34,7 @@ namespace nodetool
const command_line::arg_descriptor > arg_p2p_add_priority_node ("add-priority-node", "Specify list of peers to connect to and attempt to keep the connection open");
const command_line::arg_descriptor arg_p2p_use_only_priority_nodes ("use-only-priority-nodes", "Connect only to priority nodes");
const command_line::arg_descriptor > arg_p2p_seed_node ("seed-node", "Connect to a node to retrieve peer addresses, and disconnect");
- const command_line::arg_descriptor arg_p2p_hide_my_port ("hide-my-port", "Do not announce yourself as peerlist candidate");
+ const command_line::arg_descriptor arg_p2p_hide_my_port ("hide-my-port", "Do not announce yourself as peerlist candidate");
const command_line::arg_descriptor arg_p2p_offline_mode ( "offline-mode", "Don't connect to any node and reject any connections");
const command_line::arg_descriptor arg_p2p_disable_debug_reqs ( "disable-debug-p2p-requests", "Disable p2p debug requests");
const command_line::arg_descriptor arg_p2p_ip_auto_blocking ( "p2p-ip-auto-blocking", "Enable (1) or disable (0) peers auto-blocking by IP <0|1>. Default: 0", 1);
@@ -50,8 +50,8 @@ namespace nodetool
command_line::add_arg(desc, arg_p2p_allow_local_ip);
command_line::add_arg(desc, arg_p2p_add_peer);
command_line::add_arg(desc, arg_p2p_add_priority_node);
- command_line::add_arg(desc, arg_p2p_seed_node);
- command_line::add_arg(desc, arg_p2p_hide_my_port);
+ command_line::add_arg(desc, arg_p2p_seed_node);
+ command_line::add_arg(desc, arg_p2p_hide_my_port);
command_line::add_arg(desc, arg_p2p_offline_mode);
command_line::add_arg(desc, arg_p2p_disable_debug_reqs);
command_line::add_arg(desc, arg_p2p_use_only_priority_nodes);
@@ -69,10 +69,10 @@ namespace nodetool
std::string state_file_path = m_config_folder + "/" + P2P_NET_DATA_FILENAME;
boost::system::error_code ec = AUTO_VAL_INIT(ec);
std::time_t last_update_time = boost::filesystem::last_write_time(state_file_path, ec);
- //let's assume that if p2p peer list file stored more then 2 weeks ago,
- //then it outdated and we need to fetch peerlist from seed nodes
+ //let's assume that if p2p peer list file stored more then 2 weeks ago,
+ //then it outdated and we need to fetch peerlist from seed nodes
if (!ec && time(nullptr) - last_update_time < 86400 * 14)
- {
+ {
tools::unserialize_obj_from_file(*this, state_file_path);
}
@@ -80,7 +80,7 @@ namespace nodetool
m_config.m_peer_id = crypto::rand();
handle_alert_conditions();
-
+
//at this moment we have hardcoded config
m_config.m_net_config.handshake_interval = P2P_DEFAULT_HANDSHAKE_INTERVAL;
m_config.m_net_config.connections_count = P2P_DEFAULT_CONNECTIONS_COUNT;
@@ -111,7 +111,7 @@ namespace nodetool
if (!m_ip_auto_blocking_enabled)
return true;
-
+
return !is_ip_in_blacklist(addr);
}
//-----------------------------------------------------------------------------------
@@ -204,7 +204,7 @@ namespace nodetool
}
if (command_line::has_arg(vm, arg_p2p_add_peer))
- {
+ {
std::vector perrs = command_line::get_arg(vm, arg_p2p_add_peer);
for(const std::string& pr_str: perrs)
{
@@ -217,7 +217,7 @@ namespace nodetool
}
if (command_line::has_arg(vm, arg_p2p_add_priority_node))
- {
+ {
std::vector perrs = command_line::get_arg(vm, arg_p2p_add_priority_node);
for(const std::string& pr_str: perrs)
{
@@ -243,8 +243,8 @@ namespace nodetool
}
}
if(command_line::has_arg(vm, arg_p2p_hide_my_port))
- m_hide_my_port = true;
-
+ m_hide_my_port = true;
+
return true;
}
//-----------------------------------------------------------------------------------
@@ -311,27 +311,12 @@ namespace nodetool
{
#ifndef TESTNET
//TODO:
- //ADD_HARDCODED_SEED_NODE(std::string("0.0.0.0:") + std::to_string(P2P_DEFAULT_PORT));
- ADD_HARDCODED_SEED_NODE("95.217.43.225", P2P_DEFAULT_PORT);
- ADD_HARDCODED_SEED_NODE("94.130.137.230", P2P_DEFAULT_PORT);
- ADD_HARDCODED_SEED_NODE("95.217.42.247", P2P_DEFAULT_PORT);
- ADD_HARDCODED_SEED_NODE("94.130.160.115", P2P_DEFAULT_PORT);
- ADD_HARDCODED_SEED_NODE("195.201.107.230", P2P_DEFAULT_PORT);
- ADD_HARDCODED_SEED_NODE("95.217.46.49", P2P_DEFAULT_PORT);
- ADD_HARDCODED_SEED_NODE("159.69.76.144", P2P_DEFAULT_PORT);
- ADD_HARDCODED_SEED_NODE("144.76.183.143", P2P_DEFAULT_PORT);
+ ADD_HARDCODED_SEED_NODE(SEED_NODE_HOST, P2P_DEFAULT_PORT);
+ ADD_HARDCODED_SEED_NODE(SEED_NODE_HOST2, P2P_DEFAULT_PORT);
#else
- // TESTNET
- ADD_HARDCODED_SEED_NODE("95.217.43.225", P2P_DEFAULT_PORT);
- ADD_HARDCODED_SEED_NODE("94.130.137.230", P2P_DEFAULT_PORT);
- ADD_HARDCODED_SEED_NODE("95.217.42.247", P2P_DEFAULT_PORT);
- ADD_HARDCODED_SEED_NODE("94.130.160.115", P2P_DEFAULT_PORT);
- ADD_HARDCODED_SEED_NODE("195.201.107.230", P2P_DEFAULT_PORT);
- ADD_HARDCODED_SEED_NODE("95.217.46.49", P2P_DEFAULT_PORT);
- ADD_HARDCODED_SEED_NODE("159.69.76.144", P2P_DEFAULT_PORT);
- ADD_HARDCODED_SEED_NODE("144.76.183.143", P2P_DEFAULT_PORT);
+ ADD_HARDCODED_SEED_NODE(SEED_NODE_HOST, P2P_DEFAULT_PORT);
+ ADD_HARDCODED_SEED_NODE(SEED_NODE_HOST2, P2P_DEFAULT_PORT);
#endif
-
bool res = handle_command_line(vm);
CHECK_AND_ASSERT_MES(res, false, "Failed to handle command line");
m_config_folder = command_line::get_arg(vm, command_line::arg_data_dir);
@@ -345,7 +330,7 @@ namespace nodetool
for(auto& p: m_command_line_peers)
m_peerlist.append_with_peer_white(p);
-
+
//only in case if we really sure that we have external visible ip
m_have_address = true;
m_ip_address = 0;
@@ -423,7 +408,7 @@ namespace nodetool
}
std::string state_file_path = m_config_folder + "/" + P2P_NET_DATA_FILENAME;
- tools::serialize_obj_to_file(*this, state_file_path);
+ tools::serialize_obj_to_file(*this, state_file_path);
CATCH_ENTRY_L0("node_server::save", false);
return true;
}
@@ -502,11 +487,11 @@ namespace nodetool
get_local_node_data(arg.node_data);
m_payload_handler.get_payload_sync_data(arg.payload_data);
fill_maintainers_entry(arg.maintrs_entry);
-
+
simple_event ev;
std::atomic hsh_result(false);
-
- bool r = net_utils::async_invoke_remote_command2(context_.m_connection_id, COMMAND_HANDSHAKE::ID, arg, m_net_server.get_config_object(),
+
+ bool r = net_utils::async_invoke_remote_command2(context_.m_connection_id, COMMAND_HANDSHAKE::ID, arg, m_net_server.get_config_object(),
[this, &pi, &ev, &hsh_result, &just_take_peerlist](int code, const typename COMMAND_HANDSHAKE::response& rsp, p2p_connection_context& context)
{
misc_utils::auto_scope_leave_caller scope_exit_handler = misc_utils::create_scope_leave_handler([&](){ev.raise();});
@@ -596,7 +581,7 @@ namespace nodetool
m_payload_handler.get_payload_sync_data(arg.payload_data);
fill_maintainers_entry(arg.maintrs_entry);
- bool r = net_utils::async_invoke_remote_command2(context_.m_connection_id, COMMAND_TIMED_SYNC::ID, arg, m_net_server.get_config_object(),
+ bool r = net_utils::async_invoke_remote_command2(context_.m_connection_id, COMMAND_TIMED_SYNC::ID, arg, m_net_server.get_config_object(),
[this](int code, const typename COMMAND_TIMED_SYNC::response& rsp, p2p_connection_context& context)
{
if(code < 0)
@@ -752,7 +737,7 @@ namespace nodetool
LOG_PRINT_CC_GREEN(con, "CONNECTION HANDSHAKED OK with peer " << string_tools::get_ip_string_from_int32(na.ip) << ":" << string_tools::num_to_string_fast(na.port), LOG_LEVEL_2);
return true;
}
- //-----------------------------------------------------------------------------------
+ //-----------------------------------------------------------------------------------
template
void node_server::cache_connect_fail_info(const net_address& addr)
{
@@ -831,7 +816,7 @@ namespace nodetool
}
LOG_PRINT_L1("Selected peer: " << pe.id << " " << string_tools::get_ip_string_from_int32(pe.adr.ip) << ":" << boost::lexical_cast(pe.adr.port) << "[white=" << use_white_list << "] last_seen: " << (pe.last_seen ? misc_utils::get_time_interval_string(time(NULL) - pe.last_seen) : "never"));
-
+
if(!try_to_connect_and_handshake_with_new_peer(pe.adr, false, pe.last_seen, use_white_list))
{
cache_connect_fail_info(pe.adr);
@@ -855,7 +840,7 @@ namespace nodetool
size_t try_count = 0;
size_t current_index = crypto::rand()%m_seed_nodes.size();
while(true)
- {
+ {
if(m_net_server.is_stop_signal_sent())
return false;
@@ -953,7 +938,7 @@ namespace nodetool
if(curr_time - cntx.m_last_recv > P2P_IDLE_CONNECTION_KILL_INTERVAL && curr_time - cntx.m_last_send > P2P_IDLE_CONNECTION_KILL_INTERVAL)
{
LOG_PRINT_CC_L1(cntx, "Connection dropped due to idle");
- m_net_server.get_config_object().close(cntx.m_connection_id);
+ m_net_server.get_config_object().close(cntx.m_connection_id);
return true;
}
return true;
@@ -1076,7 +1061,7 @@ namespace nodetool
node_data.peer_id = m_config.m_peer_id;
if(!m_hide_my_port)
node_data.my_port = m_external_port ? m_external_port : m_listenning_port;
- else
+ else
node_data.my_port = 0;
node_data.network_id = P2P_NETWORK_ID;
return true;
diff --git a/src/p2p/net_peerlist.h b/src/p2p/net_peerlist.h
index f133683f..0fcb5791 100644
--- a/src/p2p/net_peerlist.h
+++ b/src/p2p/net_peerlist.h
@@ -24,7 +24,7 @@
#include "syncobj.h"
#include "net/local_ip.h"
#include "p2p_protocol_defs.h"
-#include "currency_core/currency_config.h"
+#include "currency_config.h"
#include "net_peerlist_boost_serialization.h"
#include "common/boost_serialization_helper.h"
@@ -39,7 +39,7 @@ namespace nodetool
/************************************************************************/
class peerlist_manager
{
- public:
+ public:
bool init(bool allow_local_ip);
bool deinit();
size_t get_white_peers_count(){CRITICAL_REGION_LOCAL(m_peerlist_lock); return m_peers_white.size();}
@@ -58,7 +58,7 @@ namespace nodetool
void trim_gray_peerlist();
bool remove_peers_by_ip_from_all(const uint32_t ip);
-
+
private:
struct by_time{};
struct by_id{};
@@ -105,11 +105,11 @@ namespace nodetool
boost::multi_index::ordered_unique, boost::multi_index::member >,
// sort by peerlist_entry::last_seen<
boost::multi_index::ordered_non_unique, boost::multi_index::member >
- >
+ >
> peers_indexed;
- public:
-
+ public:
+
template
void serialize(Archive &ar, const t_version_type ver)
{
@@ -138,7 +138,7 @@ namespace nodetool
time_t now = 0;
time(&now);
m_allow_local_ip = allow_local_ip;
-
+
//adjust local time if it somehow was shifted
CRITICAL_REGION_LOCAL(m_peerlist_lock);
peers_indexed::index::type& by_time_index = m_peers_white.get();
@@ -165,7 +165,7 @@ namespace nodetool
return true;
- }
+ }
//--------------------------------------------------------------------------------------------------
inline
bool peerlist_manager::deinit()
@@ -193,7 +193,7 @@ namespace nodetool
}
}
//--------------------------------------------------------------------------------------------------
- inline
+ inline
bool peerlist_manager::merge_peerlist(const std::list& outer_bs)
{
CRITICAL_REGION_LOCAL(m_peerlist_lock);
@@ -202,7 +202,7 @@ namespace nodetool
append_with_peer_gray(be);
}
// delete extra elements
- trim_gray_peerlist();
+ trim_gray_peerlist();
return true;
}
//--------------------------------------------------------------------------------------------------
@@ -230,7 +230,7 @@ namespace nodetool
return true;
}
//--------------------------------------------------------------------------------------------------
- inline
+ inline
bool peerlist_manager::is_ip_allowed(uint32_t ip)
{
//never allow loopback ip
@@ -243,10 +243,10 @@ namespace nodetool
return true;
}
//--------------------------------------------------------------------------------------------------
- inline
+ inline
bool peerlist_manager::get_peerlist_head(std::list& bs_head, uint32_t depth)
{
-
+
CRITICAL_REGION_LOCAL(m_peerlist_lock);
peers_indexed::index::type& by_time_index=m_peers_white.get();
uint32_t cnt = 0;
@@ -254,7 +254,7 @@ namespace nodetool
{
if(!vl.last_seen)
continue;
- bs_head.push_back(vl);
+ bs_head.push_back(vl);
if(cnt++ > depth)
break;
}
@@ -263,18 +263,18 @@ namespace nodetool
//--------------------------------------------------------------------------------------------------
inline
bool peerlist_manager::get_peerlist_full(std::list& pl_gray, std::list& pl_white)
- {
+ {
CRITICAL_REGION_LOCAL(m_peerlist_lock);
peers_indexed::index::type& by_time_index_gr=m_peers_gray.get();
BOOST_REVERSE_FOREACH(const peers_indexed::value_type& vl, by_time_index_gr)
{
- pl_gray.push_back(vl);
+ pl_gray.push_back(vl);
}
peers_indexed::index::type& by_time_index_wt=m_peers_white.get();
BOOST_REVERSE_FOREACH(const peers_indexed::value_type& vl, by_time_index_wt)
{
- pl_white.push_back(vl);
+ pl_white.push_back(vl);
}
return true;
@@ -320,8 +320,8 @@ namespace nodetool
trim_white_peerlist();
}else
{
- //update record in white list
- m_peers_white.replace(by_addr_it_wt, ple);
+ //update record in white list
+ m_peers_white.replace(by_addr_it_wt, ple);
}
//remove from gray list, if need
auto by_addr_it_gr = m_peers_gray.get().find(ple.adr);
@@ -352,11 +352,11 @@ namespace nodetool
{
//put new record into white list
m_peers_gray.insert(ple);
- trim_gray_peerlist();
+ trim_gray_peerlist();
}else
{
- //update record in white list
- m_peers_gray.replace(by_addr_it_gr, ple);
+ //update record in white list
+ m_peers_gray.replace(by_addr_it_gr, ple);
}
return true;
CATCH_ENTRY_L0("peerlist_manager::append_with_peer_gray()", false);
@@ -377,7 +377,7 @@ namespace nodetool
else
++it;
}
-
+
for (auto it = m_peers_gray.begin(); it != m_peers_gray.end();)
{
if (it->adr.ip == ip)
diff --git a/src/p2p/p2p_protocol_defs.h b/src/p2p/p2p_protocol_defs.h
index fe1225f4..f8cf2923 100644
--- a/src/p2p/p2p_protocol_defs.h
+++ b/src/p2p/p2p_protocol_defs.h
@@ -9,7 +9,7 @@
#include
#include "serialization/keyvalue_serialization.h"
#include "misc_language.h"
-#include "currency_core/currency_config.h"
+#include "currency_config.h"
#include "crypto/crypto.h"
namespace nodetool
@@ -19,7 +19,7 @@ namespace nodetool
typedef std::string blobdata;
#pragma pack (push, 1)
-
+
struct net_address
{
uint32_t ip;
@@ -59,7 +59,7 @@ namespace nodetool
{
return memcmp(&a, &b, sizeof(a)) == 0;
}
- inline
+ inline
std::string print_peerlist_to_string(const std::list& pl)
{
time_t now_time = 0;
@@ -94,7 +94,7 @@ namespace nodetool
struct basic_node_data
{
- uuid network_id;
+ uuid network_id;
int64_t local_time;
uint32_t my_port;
peerid_type peer_id;
@@ -106,7 +106,7 @@ namespace nodetool
KV_SERIALIZE(my_port)
END_KV_SERIALIZE_MAP()
};
-
+
#define P2P_COMMANDS_POOL_BASE 1000
@@ -129,7 +129,7 @@ namespace nodetool
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE_N(if_build_less_then, "build")
KV_SERIALIZE_N(alert_mode, "mode")
- END_KV_SERIALIZE_MAP()
+ END_KV_SERIALIZE_MAP()
};
struct maintainers_info
@@ -242,7 +242,7 @@ namespace nodetool
{
int64_t local_time;
t_playload_type payload_data;
- std::list local_peerlist;
+ std::list local_peerlist;
maintainers_entry maintrs_entry;
BEGIN_KV_SERIALIZE_MAP()
@@ -261,7 +261,7 @@ namespace nodetool
struct COMMAND_PING
{
/*
- Used to make "callback" connection, to be sure that opponent node
+ Used to make "callback" connection, to be sure that opponent node
have accessible connection point. Only other nodes can add peer to peerlist,
and ONLY in case when peer has accepted connection and answered to ping.
*/
@@ -285,13 +285,13 @@ namespace nodetool
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(status)
KV_SERIALIZE(peer_id)
- END_KV_SERIALIZE_MAP()
+ END_KV_SERIALIZE_MAP()
};
};
-
+
#ifdef ALLOW_DEBUG_COMMANDS
- //These commands are considered as insecure, and made in debug purposes for a limited lifetime.
+ //These commands are considered as insecure, and made in debug purposes for a limited lifetime.
//Anyone who feel unsafe with this commands can disable the ALLOW_GET_STAT_COMMAND macro.
struct proof_of_trust
@@ -302,9 +302,9 @@ namespace nodetool
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(peer_id)
- KV_SERIALIZE(time)
- KV_SERIALIZE_VAL_POD_AS_BLOB(sign)
- END_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(time)
+ KV_SERIALIZE_VAL_POD_AS_BLOB(sign)
+ END_KV_SERIALIZE_MAP()
};
@@ -320,9 +320,9 @@ namespace nodetool
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(pr)
KV_SERIALIZE(tr)
- END_KV_SERIALIZE_MAP()
+ END_KV_SERIALIZE_MAP()
};
-
+
struct response
{
std::string version;
@@ -337,7 +337,7 @@ namespace nodetool
KV_SERIALIZE(incoming_connections_count)
KV_SERIALIZE(current_log_size)
KV_SERIALIZE(payload_info)
- END_KV_SERIALIZE_MAP()
+ END_KV_SERIALIZE_MAP()
};
};
@@ -354,14 +354,14 @@ namespace nodetool
proof_of_trust tr;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(tr)
- END_KV_SERIALIZE_MAP()
+ END_KV_SERIALIZE_MAP()
};
struct response
{
- std::list local_peerlist_white;
- std::list local_peerlist_gray;
- std::list connections_list;
+ std::list local_peerlist_white;
+ std::list local_peerlist_gray;
+ std::list connections_list;
peerid_type my_id;
uint64_t local_time;
uint64_t up_time;
@@ -372,7 +372,7 @@ namespace nodetool
KV_SERIALIZE(my_id)
KV_SERIALIZE(local_time)
KV_SERIALIZE(up_time)
- END_KV_SERIALIZE_MAP()
+ END_KV_SERIALIZE_MAP()
};
};
@@ -386,7 +386,7 @@ namespace nodetool
struct request
{
BEGIN_KV_SERIALIZE_MAP()
- END_KV_SERIALIZE_MAP()
+ END_KV_SERIALIZE_MAP()
};
struct response
@@ -395,7 +395,7 @@ namespace nodetool
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(my_id)
- END_KV_SERIALIZE_MAP()
+ END_KV_SERIALIZE_MAP()
};
};
@@ -466,7 +466,7 @@ namespace nodetool
};
#endif // #ifdef ALLOW_DEBUG_COMMANDS
-
+
}
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 1a1f1e8e..69f1dc35 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -287,7 +287,7 @@ simple_wallet::simple_wallet()
m_cmd_binder.set_handler("start_mining", boost::bind(&simple_wallet::start_mining, this, ph::_1), "start_mining - Start mining in daemon");
m_cmd_binder.set_handler("stop_mining", boost::bind(&simple_wallet::stop_mining, this, ph::_1), "Stop mining in daemon");
m_cmd_binder.set_handler("refresh", boost::bind(&simple_wallet::refresh, this, ph::_1), "Resynchronize transactions and balance");
- m_cmd_binder.set_handler("balance", boost::bind(&simple_wallet::show_balance, this, ph::_1), "Show current wallet balance");
+ m_cmd_binder.set_handler("balance", boost::bind(&simple_wallet::show_balance, this, ph::_1), "Show current wallet balance");
m_cmd_binder.set_handler("show_staking_history", boost::bind(&simple_wallet::show_staking_history, this, ph::_1), "show_staking_history [2] - Show staking transfers, if option provided - number of days for history to display");
m_cmd_binder.set_handler("incoming_transfers", boost::bind(&simple_wallet::show_incoming_transfers, this, ph::_1), "incoming_transfers [available|unavailable] - Show incoming transfers - all of them or filter them by availability");
m_cmd_binder.set_handler("incoming_counts", boost::bind(&simple_wallet::show_incoming_transfers_counts, this, ph::_1), "incoming_transfers counts");
@@ -540,8 +540,8 @@ void simple_wallet::handle_command_line(const boost::program_options::variables_
m_disable_tor = command_line::get_arg(vm, arg_disable_tor_relay);
m_voting_config_file = command_line::get_arg(vm, arg_voting_config_file);
m_no_password_confirmations = command_line::get_arg(vm, arg_no_password_confirmations);
-
-}
+
+}
//----------------------------------------------------------------------------------------------------
#define PASSWORD_CONFIRMATION_ATTEMPTS 3
@@ -874,7 +874,7 @@ void simple_wallet::on_transfer2(const tools::wallet_public::wallet_transfer_inf
uint64_t decimal_points = CURRENCY_DISPLAY_DECIMAL_POINT;
std::string token_info = get_tocken_info_string(st.asset_id, decimal_points);
- message_writer(epee::log_space::console_color_cyan, false) << " "
+ message_writer(epee::log_space::console_color_cyan, false) << " "
<< std::right << std::setw(18) << print_money_trailing_zeros_replaced_with_spaces(st.amount, decimal_points) << (st.is_income ? " received," : " spent") << " " << token_info;
}
}
@@ -1047,11 +1047,11 @@ bool simple_wallet::print_wti(const tools::wallet_public::wallet_transfer_info&
uint64_t decimal_points = CURRENCY_DISPLAY_DECIMAL_POINT;
std::string token_info = get_tocken_info_string(st.asset_id, decimal_points);
- success_msg_writer(cl)
+ success_msg_writer(cl)
<< (st.is_income ? "Received " : "Sent ")
<< print_money(st.amount, decimal_points) << token_info;
}
-
+
}
return true;
}
@@ -1175,7 +1175,7 @@ bool simple_wallet::show_staking_history(const std::vector& args)
if (n_days)
timestamp = static_cast(time(nullptr)) - (n_days * 60 * 60 * 24);
-
+
uint64_t amount_total_staked = 0;
bool transfers_found = false;
for (auto it = transfers.rbegin(); it != transfers.rend(); it++)
@@ -1192,7 +1192,7 @@ bool simple_wallet::show_staking_history(const std::vector& args)
is_coinbase(td.m_ptx_wallet_info->m_tx, pos_coinbase);
if (!pos_coinbase)
continue;
-
+
if (!transfers_found)
{
message_writer() << " amount \tspent\tglobal index\t tx id";
@@ -1215,7 +1215,7 @@ bool simple_wallet::show_staking_history(const std::vector& args)
success_msg_writer() << "Total staked: " << print_money(amount_total_staked);
}
-
+
return true;
}
@@ -1513,18 +1513,18 @@ bool simple_wallet::validate_wrap_status(uint64_t amount)
currency::void_struct req = AUTO_VAL_INIT(req);
currency::rpc_get_wrap_info_response res = AUTO_VAL_INIT(res);
- bool r = epee::net_utils::invoke_http_json_remote_command2("http://wrapped.zano.org/api2/get_wrap_info", req, res, http_client, 10000);
+ bool r = epee::net_utils::invoke_http_json_remote_command2("http://wrapped.lethean.org/api2/get_wrap_info", req, res, http_client, 10000);
if (!r)
{
fail_msg_writer() << "Failed to request wrap status from server, check internet connection";
return false;
}
//check if amount is bigger then erc20 fee
- uint64_t zano_needed_for_wrap = std::stoll(res.tx_cost.zano_needed_for_erc20);
- if (amount <= zano_needed_for_wrap)
+ uint64_t lethean_needed_for_wrap = std::stoll(res.tx_cost.lethean_needed_for_erc20);
+ if (amount <= lethean_needed_for_wrap)
{
fail_msg_writer() << "Too small amount to cover ERC20 fee. ERC20 cost is: "
- << print_money(zano_needed_for_wrap) << " Zano" <<
+ << print_money(lethean_needed_for_wrap) << " Lethean" <<
"($" << res.tx_cost.usd_needed_for_erc20 << ")";
return false;
}
@@ -1532,11 +1532,11 @@ bool simple_wallet::validate_wrap_status(uint64_t amount)
if (amount > unwrapped_coins_left)
{
fail_msg_writer() << "Amount is bigger than ERC20 tokens left available: "
- << print_money(unwrapped_coins_left) << " wZano";
+ << print_money(unwrapped_coins_left) << " wLethean";
return false;
}
- success_msg_writer(false) << "You'll receive estimate " << print_money(amount - zano_needed_for_wrap) << " wZano (" << print_money(zano_needed_for_wrap)<< " Zano will be used to cover ERC20 fee)";
+ success_msg_writer(false) << "You'll receive estimate " << print_money(amount - lethean_needed_for_wrap) << " wLethean (" << print_money(lethean_needed_for_wrap)<< " Lethean will be used to cover ERC20 fee)";
success_msg_writer(false) << "Proceed? (yes/no)";
while (true)
{
@@ -1613,7 +1613,7 @@ bool simple_wallet::transfer(const std::vector &args_)
{
std::string integrated_payment_id;
currency::tx_destination_entry de = AUTO_VAL_INIT(de);
- de.addr.resize(1);
+ de.addr.resize(1);
bool ok = currency::parse_amount(de.amount, local_args[i + 1]);
if (!ok || 0 == de.amount)
@@ -1628,13 +1628,13 @@ bool simple_wallet::transfer(const std::vector &args_)
fail_msg_writer() << "address is wrong: " << local_args[i];
return true;
}
-
+
//check if address looks like wrapped address
if (is_address_like_wrapped(local_args[i]))
{
success_msg_writer(false) << "Address " << local_args[i] << " recognized as wrapped address, creating wrapping transaction.";
- success_msg_writer(false) << "This transaction will create wZano (\"Wrapped Zano\") which will be sent to the specified address on the Ethereum network.";
+ success_msg_writer(false) << "This transaction will create wLethean (\"Wrapped Lethean\") which will be sent to the specified address on the Ethereum network.";
if (!validate_wrap_status(de.amount))
{
@@ -1693,14 +1693,14 @@ bool simple_wallet::transfer(const std::vector &args_)
if (!m_wallet->is_watch_only())
{
if(wrapped_transaction)
- success_msg_writer(true) << "Transaction successfully sent to wZano custody wallet, id: " << get_transaction_hash(tx) << ", " << get_object_blobsize(tx) << " bytes";
+ success_msg_writer(true) << "Transaction successfully sent to wLethean custody wallet, id: " << get_transaction_hash(tx) << ", " << get_object_blobsize(tx) << " bytes";
else
success_msg_writer(true) << "Transaction successfully sent, id: " << get_transaction_hash(tx) << ", " << get_object_blobsize(tx) << " bytes";
}
else
{
- success_msg_writer(true) << "Transaction prepared for signing and saved into \"zano_tx_unsigned\" file, use full wallet to sign transfer and then use \"submit_transfer\" on this wallet to broadcast the transaction to the network";
- }
+ success_msg_writer(true) << "Transaction prepared for signing and saved into \"lethean_tx_unsigned\" file, use full wallet to sign transfer and then use \"submit_transfer\" on this wallet to broadcast the transaction to the network";
+ }
SIMPLE_WALLET_CATCH_TRY_ENTRY()
return true;
@@ -2071,7 +2071,7 @@ bool simple_wallet::deploy_new_asset(const std::vector &args)
<< "Emitted: " << print_fixed_decimal_point(adb.current_supply, adb.decimal_point) << ENDL
<< "Max emission: " << print_fixed_decimal_point(adb.total_max_supply, adb.decimal_point) << ENDL
;
-
+
SIMPLE_WALLET_CATCH_TRY_ENTRY();
return true;
}
@@ -2254,7 +2254,7 @@ bool simple_wallet::add_custom_asset_id(const std::vector &args)
}
else
{
- success_msg_writer() << "The following custom asset was successfully added to the wallet:" << ENDL
+ success_msg_writer() << "The following custom asset was successfully added to the wallet:" << ENDL
<< " id: " << asset_id << ENDL
<< " title: " << asset_descriptor.full_name << ENDL
<< " ticker: " << asset_descriptor.ticker << ENDL
@@ -2306,7 +2306,7 @@ bool simple_wallet::generate_ionic_swap_proposal(const std::vector
return true;
}
else
- {
+ {
success_msg_writer() << "Generated proposal: " << ENDL << epee::string_tools::buff_to_hex_nodelimer(t_serializable_object_to_blob(proposal));
}
SIMPLE_WALLET_CATCH_TRY_ENTRY();
@@ -2494,7 +2494,7 @@ bool simple_wallet::sweep_below(const std::vector &args)
size_t outs_total = 0, outs_swept = 0;
uint64_t amount_total = 0, amount_swept = 0;
currency::transaction result_tx = AUTO_VAL_INIT(result_tx);
- std::string filename = "zano_tx_unsigned";
+ std::string filename = "lethean_tx_unsigned";
m_wallet->sweep_below(fake_outs_count, addr, amount, payment_id, fee, outs_total, amount_total, outs_swept, amount_swept, &result_tx, &filename);
success_msg_writer(false) << outs_swept << " outputs (" << print_money_brief(amount_swept) << " coins) of " << outs_total << " total (" << print_money_brief(amount_total)
@@ -2675,9 +2675,9 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_params, arg_set_timeout);
command_line::add_arg(desc_params, arg_voting_config_file);
command_line::add_arg(desc_params, arg_no_password_confirmations);
-
-
-
+
+
+
tools::wallet_rpc_server::init_options(desc_params);
@@ -2850,8 +2850,8 @@ int main(int argc, char* argv[])
LOG_PRINT_YELLOW("PoS reward will be sent to another address: " << arg_pos_mining_reward_address_str, LOG_LEVEL_0);
}
}
-
-
+
+
tools::wallet_rpc_server wrpc(wallet_ptr);
bool r = wrpc.init(vm);
diff --git a/src/stratum/stratum_server.cpp b/src/stratum/stratum_server.cpp
index f100efef..e561105f 100644
--- a/src/stratum/stratum_server.cpp
+++ b/src/stratum/stratum_server.cpp
@@ -6,14 +6,14 @@
#include "stratum_server.h"
#include "stratum_helpers.h"
#include "net/abstract_tcp_server2.h"
-#include "currency_core/currency_config.h"
+#include "currency_config.h"
#include "currency_core/currency_core.h"
#include "common/command_line.h"
#include "common/int-util.h"
#include "version.h"
#include "currency_protocol/currency_protocol_handler.h"
-#undef LOG_DEFAULT_CHANNEL
+#undef LOG_DEFAULT_CHANNEL
#define LOG_DEFAULT_CHANNEL "stratum"
ENABLE_CHANNEL_BY_DEFAULT("stratum");
@@ -46,11 +46,11 @@ namespace
const command_line::arg_descriptor arg_stratum_miner_address = {"stratum-miner-address", "Stratum server: miner address. All workers"
" will mine to this address. If not set here, ALL workers should use the very same wallet address as username."
" If set here - they're allowed to log in with username '" WORKER_ALLOWED_USERNAME "' instead of address."};
-
+
const command_line::arg_descriptor arg_stratum_block_template_update_period = {"stratum-template-update-period",
"Stratum server: if there are no new blocks, update block template this often (sec.)", STRATUM_BLOCK_TEMPLATE_UPD_PERIOD_DEFAULT };
const command_line::arg_descriptor arg_stratum_hr_print_interval ("stratum-hr-print-interval", "Stratum server: how often to print hashrate stats (sec.)", STRATUM_TOTAL_HR_PRINT_INTERVAL_S_DEFAULT );
-
+
const command_line::arg_descriptor arg_stratum_vdiff_target_min ("stratum-vdiff-target-min", "Stratum server: minimum worker difficulty", VDIFF_TARGET_MIN_DEFAULT );
const command_line::arg_descriptor arg_stratum_vdiff_target_max ("stratum-vdiff-target-max", "Stratum server: maximum worker difficulty", VDIFF_TARGET_MAX_DEFAULT );
const command_line::arg_descriptor arg_stratum_vdiff_target_time ("stratum-vdiff-target-time", "Stratum server: target time per share (i.e. try to get one share per this many seconds)", VDIFF_TARGET_TIME_DEFAULT );
@@ -98,7 +98,7 @@ namespace
, variance_percent(0)
{}
- vdiff_params_t(uint64_t target_min, uint64_t target_max, uint64_t target_time_s, uint64_t retarget_time_s, uint64_t retarget_shares_count, uint64_t variance_percent)
+ vdiff_params_t(uint64_t target_min, uint64_t target_max, uint64_t target_time_s, uint64_t retarget_time_s, uint64_t retarget_shares_count, uint64_t variance_percent)
: target_min(target_min)
, target_max(target_max)
, target_time_ms(target_time_s * 1000)
@@ -140,7 +140,7 @@ namespace
CRITICAL_REGION_LOCAL(m_lock);
return (epee::misc_utils::get_tick_count() - m_ts_started) / 1000;
}
-
+
uint64_t estimate_worker_hashrate()
{
CRITICAL_REGION_LOCAL(m_lock);
@@ -225,7 +225,7 @@ namespace
new_d = m_vd_params.target_min;
if (new_d > m_vd_params.target_max)
new_d = m_vd_params.target_max;
-
+
if (new_d != m_worker_difficulty)
{
LP_CC_WORKER_YELLOW((*this), "difficulty update: " << m_worker_difficulty << " -> " << new_d <<
@@ -388,7 +388,7 @@ namespace
m_p_core->get_blockchain_top(stub, top_block_id);
if (!enforce_update && top_block_id == m_blockchain_last_block_id && epee::misc_utils::get_tick_count() - m_block_template_update_ts < m_block_template_update_pediod_ms)
return false;// no new blocks since last update, keep the same work
-
+
LOG_PRINT("stratum_protocol_handler_config::update_block_template(" << (enforce_update ? "true" : "false") << ")", LOG_LEVEL_4);
m_block_template = AUTO_VAL_INIT(m_block_template);
wide_difficulty_type block_template_difficulty;
@@ -457,7 +457,7 @@ namespace
{
LP_CC_WORKER_YELLOW(p_ph->get_context(), "core is NOT synchronized, respond with empty job package", LOG_LEVEL_2);
}
-
+
if (!updated)
p_ph->set_work(get_work_json(p_ph->get_context().get_worker_difficulty()));
}
@@ -474,7 +474,7 @@ namespace
p_ph->send_response_default(id);
return true;
}
-
+
const uint64_t height = get_block_height(m_block_template);
// make sure worker sent work with correct block ethash
@@ -606,7 +606,7 @@ namespace
LP_CC_WORKER_GREEN(p_ph->get_context(), "logged in with username " << user_str << ", start difficulty: " << (start_difficulty != 0 ? std::to_string(start_difficulty) : "default"), LOG_LEVEL_0);
p_ph->send_response_default(id);
-
+
// send initial work
update_work(p_ph);
@@ -615,7 +615,7 @@ namespace
bool handle_submit_hashrate(protocol_handler_t* p_ph, uint64_t rate, const crypto::hash& rate_submit_id)
{
- LP_CC_WORKER_CYAN(p_ph->get_context(), "reported hashrate: " << HR_TO_STREAM_IN_MHS_3P(rate) << " Mh/s" <<
+ LP_CC_WORKER_CYAN(p_ph->get_context(), "reported hashrate: " << HR_TO_STREAM_IN_MHS_3P(rate) << " Mh/s" <<
", estimated hashrate: " << HR_TO_STREAM_IN_MHS_3P(p_ph->get_context().estimate_worker_hashrate()) << " Mh/s, run time: " <<
epee::misc_utils::get_time_interval_string(p_ph->get_context().get_hr_estimate_duration()), LOG_LEVEL_3);
return true;
@@ -992,7 +992,7 @@ namespace
// JSON-RPC 2.0 spec: "A Notification is a Request object without an "id" member."
send(R"({"jsonrpc":"2.0",)" + json + "}" "\n"); // LF character is not specified by JSON-RPC standard, but it is REQUIRED by ethminer 0.12 to work
}
-
+
void send_response_method(const jsonrpc_id_t& id, const std::string& method, const std::string& response)
{
send_response(id, std::string(R"("method":")") + method + R"(",)" + response);
@@ -1073,7 +1073,7 @@ namespace
typedef bool (this_t::*method_handler_func_t)(const jsonrpc_id_t& id, epee::serialization::portable_storage& ps, epee::serialization::portable_storage::hsection params_section);
static std::unordered_map m_methods_handlers;
-
+
std::atomic m_connection_initialized;
}; // class stratum_protocol_handler
//==============================================================================================================================
@@ -1143,7 +1143,7 @@ bool stratum_server::init(const boost::program_options::variables_map& vm)
auto& config = m_impl->server.get_config_object();
config.set_core(m_p_core);
-
+
if (command_line::has_arg(vm, arg_stratum_always_online))
{
config.set_is_core_always_online(command_line::get_arg(vm, arg_stratum_always_online));
diff --git a/src/version.h.in b/src/version.h.in
index c6196432..a6d24549 100644
--- a/src/version.h.in
+++ b/src/version.h.in
@@ -3,11 +3,11 @@
#define BUILD_COMMIT_ID "@VERSION@"
-#define PROJECT_MAJOR_VERSION "2"
-#define PROJECT_MINOR_VERSION "0"
+#define PROJECT_MAJOR_VERSION "1"
+#define PROJECT_MINOR_VERSION "5"
#define PROJECT_REVISION "0"
#define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION
-#define PROJECT_VERSION_BUILD_NO 280
+#define PROJECT_VERSION_BUILD_NO 143
#define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO)
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]"
diff --git a/src/wallet/plain_wallet_api.cpp b/src/wallet/plain_wallet_api.cpp
index 3a9a1552..8151fcfe 100644
--- a/src/wallet/plain_wallet_api.cpp
+++ b/src/wallet/plain_wallet_api.cpp
@@ -8,7 +8,7 @@
#endif
#include "plain_wallet_api.h"
#include "plain_wallet_api_defs.h"
-#include "currency_core/currency_config.h"
+#include "currency_config.h"
#include "version.h"
#include "string_tools.h"
#include "currency_core/currency_format_utils.h"
@@ -18,10 +18,9 @@
#include "static_helpers.h"
#include "wallet_helpers.h"
-#define ANDROID_PACKAGE_NAME "com.zano_mobile"
+#define ANDROID_PACKAGE_NAME "com.lethean_mobile"
#define LOGS_FOLDER "logs"
-
#define WALLETS_FOLDER_NAME "wallets"
#define APP_CONFIG_FOLDER "app_config"
#define APP_CONFIG_FILENAME "app_cfg.bin"
@@ -93,11 +92,11 @@ namespace plain_wallet
{
get_set_working_dir(true, dir);
}
-
+
std::string get_wallets_folder()
{
-#ifdef CAKEWALLET
- std::string path = "";
+#ifdef CAKEWALLET
+ std::string path = "";
#elif WIN32
std::string path = get_bundle_working_dir() + "/" + WALLETS_FOLDER_NAME + "/";
#else
@@ -108,7 +107,7 @@ namespace plain_wallet
std::string get_app_config_folder()
{
-#ifdef CAKEWALLET
+#ifdef CAKEWALLET
std::string path = "";
#elif WIN32
std::string path = get_bundle_working_dir() + "/" + APP_CONFIG_FOLDER + "/";
@@ -165,7 +164,7 @@ namespace plain_wallet
//wait other callers finish
local_ptr->gjobs_lock.lock();
local_ptr->gjobs_lock.unlock();
- bool r = local_ptr->gwm.quick_stop_no_save();
+ bool r = local_ptr->gwm.quick_stop_no_save();
LOG_PRINT_L0("[QUICK_STOP_NO_SAVE] return " << r);
//let's prepare wallet manager for quick shutdown
local_ptr.reset();
@@ -181,7 +180,6 @@ namespace plain_wallet
return epee::serialization::store_t_to_json(ok_response);
}
-
std::string init(const std::string& ip, const std::string& port, const std::string& working_dir, int log_level)
{
auto local_ptr = std::atomic_load(&ginstance_ptr);
@@ -200,7 +198,7 @@ namespace plain_wallet
set_bundle_working_dir(working_dir);
initialize_logs(log_level);
- std::string argss_1 = std::string("--remote-node=") + ip + ":" + port;
+ std::string argss_1 = std::string("--remote-node=") + ip + ":" + port;
std::string argss_2 = std::string("--disable-logs-init");
char * args[4];
static const char* arg0_stub = "stub";
@@ -214,7 +212,7 @@ namespace plain_wallet
LOG_ERROR("Failed to init wallets_manager");
return GENERAL_INTERNAL_ERRROR_INIT;
}
-
+
ptr->gwm.set_use_deffered_global_outputs(true);
if(!ptr->gwm.start())
@@ -308,7 +306,7 @@ namespace plain_wallet
std::string generate_random_key(uint64_t lenght)
{
- std::string buff;
+ std::string buff;
buff.resize(lenght);
crypto::generate_random_bytes(lenght, const_cast(buff.data()));
return tools::base58::encode(buff);
@@ -361,7 +359,7 @@ namespace plain_wallet
{
const std::string src_folder_path = get_bundle_working_dir();
boost::system::error_code ec;
- const std::string full_target_path = target_dir + "/Zano_export" + std::to_string(epee::misc_utils::get_tick_count());
+ const std::string full_target_path = target_dir + "/Lethean_export" + std::to_string(epee::misc_utils::get_tick_count());
boost::filesystem::create_directory(full_target_path, ec);
if (ec)
{
@@ -419,7 +417,7 @@ namespace plain_wallet
std::stringstream res;
res << "{ \"valid\": " << (valid?"true":"false") << ", \"auditable\": "
<< (apa.is_auditable() ? "true" : "false")
- << ",\"payment_id\": " << (pid.size() ? "true" : "false")
+ << ",\"payment_id\": " << (pid.size() ? "true" : "false")
<< ",\"wrap\": " << (wrap ? "true" : "false")
<< "}";
return res.str();
@@ -603,7 +601,7 @@ namespace plain_wallet
rsp.error_code = tools::get_seed_phrase_info(sip.seed_phrase, sip.seed_password, rsp.response_data);
res = epee::serialization::store_t_to_json(rsp);
}
- }
+ }
else if (method_name == "invoke")
{
res = invoke(instance_id, params);
@@ -628,7 +626,7 @@ namespace plain_wallet
{
auto inst_ptr = std::atomic_load(&ginstance_ptr);
if (!inst_ptr)
- {
+ {
return "{\"status\": \"canceled\"}";
}
//TODO: need refactoring
@@ -676,4 +674,4 @@ namespace plain_wallet
{
return TX_DEFAULT_FEE;
}
-}
\ No newline at end of file
+}
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index b2af9d58..85c72bae 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -7327,7 +7327,7 @@ void wallet2::transfer(construct_tx_param& ctp,
if (m_watch_only)
{
- bool r = store_unsigned_tx_to_file_and_reserve_transfers(ftp, (p_unsigned_filename_or_tx_blob_str != nullptr ? *p_unsigned_filename_or_tx_blob_str : "zano_tx_unsigned"), p_unsigned_filename_or_tx_blob_str);
+ bool r = store_unsigned_tx_to_file_and_reserve_transfers(ftp, (p_unsigned_filename_or_tx_blob_str != nullptr ? *p_unsigned_filename_or_tx_blob_str : "lethean_tx_unsigned"), p_unsigned_filename_or_tx_blob_str);
WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(r, "failed to store unsigned tx");
WLT_LOG_GREEN("[wallet::transfer]" << " prepare_transaction_time: " << print_fixed_decimal_point(prepare_transaction_time, 3), LOG_LEVEL_0);
return;
diff --git a/src/wallet/wallets_manager.cpp b/src/wallet/wallets_manager.cpp
index c1edabff..1d5c4971 100644
--- a/src/wallet/wallets_manager.cpp
+++ b/src/wallet/wallets_manager.cpp
@@ -74,7 +74,7 @@ wallets_manager::wallets_manager():m_pview(&m_view_stub),
m_rpc_proxy(new tools::core_fast_rpc_proxy(m_rpc_server)),
m_offers_service(nullptr),
m_wallet_rpc_server(this),
-#else
+#else
m_rpc_proxy(new tools::default_http_core_proxy()),
#endif
@@ -175,7 +175,7 @@ bool wallets_manager::init_command_line(int argc, char* argv[], std::string& fai
command_line::add_arg(desc_cmd_sett, command_line::arg_log_level);
command_line::add_arg(desc_cmd_sett, command_line::arg_console);
command_line::add_arg(desc_cmd_only, command_line::arg_show_details);
-
+
command_line::add_arg(desc_cmd_sett, arg_alloc_win_console);
command_line::add_arg(desc_cmd_sett, arg_sandbox_disable);
command_line::add_arg(desc_cmd_sett, arg_html_folder);
@@ -1044,7 +1044,7 @@ std::string wallets_manager::open_wallet(const std::wstring& path, const std::st
w->set_votes_config_path(m_data_dir + "/" + CURRENCY_VOTING_CONFIG_DEFAULT_FILENAME);
-
+
std::string return_code = API_RETURN_CODE_OK;
while (true)
{
@@ -1662,10 +1662,10 @@ std::string wallets_manager::get_wallet_info(uint64_t wallet_id, view::wallet_in
std::string wallets_manager::get_wallet_info_extra(uint64_t wallet_id, view::wallet_info_extra& wi)
{
GET_WALLET_OPT_BY_ID(wallet_id, wo);
-
+
auto locker_object = wo.w.lock();
tools::wallet2& rw = *(*(*locker_object)); //this looks a bit crazy, i know
-
+
auto& keys = rw.get_account().get_keys();
wi.view_private_key = epee::string_tools::pod_to_hex(keys.view_secret_key);
@@ -1810,7 +1810,7 @@ std::string wallets_manager::reset_wallet_password(uint64_t wallet_id, const std
}
std::string wallets_manager::use_whitelisting(uint64_t wallet_id, bool use)
{
- GET_WALLET_OPT_BY_ID(wallet_id, w);
+ GET_WALLET_OPT_BY_ID(wallet_id, w);
w.w->get()->set_use_assets_whitelisting(use);
return API_RETURN_CODE_OK;
}
@@ -2079,11 +2079,11 @@ void wallets_manager::on_mw_get_wallets(std::vector& events)
{
currency::checkpoints checkpoints;
- checkpoints.add_checkpoint(15, "6f9194c144afd73077478e7f04e947c50160b5673558e6f696a4f662a3ca261e");
+ checkpoints.add_checkpoint(15, "3e163f0828e08aea66775a3a92ead64298a67e0de66e6aa5453673716f2a5970");
c.set_checkpoints(std::move(checkpoints));
return true;
diff --git a/tests/core_tests/transaction_tests.cpp b/tests/core_tests/transaction_tests.cpp
index 206a5596..988de13d 100644
--- a/tests/core_tests/transaction_tests.cpp
+++ b/tests/core_tests/transaction_tests.cpp
@@ -222,8 +222,8 @@ bool test_transactions()
{
if(!test_transaction_generation_and_ring_signature())
return false;
- if(!test_block_creation())
- return false;
+// if(!test_block_creation())
+// return false;
if (!test_example_key_derivation())
return false;
diff --git a/tests/functional_tests/crypto_tests.cpp b/tests/functional_tests/crypto_tests.cpp
index 9515df91..7bac21de 100644
--- a/tests/functional_tests/crypto_tests.cpp
+++ b/tests/functional_tests/crypto_tests.cpp
@@ -572,7 +572,7 @@ TEST(crypto, constants)
point_t HpG = H + G;
point_t HmG = H - G;
point_t Hd8 = c_scalar_1div8 * H;
-
+
ASSERT_EQ(scalar_t(8) * Hd8, H);
// print them
@@ -1046,115 +1046,115 @@ TEST(crypto, hp)
LOG_PRINT_L0("cn_fast_hash('') * G = " << zG.to_public_key() << " (pub_key)");
ASSERT_EQ(zG, point_from_str("7849297236cd7c0d6c69a3c8c179c038d3c1c434735741bb3c8995c3c9d6f2ac"));
- crypto::cn_fast_hash("zano", 4, hash);
- LOG_PRINT_L0("cn_fast_hash('zano') = " << hash);
+ crypto::cn_fast_hash("lethean", 4, hash);
+ LOG_PRINT_L0("cn_fast_hash('lethean') = " << hash);
ASSERT_EQ(hash, hash_from_str("23cea10abfdf3ace0b7132291d51e4eb5a392afb2147e67f907ff4f8f5dd4f9f"));
z = hash;
zG = z * c_point_G;
- LOG_PRINT_L0("cn_fast_hash('zano') * G = " << zG.to_public_key() << " (pub_key)");
+ LOG_PRINT_L0("cn_fast_hash('lethean') * G = " << zG.to_public_key() << " (pub_key)");
ASSERT_EQ(zG, point_from_str("71407d59e9d671fa02f26a6a7f4726c3087d8f1732453396638a1dc2929fb57a"));
char buf[2000];
for (size_t i = 0; i < sizeof buf; i += 4)
- *(uint32_t*)&buf[i] = *(uint32_t*)"zano";
+ *(uint32_t*)&buf[i] = *(uint32_t*)"lethean";
crypto::cn_fast_hash(buf, sizeof buf, (char*)&hash);
- LOG_PRINT_L0("cn_fast_hash('zano' x 500) = " << hash);
+ LOG_PRINT_L0("cn_fast_hash('lethean' x 500) = " << hash);
ASSERT_EQ(hash, hash_from_str("16d87120c601a6ef3e4ffa5e58176a36b814288199f23ec09ef178c554e8879b"));
z = hash;
zG = z * c_point_G;
- LOG_PRINT_L0("cn_fast_hash('zano' x 500) * G = " << zG.to_public_key() << " (pub_key)");
+ LOG_PRINT_L0("cn_fast_hash('lethean' x 500) * G = " << zG.to_public_key() << " (pub_key)");
ASSERT_EQ(zG, point_from_str("dd93067a02fb8661aa64504ac1503402a34426f43650d970c35147cec4b61d55"));
return true;
}
-TEST(crypto, cn_fast_hash_perf)
-{
- //return true;
- const crypto::hash h_initial = *(crypto::hash*)(&scalar_t::random());
-
- std::vector> test_data;
- test_data.push_back(std::vector(32, 0));
- test_data.push_back(std::vector(63, 0));
- test_data.push_back(std::vector(127, 0));
- test_data.push_back(std::vector(135, 0));
- test_data.push_back(std::vector(255, 0));
- test_data.push_back(std::vector(271, 0)); // 271 = 136 * 2 - 1
- test_data.push_back(std::vector(2030, 0));
-
- for (size_t j = 0, sz = test_data.size(); j < sz; ++j)
- crypto::generate_random_bytes(test_data[j].size(), test_data[j].data());
-
- struct times_t
- {
- uint64_t t_old{ 0 }, t_new{ 0 };
- crypto::hash h_old{};
- double diff{ 0 };
- };
- std::vector