Compare commits
53 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d5c87e871 | ||
| 5da1065df9 | |||
| 66e4263136 | |||
| 9a08bfce0e | |||
| 0fb180fa96 | |||
| 7627ff1bc5 | |||
| 435a8f03f7 | |||
| df4b9440b1 | |||
| 16ef883aa0 | |||
| e4ac49304f | |||
| a20a575647 | |||
| 3b8a03dd08 | |||
| 8b4f166926 | |||
| 4bbf42483f | |||
| 08b9208f56 | |||
|
|
b400c827cc | ||
|
|
40726e43f1 | ||
|
|
3efe81cc29 | ||
|
|
6b86f09909 | ||
| a4463bb093 | |||
| cc085dc1c3 | |||
| 4ef1324e2c | |||
| 04c8a9b5b6 | |||
| 76521b0d0d | |||
| 9c2e8c232a | |||
| 7cefd8d664 | |||
| 28302b5941 | |||
| 3f2337cfb4 | |||
|
|
b94860a3c8 | ||
|
|
016580a889 | ||
|
|
d5f984a75f | ||
| cc18d11a28 | |||
| 7c14a9fadf | |||
| 4f4a142c63 | |||
| 7ea697ac0d | |||
| 70c79745f1 | |||
| 2503764329 | |||
| c9a86d9aff | |||
| 5f8b9a446e | |||
| ba1311e15c | |||
| 39e7eafe5e | |||
| 2a20bef11b | |||
| 0778c03e82 | |||
| 53f6798a6a | |||
| 600b50193d | |||
| 1bb64edc57 | |||
| a18535696e | |||
| a7ecf70452 | |||
| c994eac501 | |||
| 47d851f11d | |||
| dfcc5058ac | |||
| 36008ecb18 | |||
| 62a4961549 |
2
.dockerignore
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
build
|
||||
.idea
|
||||
2
.github/FUNDING.yml
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
github: [letheanVPN]
|
||||
open_collective: lthn
|
||||
6
.github/dependabot.yml
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
247
.github/workflows/cli-testnet.yml
vendored
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
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:
|
||||
CMAKE_OSX_SYSROOT: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.2.1.sdk"
|
||||
CCACHE_SETTINGS: |
|
||||
ccache --max-size=150M
|
||||
ccache --set-config=compression=true
|
||||
|
||||
jobs:
|
||||
compile:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ ubuntu-latest]
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
target: linux-amd64
|
||||
net: testnet
|
||||
# - os: macos-11
|
||||
# target: macos-amd64
|
||||
# net: testnet
|
||||
# - os: macos-12
|
||||
# target: macos-amd64
|
||||
# net: testnet
|
||||
# - os: windows-2019
|
||||
# target: windows-amd64
|
||||
# net: testnet
|
||||
env:
|
||||
CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
|
||||
CONAN_HOME: "${{ github.workspace }}/build/"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: amd64
|
||||
if: ${{ matrix.os == 'windows-2019' }}
|
||||
name: setup msvc vcvars
|
||||
- name: install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt-get install -y git ccache
|
||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.10"
|
||||
cache: "pip"
|
||||
- name: Install autotools on macOS
|
||||
run: brew install automake
|
||||
if: ${{ matrix.os == 'macos-13' }}
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ github.workspace }}/ccache
|
||||
key: ccache-${{ runner.os }}-${{ matrix.target }}-build-testnet-cli
|
||||
- name: Cache Conan
|
||||
id: github-cache-conan
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
cache-name: cache-conan-modules
|
||||
with:
|
||||
save-always: true
|
||||
path: ${{ github.workspace }}/build/p
|
||||
key: host-${{ runner.os }}-target-${{ matrix.target }}-${{ hashFiles('contrib/cmake/conanfile.py') }}
|
||||
- name: Install Conan
|
||||
run: pip install conan pytest && conan --version
|
||||
- name: Setup CMake and Ninja
|
||||
uses: lukka/get-cmake@latest
|
||||
with:
|
||||
cmakeVersion: "~3.25.0"
|
||||
ninjaVersion: "^1.11.1"
|
||||
- name: Call make release-testnet
|
||||
run: |
|
||||
make ci-${{ matrix.target }}-testnet
|
||||
- name: Release Tag
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: '*ethean-${{ matrix.target }}-cli.*'
|
||||
- name: Release Branch
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/heads/iTw3')
|
||||
with:
|
||||
tag_name: canary
|
||||
prerelease: true
|
||||
files: '*ethean-${{ matrix.target }}-cli.*'
|
||||
# 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 }}/testnet-lethean-linux-cli-*.tar.bz2
|
||||
# - name: Release Tag
|
||||
# uses: softprops/action-gh-release@v1
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
# with:
|
||||
# files: '*ethean-${{ matrix.target }}-cli.*'
|
||||
# - name: Release Branch
|
||||
# uses: softprops/action-gh-release@v1
|
||||
# if: startsWith(github.ref, 'refs/heads/iTw3')
|
||||
# with:
|
||||
# tag_name: canary
|
||||
# prerelease: true
|
||||
# files: '*ethean-${{ matrix.target }}-cli.*'
|
||||
# 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 ccache -y
|
||||
# choco install zip -y
|
||||
# - name: Cache Conan
|
||||
# id: github-cache-conan
|
||||
# uses: actions/cache@v4
|
||||
# env:
|
||||
# cache-name: cache-conan-modules
|
||||
# with:
|
||||
# save-always: true
|
||||
# path: ${{ github.workspace }}\build\p
|
||||
# key: host-${{ runner.os }}-target-windows-${{ hashFiles('contrib/cmake/conanfile.py') }}
|
||||
# - name: install msvc toolset
|
||||
# uses: ilammy/msvc-dev-cmd@v1
|
||||
#
|
||||
# - name: Set up Visual Studio shell
|
||||
# uses: egor-tensin/vs-shell@v2
|
||||
# with:
|
||||
# arch: x64
|
||||
# - name: build server
|
||||
# env:
|
||||
# CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
|
||||
# run: |
|
||||
# ${{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-*
|
||||
67
.github/workflows/dockerhub-testnet.yml
vendored
Normal file
|
|
@ -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 }}
|
||||
|
||||
1
.gitignore
vendored
|
|
@ -5,5 +5,6 @@
|
|||
._.DS_Store
|
||||
Thumbs.db
|
||||
._*
|
||||
out
|
||||
.idea
|
||||
.vs/*
|
||||
6
.gitmodules
vendored
|
|
@ -1,11 +1,7 @@
|
|||
[submodule "contrib/miniupnp"]
|
||||
path = contrib/miniupnp
|
||||
url = https://github.com/miniupnp/miniupnp
|
||||
[submodule "src/gui/qt-daemon/layout"]
|
||||
path = src/gui/qt-daemon/layout
|
||||
url = https://github.com/hyle-team/zano_ui.git
|
||||
branch = main
|
||||
[submodule "contrib/tor-connect"]
|
||||
path = contrib/tor-connect
|
||||
url = https://github.com/hyle-team/tor-connect.git
|
||||
url = https://github.com/letheanVPN/tor-connect.git
|
||||
branch = main
|
||||
1
.idea/.name
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
Lethean
|
||||
2
.idea/blockchain-iTw3.iml
generated
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
||||
9
.idea/cmake.xml
generated
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeSharedSettings">
|
||||
<configurations>
|
||||
<configuration PROFILE_NAME="Debug" ENABLED="true" GENERATION_DIR="build/debug" CONFIG_NAME="Debug" GENERATION_OPTIONS="-G "Unix Makefiles" -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="contrib/cmake/conan_provider.cmake"" />
|
||||
<configuration PROFILE_NAME="Release" ENABLED="true" GENERATION_DIR="build/release" CONFIG_NAME="Release" GENERATION_OPTIONS="-G "Unix Makefiles" -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="contrib/cmake/conan_provider.cmake"" />
|
||||
</configurations>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/code-comments.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CodeComments" version="1">
|
||||
<comments />
|
||||
</component>
|
||||
</project>
|
||||
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
||||
15
.idea/runConfigurations/docker_server.xml
generated
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="docker-server" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="imageTag" value="lthn/chain-itw3:testnet" />
|
||||
<option name="buildCliOptions" value="--platform linux/x86_64 --build-arg THREADS=4" />
|
||||
<option name="buildKitEnabled" value="true" />
|
||||
<option name="containerName" value="" />
|
||||
<option name="contextFolderPath" value="." />
|
||||
<option name="sourceFilePath" value="utils/docker/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
9
.idea/vcs.xml
generated
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/contrib/miniupnp" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/contrib/tor-connect" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/src/gui/qt-daemon/layout" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -1,7 +1,37 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
PROJECT(Zano)
|
||||
list(INSERT CMAKE_MODULE_PATH 0
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/cmake")
|
||||
|
||||
PROJECT(Lethean)
|
||||
|
||||
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}")
|
||||
|
|
@ -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")
|
||||
|
|
@ -81,6 +112,15 @@ add_definitions(-DSTATICLIB)
|
|||
if(TESTNET)
|
||||
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)
|
||||
|
|
@ -97,6 +137,10 @@ if(DISABLE_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()
|
||||
|
|
@ -216,7 +260,7 @@ endif()
|
|||
|
||||
if(STATIC)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
set(Boost_USE_STATIC_RUNTIME ON)
|
||||
# set(Boost_USE_STATIC_RUNTIME ON)
|
||||
endif()
|
||||
|
||||
message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
|
||||
|
|
@ -259,6 +303,12 @@ endif()
|
|||
|
||||
if(BUILD_GUI)
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
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()
|
||||
|
||||
|
|
@ -288,7 +338,7 @@ else()
|
|||
endif()
|
||||
endif()
|
||||
|
||||
set(BUILD_TESTS FALSE CACHE BOOL "Build Zano tests")
|
||||
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)
|
||||
|
|
|
|||
2
CODEOWNERS
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
* @snider
|
||||
docs/* @snider @bodane
|
||||
287
LICENCE
Normal file
|
|
@ -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.
|
||||
114
Makefile
|
|
@ -11,12 +11,13 @@ endif
|
|||
|
||||
cmake = cmake $(cmake_gen)
|
||||
|
||||
cmake_debug = $(cmake) -D CMAKE_BUILD_TYPE=Debug
|
||||
cmake_release = $(cmake) -D CMAKE_BUILD_TYPE=Release
|
||||
cmake_debug = $(cmake) -D CMAKE_BUILD_TYPE=Debug -D MUTE_ERRORS=FALSE
|
||||
cmake_release = $(cmake) -D CMAKE_BUILD_TYPE=Release -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=contrib/cmake/conan_provider.cmake
|
||||
|
||||
cmake_gui = -D BUILD_GUI=ON
|
||||
cmake_testnet = -D TESTNET=ON -D BUILD_TESTS=OFF
|
||||
cmake_static = -D STATIC=ON
|
||||
cmake_tests = -D BUILD_TESTS=ON
|
||||
cmake_tests = -D BUILD_TESTS=ON -D TESTNET=ON
|
||||
|
||||
|
||||
# Helper macro
|
||||
define CMAKE
|
||||
|
|
@ -26,39 +27,98 @@ endef
|
|||
build = build
|
||||
dir_debug = $(build)/debug
|
||||
dir_release = $(build)/release
|
||||
current_dir := $(dir $(abspath $(firstword $(MAKEFILE_LIST))))
|
||||
export CONAN_HOME = $(current_dir)$(build)
|
||||
|
||||
all: release
|
||||
conan_profile_linux = $(CONAN_HOME)/profiles/linux-amd64
|
||||
conan_profile_windows = $(CONAN_HOME)/profiles/windows-amd64
|
||||
conan_toolchain = -DCMAKE_TOOLCHAIN_FILE=./build/release/conan/build/Release/generators/conan_toolchain.cmake
|
||||
|
||||
release:
|
||||
all: help
|
||||
|
||||
release: ## Build release non-static binaries
|
||||
$(eval command += $(cmake_release))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
release-testnet: ## Build testnet non-static binaries
|
||||
$(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:
|
||||
static-release: ## Build release static binaries
|
||||
$(eval command += $(cmake_release) $(cmake_static))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
#
|
||||
# GUI
|
||||
#
|
||||
|
||||
gui: gui-release
|
||||
gui-release:
|
||||
$(eval command += $(cmake_release) $(cmake_gui))
|
||||
static-release-testnet: ## Build testnet release static binaries
|
||||
$(eval command += $(cmake_release) $(cmake_static) $(cmake_testnet))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
gui-debug:
|
||||
$(eval command += $(cmake_debug) $(cmake_gui))
|
||||
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE)
|
||||
#
|
||||
# CI
|
||||
#
|
||||
|
||||
ci-package-linux:
|
||||
@rm -fr lethean && mkdir -p lethean
|
||||
@cp -r build/release/src/letheand lethean/letheand
|
||||
@cp -r build/release/src/lethean-wallet lethean/lethean-wallet
|
||||
@chmod +x lethean/lethean*
|
||||
|
||||
ci-package-windows:
|
||||
@rm -fr lethean && mkdir -p lethean
|
||||
@cp -r build\\release\\src\\letheand.exe lethean\\letheand.exe
|
||||
@cp -r build\\release\\src\\lethean-wallet.exe lethean\\lethean-wallet.exe
|
||||
|
||||
ci-windows-amd64-release: static-release ci-package-windows ## Build lethean-windows-amd64-cli.tar.bz2
|
||||
@tar -cjvf lethean-windows-amd64-cli.tar.bz2 lethean/
|
||||
|
||||
ci-linux-amd64-release: static-release ci-package-linux ## Build lethean-linux-amd64-cli.tar.bz2
|
||||
@tar -cjvf lethean-linux-amd64-cli.tar.bz2 lethean/
|
||||
|
||||
ci-macos-amd64-release: static-release ci-package-linux ## Build lethean-macos-amd64-cli.tar.bz2
|
||||
@tar -cjvf lethean-macos-amd64-cli.tar.bz2 lethean/
|
||||
|
||||
ci-macos-arm64-release: static-release ci-package-linux ## Build lethean-macos-arm64-cli.tar.bz2
|
||||
@tar -cjvf lethean-macos-arm64-cli.tar.bz2 lethean/
|
||||
|
||||
ci-linux-amd64-testnet: ## Build testnet-lethean-linux-amd64-cli.tar.bz2
|
||||
conan install ./contrib/cmake -of=./build/release/conan --profile:build=$(conan_profile_linux) --profile:host=$(conan_profile_linux) --build=missing
|
||||
(cd build/release && cmake ../../ -DCMAKE_BUILD_TYPE=Release $(conan_toolchain) $(cmake_static) $(cmake_testnet))
|
||||
(cd build/release && cmake --build .)
|
||||
@rm -fr lethean && mkdir -p lethean
|
||||
@cp -r build/release/src/letheand lethean/letheand
|
||||
@cp -r build/release/src/lethean-wallet lethean/lethean-wallet
|
||||
@chmod +x lethean/lethean*
|
||||
@tar -cjvf testnet-lethean-linux-amd64-cli.tar.bz2 lethean/
|
||||
|
||||
|
||||
|
||||
ci-windows-amd64-testnet: ## Build testnet-lethean-windows-amd64-cli.tar.bz2
|
||||
conan install ./contrib/cmake -of=./build/release/conan --profile:build=$(conan_profile_windows) --profile:host=$(conan_profile_windows) --build=missing
|
||||
(cd build/release && cmake ../../ -DCMAKE_BUILD_TYPE=Release $(conan_toolchain) $(cmake_static) $(cmake_testnet))
|
||||
(cd build/release && cmake --build .)
|
||||
@rm -fr lethean && mkdir -p lethean
|
||||
@cp -r build/release/src/letheand lethean/letheand
|
||||
@cp -r build/release/src/lethean-wallet lethean/lethean-wallet
|
||||
@chmod +x lethean/lethean*
|
||||
@tar -cjvf testnet-lethean-windows-amd64-cli.tar.bz2 lethean/
|
||||
|
||||
ci-macos-amd64-testnet: static-release-testnet ci-package-linux ## Build testnet-lethean-macos-amd64-cli.tar.bz2
|
||||
@tar -cjvf testnet-lethean-macos-amd64-cli.tar.bz2 lethean/
|
||||
|
||||
ci-macos-arm64-testnet: static-release-testnet ci-package-linux ## Build testnet-lethean-macos-arm64-cli.tar.bz2
|
||||
@tar -cjvf testnet-lethean-macos-arm64-cli.tar.bz2 lethean/
|
||||
|
||||
conan:
|
||||
@conan config install contrib/cmake/settings_user.yml
|
||||
|
||||
gui-static: gui-release-static
|
||||
gui-release-static:
|
||||
$(eval command += $(cmake_release) $(cmake_gui) $(cmake_static))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
#
|
||||
# Tests
|
||||
|
|
@ -74,9 +134,17 @@ test-debug:
|
|||
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE) && $(MAKE) test
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
rm -rf ./build/release/ ./build/debug/
|
||||
|
||||
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
|
||||
help: ## Show this help
|
||||
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m make %-30s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
.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 ci-testnet ci-release
|
||||
.PHONY: ci-package-linux ci-linux-amd64-release ci-macos-amd64-release ci-macos-arm64-release ci-linux-amd64-testnet ci-macos-amd64-testnet ci-macos-arm64-testnet
|
||||
.PHONY: ci-package-windows ci-windows-amd64-release ci-windows-amd64-testnet
|
||||
|
|
|
|||
59
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.
|
||||
|
||||
<br />
|
||||
|
||||
|
|
@ -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 lthn/ && make -j1
|
||||
or
|
||||
|
||||
cd zano && mkdir build && cd build
|
||||
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`
|
|||
<br />
|
||||
|
||||
### 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`
|
||||
|
||||
<br />
|
||||
|
||||
|
|
@ -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`
|
||||
|
||||
|
|
|
|||
8
build/profiles/linux-amd64
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[settings]
|
||||
arch=x86_64
|
||||
build_type=Release
|
||||
compiler=gcc
|
||||
compiler.cppstd=gnu17
|
||||
compiler.libcxx=libstdc++11
|
||||
compiler.version=11
|
||||
os=Linux
|
||||
8
build/profiles/windows-amd64
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[settings]
|
||||
arch=x86_64
|
||||
build_type=Release
|
||||
compiler=msvc
|
||||
compiler.cppstd=14
|
||||
compiler.runtime=dynamic
|
||||
compiler.version=193
|
||||
os=Windows
|
||||
5
build/settings_user.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
compiler:
|
||||
gcc:
|
||||
version: ["9.4.0","11.4.0"]
|
||||
apple-clang:
|
||||
version: ["13.0.0.13000029", "14.0.0.14000029", "15.0.0.15000040", "15.0.0.15000309"]
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
22
contrib/cmake/ConfigOpenSSL.cmake
Normal file
|
|
@ -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()
|
||||
67
contrib/cmake/FindCcache.cmake
Normal file
|
|
@ -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()
|
||||
59
contrib/cmake/FindMiniupnpc.cmake
Normal file
|
|
@ -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 <miniupnpc/miniupnpc.h>
|
||||
# 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 ---------------------------------
|
||||
631
contrib/cmake/conan_provider.cmake
Normal file
|
|
@ -0,0 +1,631 @@
|
|||
# This file is managed by Conan, contents will be overwritten.
|
||||
# To keep your changes, remove these comment lines, but the plugin won't be able to modify your requirements
|
||||
|
||||
set(CONAN_MINIMUM_VERSION 2.0.5)
|
||||
|
||||
|
||||
function(detect_os OS OS_API_LEVEL OS_SDK OS_SUBSYSTEM OS_VERSION)
|
||||
# it could be cross compilation
|
||||
message(STATUS "CMake-Conan: cmake_system_name=${CMAKE_SYSTEM_NAME}")
|
||||
if(CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Generic")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(${OS} Macos PARENT_SCOPE)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "QNX")
|
||||
set(${OS} Neutrino PARENT_SCOPE)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "CYGWIN")
|
||||
set(${OS} Windows PARENT_SCOPE)
|
||||
set(${OS_SUBSYSTEM} cygwin PARENT_SCOPE)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "^MSYS")
|
||||
set(${OS} Windows PARENT_SCOPE)
|
||||
set(${OS_SUBSYSTEM} msys2 PARENT_SCOPE)
|
||||
else()
|
||||
set(${OS} ${CMAKE_SYSTEM_NAME} PARENT_SCOPE)
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
if(DEFINED ANDROID_PLATFORM)
|
||||
string(REGEX MATCH "[0-9]+" _OS_API_LEVEL ${ANDROID_PLATFORM})
|
||||
elseif(DEFINED CMAKE_SYSTEM_VERSION)
|
||||
set(_OS_API_LEVEL ${CMAKE_SYSTEM_VERSION})
|
||||
endif()
|
||||
message(STATUS "CMake-Conan: android api level=${_OS_API_LEVEL}")
|
||||
set(${OS_API_LEVEL} ${_OS_API_LEVEL} PARENT_SCOPE)
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|watchOS")
|
||||
# CMAKE_OSX_SYSROOT contains the full path to the SDK for MakeFile/Ninja
|
||||
# generators, but just has the original input string for Xcode.
|
||||
if(NOT IS_DIRECTORY ${CMAKE_OSX_SYSROOT})
|
||||
set(_OS_SDK ${CMAKE_OSX_SYSROOT})
|
||||
else()
|
||||
if(CMAKE_OSX_SYSROOT MATCHES Simulator)
|
||||
set(apple_platform_suffix simulator)
|
||||
else()
|
||||
set(apple_platform_suffix os)
|
||||
endif()
|
||||
if(CMAKE_OSX_SYSROOT MATCHES AppleTV)
|
||||
set(_OS_SDK "appletv${apple_platform_suffix}")
|
||||
elseif(CMAKE_OSX_SYSROOT MATCHES iPhone)
|
||||
set(_OS_SDK "iphone${apple_platform_suffix}")
|
||||
elseif(CMAKE_OSX_SYSROOT MATCHES Watch)
|
||||
set(_OS_SDK "watch${apple_platform_suffix}")
|
||||
endif()
|
||||
endif()
|
||||
if(DEFINED _OS_SDK)
|
||||
message(STATUS "CMake-Conan: cmake_osx_sysroot=${CMAKE_OSX_SYSROOT}")
|
||||
set(${OS_SDK} ${_OS_SDK} PARENT_SCOPE)
|
||||
endif()
|
||||
if(DEFINED CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
message(STATUS "CMake-Conan: cmake_osx_deployment_target=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
set(${OS_VERSION} ${CMAKE_OSX_DEPLOYMENT_TARGET} PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
function(detect_arch ARCH)
|
||||
# CMAKE_OSX_ARCHITECTURES can contain multiple architectures, but Conan only supports one.
|
||||
# Therefore this code only finds one. If the recipes support multiple architectures, the
|
||||
# build will work. Otherwise, there will be a linker error for the missing architecture(s).
|
||||
if(DEFINED CMAKE_OSX_ARCHITECTURES)
|
||||
string(REPLACE " " ";" apple_arch_list "${CMAKE_OSX_ARCHITECTURES}")
|
||||
list(LENGTH apple_arch_list apple_arch_count)
|
||||
if(apple_arch_count GREATER 1)
|
||||
message(WARNING "CMake-Conan: Multiple architectures detected, this will only work if Conan recipe(s) produce fat binaries.")
|
||||
endif()
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|watchOS" AND NOT CMAKE_OSX_ARCHITECTURES STREQUAL "")
|
||||
set(host_arch ${CMAKE_OSX_ARCHITECTURES})
|
||||
elseif(MSVC)
|
||||
set(host_arch ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID})
|
||||
else()
|
||||
set(host_arch ${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
if(host_arch MATCHES "aarch64|arm64|ARM64")
|
||||
set(_ARCH armv8)
|
||||
elseif(host_arch MATCHES "armv7|armv7-a|armv7l|ARMV7")
|
||||
set(_ARCH armv7)
|
||||
elseif(host_arch MATCHES armv7s)
|
||||
set(_ARCH armv7s)
|
||||
elseif(host_arch MATCHES "i686|i386|X86")
|
||||
set(_ARCH x86)
|
||||
elseif(host_arch MATCHES "AMD64|amd64|x86_64|x64")
|
||||
set(_ARCH x86_64)
|
||||
endif()
|
||||
message(STATUS "CMake-Conan: cmake_system_processor=${_ARCH}")
|
||||
set(${ARCH} ${_ARCH} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
function(detect_cxx_standard CXX_STANDARD)
|
||||
set(${CXX_STANDARD} ${CMAKE_CXX_STANDARD} PARENT_SCOPE)
|
||||
if(CMAKE_CXX_EXTENSIONS)
|
||||
set(${CXX_STANDARD} "gnu${CMAKE_CXX_STANDARD}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
macro(detect_gnu_libstdcxx)
|
||||
# _CONAN_IS_GNU_LIBSTDCXX true if GNU libstdc++
|
||||
check_cxx_source_compiles("
|
||||
#include <cstddef>
|
||||
#if !defined(__GLIBCXX__) && !defined(__GLIBCPP__)
|
||||
static_assert(false);
|
||||
#endif
|
||||
int main(){}" _CONAN_IS_GNU_LIBSTDCXX)
|
||||
|
||||
# _CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI true if C++11 ABI
|
||||
check_cxx_source_compiles("
|
||||
#include <string>
|
||||
static_assert(sizeof(std::string) != sizeof(void*), \"using libstdc++\");
|
||||
int main () {}" _CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI)
|
||||
|
||||
set(_CONAN_GNU_LIBSTDCXX_SUFFIX "")
|
||||
if(_CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI)
|
||||
set(_CONAN_GNU_LIBSTDCXX_SUFFIX "11")
|
||||
endif()
|
||||
unset (_CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI)
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(detect_libcxx)
|
||||
# _CONAN_IS_LIBCXX true if LLVM libc++
|
||||
check_cxx_source_compiles("
|
||||
#include <cstddef>
|
||||
#if !defined(_LIBCPP_VERSION)
|
||||
static_assert(false);
|
||||
#endif
|
||||
int main(){}" _CONAN_IS_LIBCXX)
|
||||
endmacro()
|
||||
|
||||
|
||||
function(detect_lib_cxx LIB_CXX)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
message(STATUS "CMake-Conan: android_stl=${CMAKE_ANDROID_STL_TYPE}")
|
||||
set(${LIB_CXX} ${CMAKE_ANDROID_STL_TYPE} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
detect_gnu_libstdcxx()
|
||||
set(${LIB_CXX} "libstdc++${_CONAN_GNU_LIBSTDCXX_SUFFIX}" PARENT_SCOPE)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
|
||||
set(${LIB_CXX} "libc++" PARENT_SCOPE)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
# Check for libc++
|
||||
detect_libcxx()
|
||||
if(_CONAN_IS_LIBCXX)
|
||||
set(${LIB_CXX} "libc++" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Check for libstdc++
|
||||
detect_gnu_libstdcxx()
|
||||
if(_CONAN_IS_GNU_LIBSTDCXX)
|
||||
set(${LIB_CXX} "libstdc++${_CONAN_GNU_LIBSTDCXX_SUFFIX}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO: it would be an error if we reach this point
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
# Do nothing - compiler.runtime and compiler.runtime_type
|
||||
# should be handled separately: https://github.com/conan-io/cmake-conan/pull/516
|
||||
return()
|
||||
else()
|
||||
# TODO: unable to determine, ask user to provide a full profile file instead
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
function(detect_compiler COMPILER COMPILER_VERSION COMPILER_RUNTIME COMPILER_RUNTIME_TYPE)
|
||||
if(DEFINED CMAKE_CXX_COMPILER_ID)
|
||||
set(_COMPILER ${CMAKE_CXX_COMPILER_ID})
|
||||
set(_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION})
|
||||
else()
|
||||
if(NOT DEFINED CMAKE_C_COMPILER_ID)
|
||||
message(FATAL_ERROR "C or C++ compiler not defined")
|
||||
endif()
|
||||
set(_COMPILER ${CMAKE_C_COMPILER_ID})
|
||||
set(_COMPILER_VERSION ${CMAKE_C_COMPILER_VERSION})
|
||||
endif()
|
||||
|
||||
message(STATUS "CMake-Conan: CMake compiler=${_COMPILER}")
|
||||
message(STATUS "CMake-Conan: CMake compiler version=${_COMPILER_VERSION}")
|
||||
|
||||
if(_COMPILER MATCHES MSVC)
|
||||
set(_COMPILER "msvc")
|
||||
string(SUBSTRING ${MSVC_VERSION} 0 3 _COMPILER_VERSION)
|
||||
# Configure compiler.runtime and compiler.runtime_type settings for MSVC
|
||||
if(CMAKE_MSVC_RUNTIME_LIBRARY)
|
||||
set(_msvc_runtime_library ${CMAKE_MSVC_RUNTIME_LIBRARY})
|
||||
else()
|
||||
set(_msvc_runtime_library MultiThreaded$<$<CONFIG:Debug>:Debug>DLL) # default value documented by CMake
|
||||
endif()
|
||||
|
||||
set(_KNOWN_MSVC_RUNTIME_VALUES "")
|
||||
list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreaded MultiThreadedDLL)
|
||||
list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreadedDebug MultiThreadedDebugDLL)
|
||||
list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreaded$<$<CONFIG:Debug>:Debug> MultiThreaded$<$<CONFIG:Debug>:Debug>DLL)
|
||||
|
||||
# only accept the 6 possible values, otherwise we don't don't know to map this
|
||||
if(NOT _msvc_runtime_library IN_LIST _KNOWN_MSVC_RUNTIME_VALUES)
|
||||
message(FATAL_ERROR "CMake-Conan: unable to map MSVC runtime: ${_msvc_runtime_library} to Conan settings")
|
||||
endif()
|
||||
|
||||
# Runtime is "dynamic" in all cases if it ends in DLL
|
||||
if(_msvc_runtime_library MATCHES ".*DLL$")
|
||||
set(_COMPILER_RUNTIME "dynamic")
|
||||
else()
|
||||
set(_COMPILER_RUNTIME "static")
|
||||
endif()
|
||||
message(STATUS "CMake-Conan: CMake compiler.runtime=${_COMPILER_RUNTIME}")
|
||||
|
||||
# Only define compiler.runtime_type when explicitly requested
|
||||
# If a generator expression is used, let Conan handle it conditional on build_type
|
||||
if(NOT _msvc_runtime_library MATCHES "<CONFIG:Debug>:Debug>")
|
||||
if(_msvc_runtime_library MATCHES "Debug")
|
||||
set(_COMPILER_RUNTIME_TYPE "Debug")
|
||||
else()
|
||||
set(_COMPILER_RUNTIME_TYPE "Release")
|
||||
endif()
|
||||
message(STATUS "CMake-Conan: CMake compiler.runtime_type=${_COMPILER_RUNTIME_TYPE}")
|
||||
endif()
|
||||
|
||||
unset(_KNOWN_MSVC_RUNTIME_VALUES)
|
||||
|
||||
elseif(_COMPILER MATCHES AppleClang)
|
||||
set(_COMPILER "apple-clang")
|
||||
string(REPLACE "src" ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
|
||||
list(GET VERSION_LIST 0 _COMPILER_VERSION)
|
||||
elseif(_COMPILER MATCHES Clang)
|
||||
set(_COMPILER "clang")
|
||||
string(REPLACE "src" ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
|
||||
list(GET VERSION_LIST 0 _COMPILER_VERSION)
|
||||
elseif(_COMPILER MATCHES GNU)
|
||||
set(_COMPILER "gcc")
|
||||
string(REPLACE "src" ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
|
||||
list(GET VERSION_LIST 0 _COMPILER_VERSION)
|
||||
endif()
|
||||
|
||||
message(STATUS "CMake-Conan: [settings] compiler=${_COMPILER}")
|
||||
message(STATUS "CMake-Conan: [settings] compiler.version=${_COMPILER_VERSION}")
|
||||
if (_COMPILER_RUNTIME)
|
||||
message(STATUS "CMake-Conan: [settings] compiler.runtime=${_COMPILER_RUNTIME}")
|
||||
endif()
|
||||
if (_COMPILER_RUNTIME_TYPE)
|
||||
message(STATUS "CMake-Conan: [settings] compiler.runtime_type=${_COMPILER_RUNTIME_TYPE}")
|
||||
endif()
|
||||
|
||||
set(${COMPILER} ${_COMPILER} PARENT_SCOPE)
|
||||
set(${COMPILER_VERSION} ${_COMPILER_VERSION} PARENT_SCOPE)
|
||||
set(${COMPILER_RUNTIME} ${_COMPILER_RUNTIME} PARENT_SCOPE)
|
||||
set(${COMPILER_RUNTIME_TYPE} ${_COMPILER_RUNTIME_TYPE} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
function(detect_build_type BUILD_TYPE)
|
||||
get_property(_MULTICONFIG_GENERATOR GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(NOT _MULTICONFIG_GENERATOR)
|
||||
# Only set when we know we are in a single-configuration generator
|
||||
# Note: we may want to fail early if `CMAKE_BUILD_TYPE` is not defined
|
||||
set(${BUILD_TYPE} ${CMAKE_BUILD_TYPE} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
macro(set_conan_compiler_if_appleclang lang command output_variable)
|
||||
if(CMAKE_${lang}_COMPILER_ID STREQUAL "AppleClang")
|
||||
execute_process(COMMAND xcrun --find ${command}
|
||||
OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
cmake_path(GET _xcrun_out PARENT_PATH _xcrun_toolchain_path)
|
||||
cmake_path(GET CMAKE_${lang}_COMPILER PARENT_PATH _compiler_parent_path)
|
||||
if ("${_xcrun_toolchain_path}" STREQUAL "${_compiler_parent_path}")
|
||||
set(${output_variable} "")
|
||||
endif()
|
||||
unset(_xcrun_out)
|
||||
unset(_xcrun_toolchain_path)
|
||||
unset(_compiler_parent_path)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(append_compiler_executables_configuration)
|
||||
set(_conan_c_compiler "")
|
||||
set(_conan_cpp_compiler "")
|
||||
if(CMAKE_C_COMPILER)
|
||||
set(_conan_c_compiler "\"c\":\"${CMAKE_C_COMPILER}\",")
|
||||
set_conan_compiler_if_appleclang(C cc _conan_c_compiler)
|
||||
else()
|
||||
message(WARNING "CMake-Conan: The C compiler is not defined. "
|
||||
"Please define CMAKE_C_COMPILER or enable the C language.")
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER)
|
||||
set(_conan_cpp_compiler "\"cpp\":\"${CMAKE_CXX_COMPILER}\"")
|
||||
set_conan_compiler_if_appleclang(CXX c++ _conan_cpp_compiler)
|
||||
else()
|
||||
message(WARNING "CMake-Conan: The C++ compiler is not defined. "
|
||||
"Please define CMAKE_CXX_COMPILER or enable the C++ language.")
|
||||
endif()
|
||||
|
||||
if(NOT "x${_conan_c_compiler}${_conan_cpp_compiler}" STREQUAL "x")
|
||||
string(APPEND PROFILE "tools.build:compiler_executables={${_conan_c_compiler}${_conan_cpp_compiler}}\n")
|
||||
endif()
|
||||
unset(_conan_c_compiler)
|
||||
unset(_conan_cpp_compiler)
|
||||
endmacro()
|
||||
|
||||
|
||||
function(detect_host_profile output_file)
|
||||
detect_os(MYOS MYOS_API_LEVEL MYOS_SDK MYOS_SUBSYSTEM MYOS_VERSION)
|
||||
detect_arch(MYARCH)
|
||||
detect_compiler(MYCOMPILER MYCOMPILER_VERSION MYCOMPILER_RUNTIME MYCOMPILER_RUNTIME_TYPE)
|
||||
detect_cxx_standard(MYCXX_STANDARD)
|
||||
detect_lib_cxx(MYLIB_CXX)
|
||||
detect_build_type(MYBUILD_TYPE)
|
||||
|
||||
set(PROFILE "")
|
||||
string(APPEND PROFILE "[settings]\n")
|
||||
if(MYARCH)
|
||||
string(APPEND PROFILE arch=${MYARCH} "\n")
|
||||
endif()
|
||||
if(MYOS)
|
||||
string(APPEND PROFILE os=${MYOS} "\n")
|
||||
endif()
|
||||
if(MYOS_API_LEVEL)
|
||||
string(APPEND PROFILE os.api_level=${MYOS_API_LEVEL} "\n")
|
||||
endif()
|
||||
if(MYOS_VERSION)
|
||||
string(APPEND PROFILE os.version=${MYOS_VERSION} "\n")
|
||||
endif()
|
||||
if(MYOS_SDK)
|
||||
string(APPEND PROFILE os.sdk=${MYOS_SDK} "\n")
|
||||
endif()
|
||||
if(MYOS_SUBSYSTEM)
|
||||
string(APPEND PROFILE os.subsystem=${MYOS_SUBSYSTEM} "\n")
|
||||
endif()
|
||||
if(MYCOMPILER)
|
||||
string(APPEND PROFILE compiler=${MYCOMPILER} "\n")
|
||||
endif()
|
||||
if(MYCOMPILER_VERSION)
|
||||
string(APPEND PROFILE compiler.version=${MYCOMPILER_VERSION} "\n")
|
||||
endif()
|
||||
if(MYCOMPILER_RUNTIME)
|
||||
string(APPEND PROFILE compiler.runtime=${MYCOMPILER_RUNTIME} "\n")
|
||||
endif()
|
||||
if(MYCOMPILER_RUNTIME_TYPE)
|
||||
string(APPEND PROFILE compiler.runtime_type=${MYCOMPILER_RUNTIME_TYPE} "\n")
|
||||
endif()
|
||||
if(MYCXX_STANDARD)
|
||||
string(APPEND PROFILE compiler.cppstd=${MYCXX_STANDARD} "\n")
|
||||
endif()
|
||||
if(MYLIB_CXX)
|
||||
string(APPEND PROFILE compiler.libcxx=${MYLIB_CXX} "\n")
|
||||
endif()
|
||||
if(MYBUILD_TYPE)
|
||||
string(APPEND PROFILE "build_type=${MYBUILD_TYPE}\n")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED output_file)
|
||||
set(_FN "${CMAKE_BINARY_DIR}/profile")
|
||||
else()
|
||||
set(_FN ${output_file})
|
||||
endif()
|
||||
|
||||
string(APPEND PROFILE "[conf]\n")
|
||||
string(APPEND PROFILE "tools.cmake.cmaketoolchain:generator=${CMAKE_GENERATOR}\n")
|
||||
|
||||
# propagate compilers via profile
|
||||
append_compiler_executables_configuration()
|
||||
|
||||
if(MYOS STREQUAL "Android")
|
||||
string(APPEND PROFILE "tools.android:ndk_path=${CMAKE_ANDROID_NDK}\n")
|
||||
endif()
|
||||
|
||||
message(STATUS "CMake-Conan: Creating profile ${_FN}")
|
||||
file(WRITE ${_FN} ${PROFILE})
|
||||
message(STATUS "CMake-Conan: Profile: \n${PROFILE}")
|
||||
endfunction()
|
||||
|
||||
|
||||
function(conan_profile_detect_default)
|
||||
message(STATUS "CMake-Conan: Checking if a default profile exists")
|
||||
execute_process(COMMAND ${CONAN_COMMAND} profile path default
|
||||
RESULT_VARIABLE return_code
|
||||
OUTPUT_VARIABLE conan_stdout
|
||||
ERROR_VARIABLE conan_stderr
|
||||
ECHO_ERROR_VARIABLE # show the text output regardless
|
||||
ECHO_OUTPUT_VARIABLE
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
if(NOT ${return_code} EQUAL "0")
|
||||
message(STATUS "CMake-Conan: The default profile doesn't exist, detecting it.")
|
||||
execute_process(COMMAND ${CONAN_COMMAND} profile detect
|
||||
RESULT_VARIABLE return_code
|
||||
OUTPUT_VARIABLE conan_stdout
|
||||
ERROR_VARIABLE conan_stderr
|
||||
ECHO_ERROR_VARIABLE # show the text output regardless
|
||||
ECHO_OUTPUT_VARIABLE
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
function(conan_install)
|
||||
cmake_parse_arguments(ARGS CONAN_ARGS ${ARGN})
|
||||
set(CONAN_OUTPUT_FOLDER ${CMAKE_BINARY_DIR}/conan)
|
||||
# Invoke "conan install" with the provided arguments
|
||||
set(CONAN_ARGS ${CONAN_ARGS} -of=${CONAN_OUTPUT_FOLDER})
|
||||
message(STATUS "CMake-Conan: conan install ${CMAKE_SOURCE_DIR} ${CONAN_ARGS} ${ARGN}")
|
||||
|
||||
|
||||
# In case there was not a valid cmake executable in the PATH, we inject the
|
||||
# same we used to invoke the provider to the PATH
|
||||
if(DEFINED PATH_TO_CMAKE_BIN)
|
||||
set(_OLD_PATH $ENV{PATH})
|
||||
set(ENV{PATH} "$ENV{PATH}:${PATH_TO_CMAKE_BIN}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${CONAN_COMMAND} install ${CMAKE_SOURCE_DIR}/contrib/cmake ${CONAN_ARGS} ${ARGN} --format=json
|
||||
RESULT_VARIABLE return_code
|
||||
OUTPUT_VARIABLE conan_stdout
|
||||
ERROR_VARIABLE conan_stderr
|
||||
ECHO_ERROR_VARIABLE # show the text output regardless
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if(DEFINED PATH_TO_CMAKE_BIN)
|
||||
set(ENV{PATH} "${_OLD_PATH}")
|
||||
endif()
|
||||
|
||||
if(NOT "${return_code}" STREQUAL "0")
|
||||
message(FATAL_ERROR "Conan install failed='${return_code}'")
|
||||
endif()
|
||||
|
||||
# the files are generated in a folder that depends on the layout used, if
|
||||
# one is specified, but we don't know a priori where this is.
|
||||
# TODO: this can be made more robust if Conan can provide this in the json output
|
||||
string(JSON CONAN_GENERATORS_FOLDER GET ${conan_stdout} graph nodes 0 generators_folder)
|
||||
cmake_path(CONVERT ${CONAN_GENERATORS_FOLDER} TO_CMAKE_PATH_LIST CONAN_GENERATORS_FOLDER)
|
||||
# message("conan stdout: ${conan_stdout}")
|
||||
message(STATUS "CMake-Conan: CONAN_GENERATORS_FOLDER=${CONAN_GENERATORS_FOLDER}")
|
||||
set_property(GLOBAL PROPERTY CONAN_GENERATORS_FOLDER "${CONAN_GENERATORS_FOLDER}")
|
||||
# reconfigure on conanfile changes
|
||||
string(JSON CONANFILE GET ${conan_stdout} graph nodes 0 label)
|
||||
message(STATUS "CMake-Conan: CONANFILE=${CMAKE_SOURCE_DIR}/contrib/cmake/${CONANFILE}")
|
||||
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/contrib/cmake/${CONANFILE}")
|
||||
# success
|
||||
set_property(GLOBAL PROPERTY CONAN_INSTALL_SUCCESS TRUE)
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
function(conan_get_version conan_command conan_current_version)
|
||||
execute_process(
|
||||
COMMAND ${conan_command} --version
|
||||
OUTPUT_VARIABLE conan_output
|
||||
RESULT_VARIABLE conan_result
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(conan_result)
|
||||
message(FATAL_ERROR "CMake-Conan: Error when trying to run Conan")
|
||||
endif()
|
||||
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" conan_version ${conan_output})
|
||||
set(${conan_current_version} ${conan_version} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
function(conan_version_check)
|
||||
set(options )
|
||||
set(oneValueArgs MINIMUM CURRENT)
|
||||
set(multiValueArgs )
|
||||
cmake_parse_arguments(CONAN_VERSION_CHECK
|
||||
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT CONAN_VERSION_CHECK_MINIMUM)
|
||||
message(FATAL_ERROR "CMake-Conan: Required parameter MINIMUM not set!")
|
||||
endif()
|
||||
if(NOT CONAN_VERSION_CHECK_CURRENT)
|
||||
message(FATAL_ERROR "CMake-Conan: Required parameter CURRENT not set!")
|
||||
endif()
|
||||
|
||||
if(CONAN_VERSION_CHECK_CURRENT VERSION_LESS CONAN_VERSION_CHECK_MINIMUM)
|
||||
message(FATAL_ERROR "CMake-Conan: Conan version must be ${CONAN_VERSION_CHECK_MINIMUM} or later")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
macro(construct_profile_argument argument_variable profile_list)
|
||||
set(${argument_variable} "")
|
||||
if("${profile_list}" STREQUAL "CONAN_HOST_PROFILE")
|
||||
set(_arg_flag "--profile:host=")
|
||||
elseif("${profile_list}" STREQUAL "CONAN_BUILD_PROFILE")
|
||||
set(_arg_flag "--profile:build=")
|
||||
endif()
|
||||
|
||||
set(_profile_list "${${profile_list}}")
|
||||
list(TRANSFORM _profile_list REPLACE "auto-cmake" "${CMAKE_BINARY_DIR}/conan_host_profile")
|
||||
list(TRANSFORM _profile_list PREPEND ${_arg_flag})
|
||||
set(${argument_variable} ${_profile_list})
|
||||
|
||||
unset(_arg_flag)
|
||||
unset(_profile_list)
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(conan_provide_dependency method package_name)
|
||||
set_property(GLOBAL PROPERTY CONAN_PROVIDE_DEPENDENCY_INVOKED TRUE)
|
||||
get_property(_conan_install_success GLOBAL PROPERTY CONAN_INSTALL_SUCCESS)
|
||||
if(NOT _conan_install_success)
|
||||
find_program(CONAN_COMMAND "conan" REQUIRED)
|
||||
conan_get_version(${CONAN_COMMAND} CONAN_CURRENT_VERSION)
|
||||
conan_version_check(MINIMUM ${CONAN_MINIMUM_VERSION} CURRENT ${CONAN_CURRENT_VERSION})
|
||||
message(STATUS "CMake-Conan: first find_package() found. Installing dependencies with Conan")
|
||||
if("default" IN_LIST CONAN_HOST_PROFILE OR "default" IN_LIST CONAN_BUILD_PROFILE)
|
||||
conan_profile_detect_default()
|
||||
endif()
|
||||
if("auto-cmake" IN_LIST CONAN_HOST_PROFILE)
|
||||
detect_host_profile(${CMAKE_BINARY_DIR}/conan_host_profile)
|
||||
endif()
|
||||
construct_profile_argument(_host_profile_flags CONAN_HOST_PROFILE)
|
||||
construct_profile_argument(_build_profile_flags CONAN_BUILD_PROFILE)
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/conanfile.py")
|
||||
file(READ "${CMAKE_SOURCE_DIR}/conanfile.py" outfile)
|
||||
if(NOT "${outfile}" MATCHES ".*CMakeDeps.*")
|
||||
message(WARNING "Cmake-conan: CMakeDeps generator was not defined in the conanfile")
|
||||
endif()
|
||||
set(generator "")
|
||||
elseif (EXISTS "${CMAKE_SOURCE_DIR}/conanfile.txt")
|
||||
file(READ "${CMAKE_SOURCE_DIR}/conanfile.txt" outfile)
|
||||
if(NOT "${outfile}" MATCHES ".*CMakeDeps.*")
|
||||
message(WARNING "Cmake-conan: CMakeDeps generator was not defined in the conanfile. "
|
||||
"Please define the generator as it will be mandatory in the future")
|
||||
endif()
|
||||
set(generator "-g;CMakeDeps")
|
||||
endif()
|
||||
get_property(_multiconfig_generator GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(NOT _multiconfig_generator)
|
||||
message(STATUS "CMake-Conan: Installing single configuration ${CMAKE_BUILD_TYPE}")
|
||||
conan_install(${_host_profile_flags} ${_build_profile_flags} ${CONAN_INSTALL_ARGS} ${generator})
|
||||
else()
|
||||
message(STATUS "CMake-Conan: Installing both Debug and Release")
|
||||
conan_install(${_host_profile_flags} ${_build_profile_flags} -s build_type=Release ${CONAN_INSTALL_ARGS} ${generator})
|
||||
conan_install(${_host_profile_flags} ${_build_profile_flags} -s build_type=Debug ${CONAN_INSTALL_ARGS} ${generator})
|
||||
endif()
|
||||
unset(_host_profile_flags)
|
||||
unset(_build_profile_flags)
|
||||
unset(_multiconfig_generator)
|
||||
unset(_conan_install_success)
|
||||
else()
|
||||
message(STATUS "CMake-Conan: find_package(${ARGV1}) found, 'conan install' already ran")
|
||||
unset(_conan_install_success)
|
||||
endif()
|
||||
|
||||
get_property(_conan_generators_folder GLOBAL PROPERTY CONAN_GENERATORS_FOLDER)
|
||||
|
||||
# Ensure that we consider Conan-provided packages ahead of any other,
|
||||
# irrespective of other settings that modify the search order or search paths
|
||||
# This follows the guidelines from the find_package documentation
|
||||
# (https://cmake.org/cmake/help/latest/command/find_package.html):
|
||||
# find_package (<PackageName> PATHS paths... NO_DEFAULT_PATH)
|
||||
# find_package (<PackageName>)
|
||||
|
||||
# Filter out `REQUIRED` from the argument list, as the first call may fail
|
||||
set(_find_args_${package_name} "${ARGN}")
|
||||
list(REMOVE_ITEM _find_args_${package_name} "REQUIRED")
|
||||
if(NOT "MODULE" IN_LIST _find_args_${package_name})
|
||||
find_package(${package_name} ${_find_args_${package_name}} BYPASS_PROVIDER PATHS "${_conan_generators_folder}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
||||
unset(_find_args_${package_name})
|
||||
endif()
|
||||
|
||||
# Invoke find_package a second time - if the first call succeeded,
|
||||
# this will simply reuse the result. If not, fall back to CMake default search
|
||||
# behaviour, also allowing modules to be searched.
|
||||
if(NOT ${package_name}_FOUND)
|
||||
list(FIND CMAKE_MODULE_PATH "${_conan_generators_folder}" _index)
|
||||
if(_index EQUAL -1)
|
||||
list(PREPEND CMAKE_MODULE_PATH "${_conan_generators_folder}")
|
||||
endif()
|
||||
unset(_index)
|
||||
find_package(${package_name} ${ARGN} BYPASS_PROVIDER)
|
||||
list(REMOVE_ITEM CMAKE_MODULE_PATH "${_conan_generators_folder}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
cmake_language(
|
||||
SET_DEPENDENCY_PROVIDER conan_provide_dependency
|
||||
SUPPORTED_METHODS FIND_PACKAGE
|
||||
)
|
||||
|
||||
|
||||
macro(conan_provide_dependency_check)
|
||||
set(_CONAN_PROVIDE_DEPENDENCY_INVOKED FALSE)
|
||||
get_property(_CONAN_PROVIDE_DEPENDENCY_INVOKED GLOBAL PROPERTY CONAN_PROVIDE_DEPENDENCY_INVOKED)
|
||||
if(NOT _CONAN_PROVIDE_DEPENDENCY_INVOKED)
|
||||
message(WARNING "Conan is correctly configured as dependency provider, "
|
||||
"but Conan has not been invoked. Please add at least one "
|
||||
"call to `find_package()`.")
|
||||
if(DEFINED CONAN_COMMAND)
|
||||
# supress warning in case `CONAN_COMMAND` was specified but unused.
|
||||
set(_CONAN_COMMAND ${CONAN_COMMAND})
|
||||
unset(_CONAN_COMMAND)
|
||||
endif()
|
||||
endif()
|
||||
unset(_CONAN_PROVIDE_DEPENDENCY_INVOKED)
|
||||
endmacro()
|
||||
|
||||
|
||||
# Add a deferred call at the end of processing the top-level directory
|
||||
# to check if the dependency provider was invoked at all.
|
||||
cmake_language(DEFER DIRECTORY "${CMAKE_SOURCE_DIR}" CALL conan_provide_dependency_check)
|
||||
|
||||
# Configurable variables for Conan profiles
|
||||
set(CONAN_HOST_PROFILE "default;auto-cmake" CACHE STRING "Conan host profile")
|
||||
set(CONAN_BUILD_PROFILE "default" CACHE STRING "Conan build profile")
|
||||
set(CONAN_INSTALL_ARGS "--build=missing" CACHE STRING "Command line arguments for conan install")
|
||||
|
||||
find_program(_cmake_program NAMES cmake NO_PACKAGE_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH)
|
||||
if(NOT _cmake_program)
|
||||
get_filename_component(PATH_TO_CMAKE_BIN "${CMAKE_COMMAND}" DIRECTORY)
|
||||
set(PATH_TO_CMAKE_BIN "${PATH_TO_CMAKE_BIN}" CACHE INTERNAL "Path where the CMake executable is")
|
||||
endif()
|
||||
|
||||
3
contrib/cmake/conandata.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
requirements:
|
||||
- "openssl/3.2.1"
|
||||
- "boost/1.84.0"
|
||||
25
contrib/cmake/conanfile.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# This file is managed by Conan, contents will be overwritten.
|
||||
# To keep your changes, remove these comment lines, but the plugin won't be able to modify your requirements
|
||||
import os
|
||||
from io import StringIO
|
||||
from conan import ConanFile
|
||||
from conan.tools.files import load, copy
|
||||
from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain
|
||||
|
||||
class ConanApplication(ConanFile):
|
||||
package_type = "application"
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
generators = "CMakeDeps", "CMakeToolchain"
|
||||
|
||||
def layout(self):
|
||||
# The root of the project is one level above
|
||||
#self.folders.root = os.path.dirname(os.path.dirname('.'))
|
||||
# The source of the project (the root CMakeLists.txt) is the source folder
|
||||
#self.folders.source = "."
|
||||
#self.folders.build = "build"
|
||||
cmake_layout(self)
|
||||
|
||||
def requirements(self):
|
||||
requirements = self.conan_data.get('requirements', [])
|
||||
for requirement in requirements:
|
||||
self.requires(requirement)
|
||||
2
contrib/cmake/requirements.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
conan
|
||||
pytest
|
||||
5
contrib/cmake/settings_user.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
compiler:
|
||||
gcc:
|
||||
version: ["11.4.0"]
|
||||
apple-clang:
|
||||
version: ["15.0.0.15000040"]
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019, anonimal, <anonimal@zano.org>
|
||||
// Copyright (c) 2019, anonimal, <anonimal@lethean.org>
|
||||
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright (c) 2019, Zano Project
|
||||
// Copyright (c) 2019, anonimal <anonimal@zano.org>
|
||||
// Copyright (c) 2019, anonimal <anonimal@lethean.org>
|
||||
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019, anonimal <anonimal@zano.org>
|
||||
// Copyright (c) 2019, anonimal <anonimal@lethean.org>
|
||||
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 9.6 KiB |
|
|
@ -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
|
||||
|
|
@ -50,9 +50,6 @@ MACRO(ENABLE_SHARED_PCH_EXECUTABLE target)
|
|||
ENDMACRO(ENABLE_SHARED_PCH_EXECUTABLE)
|
||||
##### End of Precompiled Headers macros ######
|
||||
|
||||
|
||||
|
||||
|
||||
file(GLOB_RECURSE PCH pch/*)
|
||||
file(GLOB_RECURSE COMMON common/*)
|
||||
file(GLOB_RECURSE CRYPTO crypto/*)
|
||||
|
|
@ -68,17 +65,6 @@ file(GLOB_RECURSE CONN_TOOL connectivity_tool/*)
|
|||
file(GLOB_RECURSE WALLET wallet/*)
|
||||
file(GLOB_RECURSE MINER miner/*)
|
||||
|
||||
if(BUILD_GUI)
|
||||
if(MSVC)
|
||||
file(GLOB_RECURSE QTDAEMON gui/qt-daemon/*.cpp gui/qt-daemon/*.h gui/qt-daemon/app.rc)
|
||||
elseif(APPLE)
|
||||
file(GLOB_RECURSE QTDAEMON gui/qt-daemon/*.cpp gui/qt-daemon/*.h gui/qt-daemon/*.mm)
|
||||
else()
|
||||
file(GLOB_RECURSE QTDAEMON gui/qt-daemon/*.cpp gui/qt-daemon/*.h)
|
||||
endif()
|
||||
list(FILTER QTDAEMON EXCLUDE REGEX "node_modules")
|
||||
endif()
|
||||
|
||||
|
||||
source_group(pch FILES ${PCH})
|
||||
source_group(common FILES ${COMMON})
|
||||
|
|
@ -89,15 +75,10 @@ source_group(daemon FILES ${DAEMON})
|
|||
source_group(p2p FILES ${P2P})
|
||||
source_group(rpc FILES ${RPC})
|
||||
source_group(stratum FILES ${STRATUM})
|
||||
source_group(simplewallet FILES ${SIMPLEWALLET})
|
||||
source_group(lethean-cli-wallet FILES ${SIMPLEWALLET})
|
||||
source_group(connectivity-tool FILES ${CONN_TOOL})
|
||||
source_group(wallet FILES ${WALLET})
|
||||
|
||||
if(BUILD_GUI)
|
||||
source_group(qtdaemon FILES ${QTDAEMON})
|
||||
endif()
|
||||
|
||||
|
||||
INIT_SHARED_PCH()
|
||||
|
||||
add_library(common ${COMMON})
|
||||
|
|
@ -134,11 +115,6 @@ if(NOT DISABLE_TOR)
|
|||
target_link_libraries(wallet tor-connect)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
install(TARGETS wallet currency_core crypto common DESTINATION lib)
|
||||
message("Generating install for iOS")
|
||||
|
|
@ -172,74 +148,13 @@ target_link_libraries(connectivity_tool currency_core crypto common zlibstatic e
|
|||
ENABLE_SHARED_PCH(connectivity_tool CONN_TOOL)
|
||||
ENABLE_SHARED_PCH_EXECUTABLE(connectivity_tool)
|
||||
|
||||
add_executable(simplewallet ${SIMPLEWALLET})
|
||||
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)
|
||||
add_executable(lethean-wallet ${SIMPLEWALLET})
|
||||
add_dependencies(lethean-wallet version)
|
||||
target_link_libraries(lethean-wallet wallet rpc currency_core crypto common zlibstatic ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
|
||||
|
||||
ENABLE_SHARED_PCH(simplewallet SIMPLEWALLET)
|
||||
ENABLE_SHARED_PCH_EXECUTABLE(simplewallet)
|
||||
ENABLE_SHARED_PCH(lethean-wallet SIMPLEWALLET)
|
||||
ENABLE_SHARED_PCH_EXECUTABLE(lethean-wallet)
|
||||
|
||||
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")
|
||||
|
||||
if(BUILD_GUI)
|
||||
|
||||
if(APPLE)
|
||||
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
|
||||
endif()
|
||||
|
||||
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)
|
||||
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)
|
||||
if (UNIX AND NOT APPLE)
|
||||
target_link_libraries(Zano rt)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
target_link_libraries(Zano ${COCOA_LIBRARY})
|
||||
set_property(TARGET Zano PROPERTY XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES)
|
||||
endif()
|
||||
if(MSVC)
|
||||
target_link_libraries(Zano 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(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()
|
||||
set_property(TARGET daemon lethean-wallet connectivity_tool PROPERTY FOLDER "prog")
|
||||
set_property(TARGET daemon PROPERTY OUTPUT_NAME "letheand")
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1825,6 +1825,7 @@ 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;
|
||||
|
|
@ -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
|
||||
{
|
||||
|
|
@ -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<const crypto::public_key *> output_keys_ptrs;
|
||||
output_keys_ptrs.reserve(output_keys.size());
|
||||
for (auto& ptr : output_keys)
|
||||
|
|
@ -6749,7 +6751,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
|
|||
<< ", 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()
|
||||
<< "/" << longhash_calculating_time_3<< pos_validation_str_entry.str()
|
||||
<< "/" << insert_time_4
|
||||
<< "/" << all_txs_insert_time_5
|
||||
<< "/" << etc_stuff_6
|
||||
|
|
@ -7460,7 +7462,6 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
|
|||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#include "serialization/debug_archive.h"
|
||||
#include "serialization/keyvalue_serialization.h" // epee key-value serialization
|
||||
#include "string_tools.h"
|
||||
#include "currency_config.h"
|
||||
#include "currency_core/currency_config.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/hash.h"
|
||||
#include "crypto/range_proofs.h"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
|
||||
#ifndef TESTNET
|
||||
#define CURRENCY_FORMATION_VERSION 84
|
||||
#define CURRENCY_FORMATION_VERSION 1
|
||||
#else
|
||||
#define CURRENCY_FORMATION_VERSION 97
|
||||
#endif
|
||||
|
|
@ -19,18 +19,18 @@
|
|||
|
||||
#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_MAX_ALLOWED_OUTS 2000 // effective starting HF4 Zarcanum
|
||||
#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_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 ((uint64_t)2)
|
||||
#define HF1_BLOCK_MAJOR_VERSION 1
|
||||
#define HF3_BLOCK_MAJOR_VERSION 2
|
||||
#define HF3_BLOCK_MINOR_VERSION 0
|
||||
|
|
@ -53,17 +53,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 +93,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 +110,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 SEED_NODE_HOST2 "dev.network"
|
||||
#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
|
||||
#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 +194,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 +214,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
|
||||
|
|
@ -264,16 +268,15 @@
|
|||
#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
|
||||
#define ZANO_HARDFORK_04_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
|
||||
#define ZANO_HARDFORK_04_AFTER_HEIGHT 3
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -163,6 +163,8 @@ namespace currency
|
|||
r = m_blockchain_storage.init(m_config_folder, vm);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to initialize blockchain storage");
|
||||
|
||||
m_mempool.remove_incompatible_txs();
|
||||
|
||||
r = m_miner.init(vm);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to initialize miner");
|
||||
|
||||
|
|
|
|||
|
|
@ -1736,7 +1736,7 @@ namespace currency
|
|||
|
||||
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);
|
||||
|
|
@ -3729,6 +3729,8 @@ namespace currency
|
|||
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)
|
||||
|
|
@ -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_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 Zano address (normal)
|
||||
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_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 Zano address (normal)
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,18 +10,17 @@ 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;
|
||||
|
|
|
|||
|
|
@ -10,46 +10,19 @@
|
|||
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<crypto::public_key>(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<crypto::public_key>(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<crypto::public_key>(ggenesis_tx_pub_key_str);
|
||||
extern const genesis_tx_dictionary_entry ggenesis_dict[1];
|
||||
const genesis_tx_dictionary_entry ggenesis_dict[1] = {
|
||||
{1056117391700764468ULL,0}
|
||||
};
|
||||
#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<crypto::public_key>(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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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)
|
||||
|
|
@ -1293,6 +1291,27 @@ namespace currency
|
|||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------------------------
|
||||
void tx_memory_pool::remove_incompatible_txs()
|
||||
{
|
||||
std::vector<crypto::hash> invalid_tx_ids;
|
||||
|
||||
m_db_transactions.enumerate_items([&](uint64_t i, const crypto::hash& h, const tx_details &tx_entry)
|
||||
{
|
||||
if (!m_blockchain.validate_tx_for_hardfork_specific_terms(tx_entry.tx, h))
|
||||
invalid_tx_ids.push_back(h);
|
||||
return true;
|
||||
});
|
||||
|
||||
for(const auto& id : invalid_tx_ids)
|
||||
{
|
||||
transaction tx{};
|
||||
size_t blob_size = 0;
|
||||
uint64_t fee = 0;
|
||||
take_tx(id, tx, blob_size, fee);
|
||||
LOG_PRINT_L0("tx " << id << " was incompatible with the hardfork rules and removed");
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------------
|
||||
bool tx_memory_pool::load_keyimages_cache()
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(m_key_images_lock);
|
||||
|
|
|
|||
|
|
@ -138,6 +138,8 @@ namespace currency
|
|||
|
||||
bool remove_stuck_transactions(); // made public to be called from coretests
|
||||
|
||||
void remove_incompatible_txs(); // made public to be called after the BCS is loaded and hardfork info is ready
|
||||
|
||||
private:
|
||||
bool on_tx_add(crypto::hash tx_id, const transaction& tx, bool kept_by_block);
|
||||
bool on_tx_remove(const crypto::hash &tx_id, const transaction& tx, bool kept_by_block);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include "currency_core/currency_config.h"
|
||||
#define GUI_LINK_NAME "Zano"
|
||||
#define GUI_LINK_NAME "Lethean"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32_WINNT
|
||||
49
src/gui/main.cpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#include "websocketclientwrapper.h"
|
||||
#include "websockettransport.h"
|
||||
#include "mainwindow.h"
|
||||
#include "include_base_utils.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QUrl>
|
||||
#include <QWebChannel>
|
||||
#include <QWebSocketServer>
|
||||
#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();
|
||||
}
|
||||
|
|
@ -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<typename Arg, typename R, typename C>
|
||||
// struct InvokeWrapper {
|
||||
// R *receiver;
|
||||
// void (C::*memberFun)(Arg);
|
||||
// void operator()(Arg result) {
|
||||
// (receiver->*memberFun)(result);
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// template<typename Arg, typename R, typename C>
|
||||
// InvokeWrapper<Arg, R, C> invoke(R *receiver, void (C::*memberFun)(Arg))
|
||||
// {
|
||||
// InvokeWrapper<Arg, R, C> 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();
|
||||
|
|
@ -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<QAction>(new QAction(tr("&Restore"), this));
|
||||
connect(m_restore_action.get(), SIGNAL(triggered()), this, SLOT(on_menu_show()));
|
||||
|
||||
m_quit_action = std::unique_ptr<QAction>(new QAction(tr("&Quit"), this));
|
||||
connect(m_quit_action.get(), SIGNAL(triggered()), this, SLOT(tray_quit_requested()));
|
||||
|
||||
m_minimize_action = std::unique_ptr<QAction>(new QAction(tr("minimizeAction"), this));
|
||||
connect(m_minimize_action.get(), SIGNAL(triggered()), this, SLOT(showMinimized()));
|
||||
|
||||
m_tray_icon_menu = std::unique_ptr<QMenu>(new QMenu(this));
|
||||
m_tray_icon_menu->addAction(m_minimize_action.get());
|
||||
m_tray_icon_menu = std::unique_ptr<QMenu>(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<QSystemTrayIcon>(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();
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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();
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
|
@ -49,19 +49,18 @@ QT_END_NAMESPACE
|
|||
// };
|
||||
|
||||
//
|
||||
class MainWindow : public QMainWindow,
|
||||
class MainWindow : public QObject,
|
||||
public currency::i_core_event_handler,
|
||||
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);
|
||||
|
||||
|
|
@ -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);
|
||||
|
|
@ -169,14 +164,13 @@ public:
|
|||
QString get_default_fee();
|
||||
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,20 +230,15 @@ 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();
|
||||
|
|
@ -262,12 +248,6 @@ private:
|
|||
|
||||
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<bool> m_quit_requested;
|
||||
|
|
@ -279,7 +259,6 @@ private:
|
|||
|
||||
std::string m_master_password;
|
||||
|
||||
|
||||
app_config m_config;
|
||||
|
||||
epee::locked_object<std::map<uint64_t, uint64_t>> m_wallet_states;
|
||||
1
src/gui/qt-daemon/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
|||
*.user
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>LSEnvironment</key>
|
||||
<dict>
|
||||
</dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>14E46</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Zano</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>app.icns</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string></string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>Zano</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>6E35b</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>14D125</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.10</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0640</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>6E35b</string>
|
||||
<key>LSRequiresCarbon</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>True</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>ZanoApp</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>zano</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
|
||||
</dict>
|
||||
</plist>
|
||||
|
Before Width: | Height: | Size: 109 KiB |
|
|
@ -1,5 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>app.ico</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
IDI_ICON1 ICON DISCARDABLE "app.ico"
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit f8e9556fbaccd49841ce91afc3c90c8e3142ac95
|
||||
|
|
@ -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 <sstream>
|
||||
|
||||
//#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;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
BIN
src/gui/resources/app22macos.png
Normal file
|
After Width: | Height: | Size: 8 KiB |
BIN
src/gui/resources/app22macos_blocked.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
src/gui/resources/app22windows.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
src/gui/resources/app22windows_blocked.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/gui/resources/desktop_linux_icon.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
7
src/gui/resources/files.qrc
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>app22macos.png</file>
|
||||
<file>app22windows.png</file>
|
||||
<file>lthn.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
BIN
src/gui/resources/lthn.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
34
src/gui/websocketclientwrapper.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include "websocketclientwrapper.h"
|
||||
#include "websockettransport.h"
|
||||
|
||||
#include <QWebSocketServer>
|
||||
|
||||
/*!
|
||||
\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()));
|
||||
}
|
||||
29
src/gui/websocketclientwrapper.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef WEBSOCKETCLIENTWRAPPER_H
|
||||
#define WEBSOCKETCLIENTWRAPPER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
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
|
||||
64
src/gui/websockettransport.cpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
#include "websockettransport.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QWebSocket>
|
||||
|
||||
/*!
|
||||
\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);
|
||||
}
|
||||
26
src/gui/websockettransport.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef WEBSOCKETTRANSPORT_H
|
||||
#define WEBSOCKETTRANSPORT_H
|
||||
|
||||
#include <QWebChannelAbstractTransport>
|
||||
|
||||
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
|
||||
|
|
@ -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
|
||||
{
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ bool simple_wallet::restore_wallet(const std::string& wallet_file, const std::st
|
|||
"Your wallet has been restored.\n" <<
|
||||
"To start synchronizing with the daemon use \"refresh\" command.\n" <<
|
||||
"Use \"help\" command to see the list of available commands.\n" <<
|
||||
"Always use \"exit\" command when closing simplewallet to save\n" <<
|
||||
"Always use \"exit\" command when closing lethean-cli-wallet to save\n" <<
|
||||
"current session's state. Otherwise, you will possibly need to synchronize \n" <<
|
||||
"your wallet again. Your wallet keys is NOT under risk anyway.\n" <<
|
||||
"**********************************************************************";
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
@ -1634,7 +1634,7 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
|
|||
{
|
||||
|
||||
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,13 +1693,13 @@ bool simple_wallet::transfer(const std::vector<std::string> &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()
|
||||
|
||||
|
|
@ -2494,7 +2494,7 @@ bool simple_wallet::sweep_below(const std::vector<std::string> &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)
|
||||
|
|
@ -2695,7 +2695,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
if (command_line::get_arg(vm, command_line::arg_help))
|
||||
{
|
||||
success_msg_writer() << "Usage: simplewallet [--wallet-file=<file>|--generate-new-wallet=<file>] [--daemon-address=<host>:<port>] [<COMMAND>]";
|
||||
success_msg_writer() << "Usage: lethean-cli-wallet [--wallet-file=<file>|--generate-new-wallet=<file>] [--daemon-address=<host>:<port>] [<COMMAND>]";
|
||||
success_msg_writer() << desc_all << '\n' << sw->get_commands_str();
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 "]"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -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);
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1638,7 +1638,7 @@ multisig_and_checkpoints::multisig_and_checkpoints()
|
|||
bool multisig_and_checkpoints::set_cp(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
|
||||
{
|
||||
currency::checkpoints checkpoints;
|
||||
checkpoints.add_checkpoint(15, "6f9194c144afd73077478e7f04e947c50160b5673558e6f696a4f662a3ca261e");
|
||||
checkpoints.add_checkpoint(15, "3e163f0828e08aea66775a3a92ead64298a67e0de66e6aa5453673716f2a5970");
|
||||
c.set_checkpoints(std::move(checkpoints));
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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<std::vector<uint8_t>> test_data;
|
||||
test_data.push_back(std::vector<uint8_t>(32, 0));
|
||||
test_data.push_back(std::vector<uint8_t>(63, 0));
|
||||
test_data.push_back(std::vector<uint8_t>(127, 0));
|
||||
test_data.push_back(std::vector<uint8_t>(135, 0));
|
||||
test_data.push_back(std::vector<uint8_t>(255, 0));
|
||||
test_data.push_back(std::vector<uint8_t>(271, 0)); // 271 = 136 * 2 - 1
|
||||
test_data.push_back(std::vector<uint8_t>(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<times_t> results(test_data.size());
|
||||
|
||||
size_t n = 50000;
|
||||
double diff_sum = 0;
|
||||
|
||||
for (size_t k = 0; k < 50; ++k)
|
||||
{
|
||||
for (size_t j = 0, sz = test_data.size(); j < sz; ++j)
|
||||
{
|
||||
crypto::hash h = h_initial;
|
||||
TIME_MEASURE_START(t_old);
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
{
|
||||
*(crypto::hash*)(test_data[j].data()) = h;
|
||||
cn_fast_hash_old(test_data[j].data(), test_data[j].size(), (char*)&h);
|
||||
}
|
||||
TIME_MEASURE_FINISH(t_old);
|
||||
results[j].t_old = t_old;
|
||||
results[j].h_old = h;
|
||||
}
|
||||
|
||||
for (size_t j = 0, sz = test_data.size(); j < sz; ++j)
|
||||
{
|
||||
crypto::hash h = h_initial;
|
||||
TIME_MEASURE_START(t_new);
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
{
|
||||
*(crypto::hash*)(test_data[j].data()) = h;
|
||||
cn_fast_hash(test_data[j].data(), test_data[j].size(), (char*)&h);
|
||||
}
|
||||
TIME_MEASURE_FINISH(t_new);
|
||||
results[j].t_new = t_new;
|
||||
ASSERT_EQ(h, results[j].h_old);
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
double diff_round = 0;
|
||||
for (size_t j = 0, sz = test_data.size(); j < sz; ++j)
|
||||
{
|
||||
double diff = ((int64_t)results[j].t_old - (int64_t)results[j].t_new) / (double)n;
|
||||
|
||||
ss << std::fixed << std::setprecision(3) << results[j].t_old / (double)n << "/" <<
|
||||
std::fixed << std::setprecision(3) << results[j].t_new / (double)n << " ";
|
||||
|
||||
results[j].diff += diff;
|
||||
diff_round += diff;
|
||||
}
|
||||
|
||||
diff_sum += diff_round;
|
||||
|
||||
LOG_PRINT_L0("cn_fast_hash (old/new) [" << std::setw(2) << k << "]: " << ss.str() << " mcs, diff_round = " << std::fixed << std::setprecision(4) << diff_round <<
|
||||
" diff_sum = " << std::fixed << std::setprecision(4) << diff_sum);
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
for (size_t j = 0, sz = results.size(); j < sz; ++j)
|
||||
ss << std::fixed << std::setprecision(4) << results[j].diff << " ";
|
||||
LOG_PRINT_L0(" " << ss.str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//TEST(crypto, cn_fast_hash_perf)
|
||||
//{
|
||||
// return true;
|
||||
// const crypto::hash h_initial = *(crypto::hash*)(&scalar_t::random());
|
||||
//
|
||||
// std::vector<std::vector<uint8_t>> test_data;
|
||||
// test_data.push_back(std::vector<uint8_t>(32, 0));
|
||||
// test_data.push_back(std::vector<uint8_t>(63, 0));
|
||||
// test_data.push_back(std::vector<uint8_t>(127, 0));
|
||||
// test_data.push_back(std::vector<uint8_t>(135, 0));
|
||||
// test_data.push_back(std::vector<uint8_t>(255, 0));
|
||||
// test_data.push_back(std::vector<uint8_t>(271, 0)); // 271 = 136 * 2 - 1
|
||||
// test_data.push_back(std::vector<uint8_t>(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<times_t> results(test_data.size());
|
||||
//
|
||||
// size_t n = 50000;
|
||||
// double diff_sum = 0;
|
||||
//
|
||||
// for (size_t k = 0; k < 50; ++k)
|
||||
// {
|
||||
// for (size_t j = 0, sz = test_data.size(); j < sz; ++j)
|
||||
// {
|
||||
// crypto::hash h = h_initial;
|
||||
// TIME_MEASURE_START(t_old);
|
||||
// for (size_t i = 0; i < n; ++i)
|
||||
// {
|
||||
// *(crypto::hash*)(test_data[j].data()) = h;
|
||||
// cn_fast_hash_old(test_data[j].data(), test_data[j].size(), (char*)&h);
|
||||
// }
|
||||
// TIME_MEASURE_FINISH(t_old);
|
||||
// results[j].t_old = t_old;
|
||||
// results[j].h_old = h;
|
||||
// }
|
||||
//
|
||||
// for (size_t j = 0, sz = test_data.size(); j < sz; ++j)
|
||||
// {
|
||||
// crypto::hash h = h_initial;
|
||||
// TIME_MEASURE_START(t_new);
|
||||
// for (size_t i = 0; i < n; ++i)
|
||||
// {
|
||||
// *(crypto::hash*)(test_data[j].data()) = h;
|
||||
// cn_fast_hash(test_data[j].data(), test_data[j].size(), (char*)&h);
|
||||
// }
|
||||
// TIME_MEASURE_FINISH(t_new);
|
||||
// results[j].t_new = t_new;
|
||||
// ASSERT_EQ(h, results[j].h_old);
|
||||
// }
|
||||
//
|
||||
// std::stringstream ss;
|
||||
// double diff_round = 0;
|
||||
// for (size_t j = 0, sz = test_data.size(); j < sz; ++j)
|
||||
// {
|
||||
// double diff = ((int64_t)results[j].t_old - (int64_t)results[j].t_new) / (double)n;
|
||||
//
|
||||
// ss << std::fixed << std::setprecision(3) << results[j].t_old / (double)n << "/" <<
|
||||
// std::fixed << std::setprecision(3) << results[j].t_new / (double)n << " ";
|
||||
//
|
||||
// results[j].diff += diff;
|
||||
// diff_round += diff;
|
||||
// }
|
||||
//
|
||||
// diff_sum += diff_round;
|
||||
//
|
||||
// LOG_PRINT_L0("cn_fast_hash (old/new) [" << std::setw(2) << k << "]: " << ss.str() << " mcs, diff_round = " << std::fixed << std::setprecision(4) << diff_round <<
|
||||
// " diff_sum = " << std::fixed << std::setprecision(4) << diff_sum);
|
||||
// }
|
||||
//
|
||||
// std::stringstream ss;
|
||||
// for (size_t j = 0, sz = results.size(); j < sz; ++j)
|
||||
// ss << std::fixed << std::setprecision(4) << results[j].diff << " ";
|
||||
// LOG_PRINT_L0(" " << ss.str());
|
||||
//
|
||||
// return true;
|
||||
//}
|
||||
//
|
||||
|
||||
|
||||
TEST(crypto, sc_invert_performance)
|
||||
|
|
@ -1279,7 +1279,7 @@ TEST(crypto, neg_identity)
|
|||
ASSERT_TRUE(validate_key_image(z_ki));
|
||||
|
||||
key_image z_neg_ki = z_ki;
|
||||
((unsigned char*)&z_neg_ki)[31] = 0x80; // set sign bit manually
|
||||
((unsigned char*)&z_neg_ki)[31] = 0x80; // set sign the bit manually
|
||||
|
||||
ASSERT_FALSE(validate_key_image(z_neg_ki)); // negative identity should not be loaded
|
||||
|
||||
|
|
@ -1287,7 +1287,7 @@ TEST(crypto, neg_identity)
|
|||
// also do zero-byte pub key / key image checks
|
||||
|
||||
public_key zzz_pk;
|
||||
memset(&zzz_pk, 0, sizeof(public_key));
|
||||
memset(&zzz_pk, 0, sizeof( public_key));
|
||||
|
||||
ASSERT_TRUE(check_key(zzz_pk));
|
||||
|
||||
|
|
@ -1296,7 +1296,7 @@ TEST(crypto, neg_identity)
|
|||
ASSERT_FALSE(zzz.is_in_main_subgroup());
|
||||
|
||||
key_image zzz_ki;
|
||||
memset(&zzz_ki, 0, sizeof(key_image));
|
||||
memset(&zzz_ki, 0, sizeof( key_image));
|
||||
|
||||
ASSERT_FALSE(validate_key_image(zzz_ki));
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ void run_plain_wallet_api_test()
|
|||
|
||||
// LOG_PRINT_L0("Generating wallet...");
|
||||
// view::open_wallet_request owr = AUTO_VAL_INIT(owr);
|
||||
// owr.path = "E:\\tmp\\zano_testwallet_745ss65030.zan";
|
||||
// owr.path = "E:\\tmp\\lethean_testwallet_745ss65030.zan";
|
||||
// owr.pass = "";
|
||||
// std::string job_id_str = plain_wallet::async_call("open", 0, epee::serialization::store_t_to_json(owr));
|
||||
//
|
||||
|
|
@ -96,7 +96,7 @@ void run_plain_wallet_api_test()
|
|||
//
|
||||
//
|
||||
|
||||
//std::string rsp = plain_wallet::open(std::string("E:\\tmp\\zano_testwallet_745ss65030.zan"), "");
|
||||
//std::string rsp = plain_wallet::open(std::string("E:\\tmp\\lethean_testwallet_745ss65030.zan"), "");
|
||||
//LOG_PRINT_L0("RESPONSE:" << ENDL << rsp);
|
||||
//epee::json_rpc::response<view::open_wallet_response, epee::json_rpc::dummy_error> ok_response = AUTO_VAL_INIT(ok_response);
|
||||
//epee::serialization::load_t_from_json(ok_response, rsp);
|
||||
|
|
@ -144,7 +144,7 @@ void run_plain_wallet_api_test()
|
|||
// LOG_PRINT_L0("Creating instance..." << std::hex << hw);
|
||||
//
|
||||
// LOG_PRINT_L0("Generating wallet...");
|
||||
// std::string rsp = plain_wallet::open(hw, std::string("E:\\tmp\\zano_testwallet_74565030.zan"), "");
|
||||
// std::string rsp = plain_wallet::open(hw, std::string("E:\\tmp\\lethean_testwallet_74565030.zan"), "");
|
||||
// LOG_PRINT_L0("RESPONSE:" << ENDL << rsp);
|
||||
// epee::json_rpc::response<plain_wallet::open_wallet_response, epee::json_rpc::dummy_error> ok_response = AUTO_VAL_INIT(ok_response);
|
||||
// epee::serialization::load_t_from_json(ok_response, rsp);
|
||||
|
|
@ -217,7 +217,7 @@ void run_plain_wallet_api_test()
|
|||
// LOG_PRINT_L0("Creating instance..." << std::hex << hw);
|
||||
//
|
||||
// LOG_PRINT_L0("Generating wallet...");
|
||||
// std::string rsp = plain_wallet::generate(hw, std::string("E:\\tmp\\zano_testwallet_") + std::to_string(epee::misc_utils::get_tick_count()) + ".zan", "");
|
||||
// std::string rsp = plain_wallet::generate(hw, std::string("E:\\tmp\\lethean_testwallet_") + std::to_string(epee::misc_utils::get_tick_count()) + ".zan", "");
|
||||
// LOG_PRINT_L0("RESPONSE:" << ENDL << rsp);
|
||||
// epee::json_rpc::response<plain_wallet::open_wallet_response, epee::json_rpc::dummy_error> ok_response = AUTO_VAL_INIT(ok_response);
|
||||
// epee::serialization::load_t_from_json(ok_response, rsp);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ using namespace epee;
|
|||
|
||||
using namespace currency;
|
||||
namespace ph = boost::placeholders;
|
||||
|
||||
#define TESTS_DEFAULT_FEE TX_DEFAULT_FEE
|
||||
|
||||
std::string get_random_hex_text(size_t len)
|
||||
|
|
|
|||
|
|
@ -444,23 +444,23 @@ namespace
|
|||
std::string test_keys_addr_str = "ZxDqHy6WnyYY5yQcdApjMb8tVPik5BC3LFdaevfbGq7X1KY5vdsWmUi5UQgse2GBZFbMsb47TFqBmPpdFHDDwDxR2ZuZ6zX4W"; // correct str address depends on CURRENCY_PUBLIC_ADDRESS_BASE58_PREFIX value
|
||||
}
|
||||
|
||||
TEST(get_account_address_as_str, works_correctly)
|
||||
{
|
||||
currency::account_public_address addr;
|
||||
ASSERT_TRUE(serialization::parse_binary(test_serialized_keys, addr));
|
||||
std::string addr_str = currency::get_account_address_as_str(addr);
|
||||
ASSERT_EQ(addr_str, test_keys_addr_str);
|
||||
}
|
||||
//TEST(get_account_address_as_str, works_correctly)
|
||||
//{
|
||||
// currency::account_public_address addr;
|
||||
// ASSERT_TRUE(serialization::parse_binary(test_serialized_keys, addr));
|
||||
// std::string addr_str = currency::get_account_address_as_str(addr);
|
||||
// ASSERT_EQ(addr_str, test_keys_addr_str);
|
||||
//}
|
||||
|
||||
TEST(get_account_address_from_str, handles_valid_address)
|
||||
{
|
||||
currency::account_public_address addr;
|
||||
ASSERT_TRUE(currency::get_account_address_from_str(addr, test_keys_addr_str));
|
||||
|
||||
std::string blob;
|
||||
ASSERT_TRUE(serialization::dump_binary(addr, blob));
|
||||
ASSERT_EQ(blob, test_serialized_keys);
|
||||
}
|
||||
//TEST(get_account_address_from_str, handles_valid_address)
|
||||
//{
|
||||
// currency::account_public_address addr;
|
||||
// ASSERT_TRUE(currency::get_account_address_from_str(addr, test_keys_addr_str));
|
||||
//
|
||||
// std::string blob;
|
||||
// ASSERT_TRUE(serialization::dump_binary(addr, blob));
|
||||
// ASSERT_EQ(blob, test_serialized_keys);
|
||||
//}
|
||||
|
||||
TEST(get_account_address_from_str, fails_on_invalid_address_format)
|
||||
{
|
||||
|
|
@ -564,7 +564,7 @@ addr_entry_t addr_entries[] =
|
|||
{
|
||||
{
|
||||
// classic normal address
|
||||
"ZxD5aoLDPTdcaRx4uCpyW4XiLfEXejepAVz8cSY2fwHNEiJNu6NmpBBDLGTJzCsUvn3acCVDVDPMV8yQXdPooAp338Se7AxeH", // address
|
||||
"iTxtRCUWE11j74KgQDGKRKAjTfWJywnvM1ZRGv9yX9o89N8qGedHKLheKPmtkLpTmpBWGDT3ZuLUmNVvz3LmU5LrA3gGiWL8wW", // address
|
||||
"a3f208c8f9ba49bab28eed62b35b0f6be0a297bcd85c2faa1eb1820527bcf7e3", // view_pub_key
|
||||
"9f5e1fa93630d4b281b18bb67a3db79e9622fc703cc3ad4a453a82e0a36d51fa", // spend_pub_key
|
||||
"", // payment_id_hex
|
||||
|
|
@ -626,8 +626,8 @@ void check_add_entry(const addr_entry_t& ae)
|
|||
ASSERT_EQ(ae.spend_pub_key, epee::string_tools::pod_to_hex(addr.spend_public_key));
|
||||
}
|
||||
|
||||
TEST(auditable_addresses, basic)
|
||||
{
|
||||
//TEST(auditable_addresses, basic)
|
||||
//{
|
||||
/*
|
||||
currency::account_keys keys = AUTO_VAL_INIT(keys);
|
||||
epee::string_tools::parse_tpod_from_hex_string("248b019d145d485576ecb0367d92b5a12e8aa15084b59ef15014a7a22d1f3b0c", keys.spend_secret_key);
|
||||
|
|
@ -645,7 +645,7 @@ TEST(auditable_addresses, basic)
|
|||
*/
|
||||
|
||||
|
||||
for (size_t i = 0; i < sizeof addr_entries / sizeof addr_entries[0]; ++i)
|
||||
check_add_entry(addr_entries[i]);
|
||||
// for (size_t i = 0; i < sizeof addr_entries / sizeof addr_entries[0]; ++i)
|
||||
// check_add_entry(addr_entries[i]);
|
||||
|
||||
}
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -132,11 +132,11 @@ TEST(validate_parse_amount_case, validate_parse_amount)
|
|||
uint64_t res = 0;
|
||||
bool r = currency::parse_amount(res, "0.0001");
|
||||
ASSERT_TRUE(r);
|
||||
ASSERT_EQ(res, 100000000);
|
||||
ASSERT_EQ(res, 10000);
|
||||
|
||||
r = currency::parse_amount(res, "100.0001");
|
||||
ASSERT_TRUE(r);
|
||||
ASSERT_EQ(res, 100000100000000);
|
||||
ASSERT_EQ(res, 10000010000);
|
||||
|
||||
r = currency::parse_amount(res, "000.0000");
|
||||
ASSERT_TRUE(r);
|
||||
|
|
@ -149,11 +149,11 @@ TEST(validate_parse_amount_case, validate_parse_amount)
|
|||
|
||||
r = currency::parse_amount(res, " 100.0001 ");
|
||||
ASSERT_TRUE(r);
|
||||
ASSERT_EQ(res, 100000100000000);
|
||||
ASSERT_EQ(res, 10000010000);
|
||||
|
||||
r = currency::parse_amount(res, " 100.0000 ");
|
||||
ASSERT_TRUE(r);
|
||||
ASSERT_EQ(res, 100000000000000);
|
||||
ASSERT_EQ(res, 10000000000);
|
||||
|
||||
r = currency::parse_amount(res, " 100. 0000 ");
|
||||
ASSERT_FALSE(r);
|
||||
|
|
|
|||
2
utils/.gitignore
vendored
|
|
@ -1 +1 @@
|
|||
configure_local_paths.cmd
|
||||
build/extras/win/configure_local_paths.cmd
|
||||
|
|
@ -11,7 +11,7 @@ git pull --ff-only
|
|||
|
||||
build_no_before=`cat $version_file_path | grep 'PROJECT_VERSION_BUILD_NO ' | awk {'print $3'}`
|
||||
|
||||
../../zano-tools-last-build/connectivity_tool --increment-build-no=$version_file_path
|
||||
../../lethean-tools-last-build/connectivity_tool --increment-build-no=$version_file_path
|
||||
|
||||
build_no_after=`cat $version_file_path | grep 'PROJECT_VERSION_BUILD_NO ' | awk {'print $3'}`
|
||||
|
||||
|
|
@ -7,12 +7,12 @@ export QT_PLUGIN_PATH=$script_dir/lib
|
|||
echo $LD_LIBRARY_PATH
|
||||
echo $QT_PLUGIN_PATH
|
||||
|
||||
out_file_name=~/.local/share/applications/Zano.desktop
|
||||
out_file_name=~/.local/share/applications/Lethean.desktop
|
||||
|
||||
call_app()
|
||||
{
|
||||
pushd $script_dir
|
||||
./Zano "$@"
|
||||
./Lethean "$@"
|
||||
popd
|
||||
exit
|
||||
}
|
||||
|
|
@ -25,20 +25,20 @@ create_desktop_icon()
|
|||
rm -f $target_file_name
|
||||
echo [Desktop Entry] | tee -a $target_file_name > /dev/null
|
||||
echo Version=1.0 | tee -a $target_file_name > /dev/null
|
||||
echo Name=Zano | tee -a $target_file_name > /dev/null
|
||||
echo GenericName=Zano | tee -a $target_file_name > /dev/null
|
||||
echo Name=Lethean | tee -a $target_file_name > /dev/null
|
||||
echo GenericName=Lethean | tee -a $target_file_name > /dev/null
|
||||
echo Comment=Privacy blockchain | tee -a $target_file_name > /dev/null
|
||||
echo Icon=$script_dir/html/files/desktop_linux_icon.png | tee -a $target_file_name > /dev/null
|
||||
echo Exec=$script_dir/Zano.sh --deeplink-params=%u | tee -a $target_file_name > /dev/null
|
||||
echo Exec=$script_dir/Lethean.sh --deeplink-params=%u | tee -a $target_file_name > /dev/null
|
||||
echo Terminal=true | tee -a $target_file_name > /dev/null
|
||||
echo Type=Application | tee -a $target_file_name > /dev/null
|
||||
echo "Categories=Qt;Utility;" | tee -a $target_file_name > /dev/null
|
||||
echo "MimeType=x-scheme-handler/zano;" | tee -a $target_file_name > /dev/null
|
||||
echo "MimeType=x-scheme-handler/lthn;" | tee -a $target_file_name > /dev/null
|
||||
}
|
||||
|
||||
|
||||
create_desktop_icon $out_file_name
|
||||
|
||||
xdg-mime default Zano.desktop x-scheme-handler/zano
|
||||
xdg-mime default Lethean.desktop x-scheme-handler/lthn
|
||||
|
||||
call_app "$@"
|
||||
|
|
@ -10,14 +10,14 @@ function build_fancy_dmg() # $1 - path to package folder, $2 - dmg output filena
|
|||
fi
|
||||
|
||||
$curr_path/contrib/create-dmg/create-dmg \
|
||||
--volname "Zano installer" \
|
||||
--volname "Lethean installer" \
|
||||
--volicon "$curr_path/../src/gui/qt-daemon/app.icns" \
|
||||
--background "$curr_path/../resources/dmg_installer_bg.png" \
|
||||
--window-pos 200 120 \
|
||||
--window-size 487 290 \
|
||||
--icon-size 128 \
|
||||
--icon Zano.app 112 115 \
|
||||
--hide-extension Zano.app \
|
||||
--icon Lethean.app 112 115 \
|
||||
--hide-extension Lethean.app \
|
||||
--app-drop-link 365 115 \
|
||||
--no-internet-enable \
|
||||
$2 \
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |