mirror of
https://github.com/monero-project/monero.git
synced 2025-12-06 04:41:29 -08:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69c488a479 | ||
|
|
4a65cc5c46 | ||
|
|
ac925ba17a | ||
|
|
c84b1ab275 | ||
|
|
e8da77b4f1 | ||
|
|
5a996bd75e | ||
|
|
e046c02ec3 | ||
|
|
8152ea9562 | ||
|
|
e225465fe1 | ||
|
|
32d5146689 | ||
|
|
d904ffbaca | ||
|
|
912ff6abeb | ||
|
|
cc2fc0bc3e | ||
|
|
c0f5047878 | ||
|
|
f98d9673eb | ||
|
|
98cdc84920 | ||
|
|
69b8aa5a26 | ||
|
|
2ca057402d |
@@ -53,7 +53,10 @@ endif
|
|||||||
host_arch=$(firstword $(subst -, ,$(canonical_host)))
|
host_arch=$(firstword $(subst -, ,$(canonical_host)))
|
||||||
host_vendor=$(word 2,$(subst -, ,$(canonical_host)))
|
host_vendor=$(word 2,$(subst -, ,$(canonical_host)))
|
||||||
full_host_os:=$(subst $(host_arch)-$(host_vendor)-,,$(canonical_host))
|
full_host_os:=$(subst $(host_arch)-$(host_vendor)-,,$(canonical_host))
|
||||||
|
host_os:=$(findstring android,$(full_host_os))
|
||||||
|
ifeq ($(host_os),)
|
||||||
host_os:=$(findstring linux,$(full_host_os))
|
host_os:=$(findstring linux,$(full_host_os))
|
||||||
|
endif
|
||||||
host_os+=$(findstring darwin,$(full_host_os))
|
host_os+=$(findstring darwin,$(full_host_os))
|
||||||
host_os+=$(findstring mingw32,$(full_host_os))
|
host_os+=$(findstring mingw32,$(full_host_os))
|
||||||
host_os:=$(strip $(host_os))
|
host_os:=$(strip $(host_os))
|
||||||
@@ -74,6 +77,9 @@ endif
|
|||||||
ifeq ($(host_os),darwin)
|
ifeq ($(host_os),darwin)
|
||||||
host_cmake=Darwin
|
host_cmake=Darwin
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(host_os),android)
|
||||||
|
host_cmake=Android
|
||||||
|
endif
|
||||||
|
|
||||||
AT_$(V):=
|
AT_$(V):=
|
||||||
AT_:=@
|
AT_:=@
|
||||||
|
|||||||
20
contrib/depends/hosts/android.mk
Normal file
20
contrib/depends/hosts/android.mk
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
ANDROID_API=21
|
||||||
|
|
||||||
|
ifeq ($(host_arch),arm)
|
||||||
|
host_toolchain=arm-linux-androideabi-
|
||||||
|
endif
|
||||||
|
|
||||||
|
android_CC=$(host_toolchain)clang
|
||||||
|
android_CXX=$(host_toolchain)clang++
|
||||||
|
|
||||||
|
android_CFLAGS=-pipe
|
||||||
|
android_CXXFLAGS=$(android_CFLAGS)
|
||||||
|
|
||||||
|
android_release_CFLAGS=-O2
|
||||||
|
android_release_CXXFLAGS=$(android_release_CFLAGS)
|
||||||
|
|
||||||
|
android_debug_CFLAGS=-g -O0
|
||||||
|
android_debug_CXXFLAGS=$(android_debug_CFLAGS)
|
||||||
|
|
||||||
|
android_native_toolchain=android_ndk
|
||||||
|
|
||||||
22
contrib/depends/packages/android_ndk.mk
Normal file
22
contrib/depends/packages/android_ndk.mk
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package=android_ndk
|
||||||
|
$(package)_version=17b
|
||||||
|
$(package)_download_path=https://dl.google.com/android/repository/
|
||||||
|
$(package)_file_name=android-ndk-r$($(package)_version)-linux-x86_64.zip
|
||||||
|
$(package)_sha256_hash=5dfbbdc2d3ba859fed90d0e978af87c71a91a5be1f6e1c40ba697503d48ccecd
|
||||||
|
|
||||||
|
define $(package)_set_vars
|
||||||
|
$(package)_config_opts_arm=--arch arm
|
||||||
|
$(package)_config_opts_aarch64=--arch arm64
|
||||||
|
endef
|
||||||
|
|
||||||
|
define $(package)_extract_cmds
|
||||||
|
echo $($(package)_sha256_hash) $($(1)_source_dir)/$($(package)_file_name) | sha256sum -c &&\
|
||||||
|
unzip -q $($(1)_source_dir)/$($(package)_file_name)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define $(package)_stage_cmds
|
||||||
|
android-ndk-r$($(package)_version)/build/tools/make_standalone_toolchain.py --api 21 \
|
||||||
|
--install-dir $(build_prefix) --stl=libc++ $($(package)_config_opts) &&\
|
||||||
|
mv $(build_prefix) $($(package)_staging_dir)/$(host_prefix)
|
||||||
|
endef
|
||||||
|
|
||||||
@@ -3,6 +3,7 @@ $(package)_version=1_64_0
|
|||||||
$(package)_download_path=https://dl.bintray.com/boostorg/release/1.64.0/source/
|
$(package)_download_path=https://dl.bintray.com/boostorg/release/1.64.0/source/
|
||||||
$(package)_file_name=$(package)_$($(package)_version).tar.bz2
|
$(package)_file_name=$(package)_$($(package)_version).tar.bz2
|
||||||
$(package)_sha256_hash=7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332
|
$(package)_sha256_hash=7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332
|
||||||
|
$(package)_dependencies=libiconv
|
||||||
|
|
||||||
define $(package)_set_vars
|
define $(package)_set_vars
|
||||||
$(package)_config_opts_release=variant=release
|
$(package)_config_opts_release=variant=release
|
||||||
@@ -10,6 +11,7 @@ $(package)_config_opts_debug=variant=debug
|
|||||||
$(package)_config_opts=--layout=tagged --build-type=complete --user-config=user-config.jam
|
$(package)_config_opts=--layout=tagged --build-type=complete --user-config=user-config.jam
|
||||||
$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1
|
$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1
|
||||||
$(package)_config_opts_linux=threadapi=pthread runtime-link=shared
|
$(package)_config_opts_linux=threadapi=pthread runtime-link=shared
|
||||||
|
$(package)_config_opts_android=threadapi=pthread runtime-link=static target-os=android
|
||||||
$(package)_config_opts_darwin=--toolset=darwin-4.2.1 runtime-link=shared
|
$(package)_config_opts_darwin=--toolset=darwin-4.2.1 runtime-link=shared
|
||||||
$(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static
|
$(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static
|
||||||
$(package)_config_opts_x86_64_mingw32=address-model=64
|
$(package)_config_opts_x86_64_mingw32=address-model=64
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ $(package)_config_opts_x86_64_linux=linux-x86_64
|
|||||||
$(package)_config_opts_i686_linux=linux-generic32
|
$(package)_config_opts_i686_linux=linux-generic32
|
||||||
$(package)_config_opts_arm_linux=linux-generic32
|
$(package)_config_opts_arm_linux=linux-generic32
|
||||||
$(package)_config_opts_aarch64_linux=linux-generic64
|
$(package)_config_opts_aarch64_linux=linux-generic64
|
||||||
|
$(package)_config_opts_arm_android=--static android-armv7 no-asm
|
||||||
|
$(package)_config_opts_aarch64_android=--static android no-asm
|
||||||
$(package)_config_opts_riscv64_linux=linux-generic64
|
$(package)_config_opts_riscv64_linux=linux-generic64
|
||||||
$(package)_config_opts_mipsel_linux=linux-generic32
|
$(package)_config_opts_mipsel_linux=linux-generic32
|
||||||
$(package)_config_opts_mips_linux=linux-generic32
|
$(package)_config_opts_mips_linux=linux-generic32
|
||||||
@@ -51,7 +53,8 @@ endef
|
|||||||
|
|
||||||
define $(package)_preprocess_cmds
|
define $(package)_preprocess_cmds
|
||||||
sed -i.old "/define DATE/d" util/mkbuildinf.pl && \
|
sed -i.old "/define DATE/d" util/mkbuildinf.pl && \
|
||||||
sed -i.old "s|engines apps test|engines|" Makefile.org
|
sed -i.old "s|engines apps test|engines|" Makefile.org && \
|
||||||
|
sed -i -e "s/-mandroid //" Configure
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define $(package)_config_cmds
|
define $(package)_config_cmds
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
packages:=boost openssl zeromq cppzmq expat ldns libiconv hidapi protobuf libusb
|
ifeq ($(host_os),android)
|
||||||
|
packages:=boost openssl zeromq libiconv
|
||||||
|
else
|
||||||
|
packages:=boost openssl zeromq expat ldns libiconv hidapi protobuf libusb
|
||||||
|
endif
|
||||||
|
|
||||||
native_packages := native_ccache native_protobuf
|
native_packages := native_ccache native_protobuf
|
||||||
|
|
||||||
|
android_native_packages = android_ndk
|
||||||
|
android_packages = ncurses readline sodium
|
||||||
|
|
||||||
darwin_native_packages = native_biplist native_ds_store native_mac_alias
|
darwin_native_packages = native_biplist native_ds_store native_mac_alias
|
||||||
darwin_packages = sodium-darwin ncurses readline
|
darwin_packages = sodium-darwin ncurses readline
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ $(package)_patches=fix-whitespace.patch
|
|||||||
define $(package)_set_vars
|
define $(package)_set_vars
|
||||||
$(package)_config_opts=--enable-static --disable-shared
|
$(package)_config_opts=--enable-static --disable-shared
|
||||||
$(package)_config_opts+=--prefix=$(host_prefix)
|
$(package)_config_opts+=--prefix=$(host_prefix)
|
||||||
|
$(package)_config_opts_android=RANLIB=$($(package)_ranlib) AR=$($(package)_ar) CC=$($(package)_cc)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define $(package)_config_cmds
|
define $(package)_config_cmds
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ $(package)_version=4.1.7
|
|||||||
$(package)_download_path=https://github.com/zeromq/zeromq4-1/releases/download/v$($(package)_version)/
|
$(package)_download_path=https://github.com/zeromq/zeromq4-1/releases/download/v$($(package)_version)/
|
||||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||||
$(package)_sha256_hash=31c383cfcd3be1dc8a66e448c403029e793687e70473b89c4cc0bd626e7da299
|
$(package)_sha256_hash=31c383cfcd3be1dc8a66e448c403029e793687e70473b89c4cc0bd626e7da299
|
||||||
$(package)_patches=9114d3957725acd34aa8b8d011585812f3369411.patch 9e6745c12e0b100cd38acecc16ce7db02905e27c.patch
|
$(package)_patches=9114d3957725acd34aa8b8d011585812f3369411.patch 9e6745c12e0b100cd38acecc16ce7db02905e27c.patch ffe62d3398d5e0191f554f61049aa7ec9fc892ae.patch
|
||||||
|
|
||||||
define $(package)_set_vars
|
define $(package)_set_vars
|
||||||
$(package)_config_opts=--without-documentation --disable-shared --without-libsodium --disable-curve
|
$(package)_config_opts=--without-documentation --disable-shared --without-libsodium --disable-curve
|
||||||
@@ -14,6 +14,7 @@ endef
|
|||||||
define $(package)_preprocess_cmds
|
define $(package)_preprocess_cmds
|
||||||
patch -p1 < $($(package)_patch_dir)/9114d3957725acd34aa8b8d011585812f3369411.patch && \
|
patch -p1 < $($(package)_patch_dir)/9114d3957725acd34aa8b8d011585812f3369411.patch && \
|
||||||
patch -p1 < $($(package)_patch_dir)/9e6745c12e0b100cd38acecc16ce7db02905e27c.patch && \
|
patch -p1 < $($(package)_patch_dir)/9e6745c12e0b100cd38acecc16ce7db02905e27c.patch && \
|
||||||
|
patch -p1 < $($(package)_patch_dir)/ffe62d3398d5e0191f554f61049aa7ec9fc892ae.patch && \
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
From ffe62d3398d5e0191f554f61049aa7ec9fc892ae Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gregory Lemercier <greglemercier@free.fr>
|
||||||
|
Date: Sun, 7 Oct 2018 18:06:54 +0200
|
||||||
|
Subject: [PATCH] Fix build on arm64 architectures with some strict compilers
|
||||||
|
|
||||||
|
This patch fixes an issue that occurs on 64-bit architetures under
|
||||||
|
strict compiler rules. The code initially checked that the received
|
||||||
|
size stored in 'uint64_t' was not bigger than the max value of a
|
||||||
|
'size_t' variable, which is legitimate on 32-bit architectures where
|
||||||
|
'size_t' variables are stored on 32 bits. On 64-bit architectures,
|
||||||
|
this test no longer makes sense since 'uint64_t' and 'size_t' types
|
||||||
|
have the same size. The issue is fixed by ignoring this portion
|
||||||
|
of code when built for arm64.
|
||||||
|
---
|
||||||
|
src/v1_decoder.cpp | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/v1_decoder.cpp b/src/v1_decoder.cpp
|
||||||
|
index b002dc9d..2c8c97a7 100644
|
||||||
|
--- a/src/v1_decoder.cpp
|
||||||
|
+++ b/src/v1_decoder.cpp
|
||||||
|
@@ -114,11 +114,13 @@ int zmq::v1_decoder_t::eight_byte_size_ready ()
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifndef __aarch64__
|
||||||
|
// Message size must fit within range of size_t data type.
|
||||||
|
if (payload_length - 1 > std::numeric_limits <size_t>::max ()) {
|
||||||
|
errno = EMSGSIZE;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
const size_t msg_size = static_cast <size_t> (payload_length - 1);
|
||||||
|
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# Set the system name, either Darwin, Linux, or Windows
|
# Set the system name to one of Android, Darwin, Linux, or Windows
|
||||||
SET(CMAKE_SYSTEM_NAME @depends@)
|
SET(CMAKE_SYSTEM_NAME @depends@)
|
||||||
SET(CMAKE_BUILD_TYPE @release_type@)
|
SET(CMAKE_BUILD_TYPE @release_type@)
|
||||||
|
|
||||||
@@ -18,13 +18,14 @@ SET(CMAKE_FIND_ROOT_PATH @prefix@ /usr)
|
|||||||
|
|
||||||
SET(ENV{PKG_CONFIG_PATH} @prefix@/lib/pkgconfig)
|
SET(ENV{PKG_CONFIG_PATH} @prefix@/lib/pkgconfig)
|
||||||
|
|
||||||
SET(LRELEASE_PATH @prefix@/native/bin CACHE FILEPATH "path to lrelease" FORCE)
|
|
||||||
|
|
||||||
SET(Readline_ROOT_DIR @prefix@)
|
SET(Readline_ROOT_DIR @prefix@)
|
||||||
SET(Readline_INCLUDE_DIR @prefix@/include)
|
SET(Readline_INCLUDE_DIR @prefix@/include)
|
||||||
SET(Readline_LIBRARY @prefix@/lib/libreadline.a)
|
SET(Readline_LIBRARY @prefix@/lib/libreadline.a)
|
||||||
SET(Terminfo_LIBRARY @prefix@/lib/libtinfo.a)
|
SET(Terminfo_LIBRARY @prefix@/lib/libtinfo.a)
|
||||||
|
|
||||||
|
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||||
|
SET(LRELEASE_PATH @prefix@/native/bin CACHE FILEPATH "path to lrelease" FORCE)
|
||||||
|
|
||||||
SET(LIBUNWIND_INCLUDE_DIR @prefix@/include)
|
SET(LIBUNWIND_INCLUDE_DIR @prefix@/include)
|
||||||
SET(LIBUNWIND_LIBRARIES @prefix@/lib/libunwind.a)
|
SET(LIBUNWIND_LIBRARIES @prefix@/lib/libunwind.a)
|
||||||
SET(LIBUNWIND_LIBRARY_DIRS @prefix@/lib)
|
SET(LIBUNWIND_LIBRARY_DIRS @prefix@/lib)
|
||||||
@@ -37,6 +38,7 @@ SET(Protobuf_PROTOC_EXECUTABLE @prefix@/native/bin/protoc CACHE FILEPATH "Path t
|
|||||||
SET(Protobuf_INCLUDE_DIR @prefix@/include CACHE PATH "Protobuf include dir")
|
SET(Protobuf_INCLUDE_DIR @prefix@/include CACHE PATH "Protobuf include dir")
|
||||||
SET(Protobuf_INCLUDE_DIRS @prefix@/include CACHE PATH "Protobuf include dir")
|
SET(Protobuf_INCLUDE_DIRS @prefix@/include CACHE PATH "Protobuf include dir")
|
||||||
SET(Protobuf_LIBRARY @prefix@/lib/libprotobuf.a CACHE FILEPATH "Protobuf library")
|
SET(Protobuf_LIBRARY @prefix@/lib/libprotobuf.a CACHE FILEPATH "Protobuf library")
|
||||||
|
endif()
|
||||||
|
|
||||||
SET(ZMQ_INCLUDE_PATH @prefix@/include)
|
SET(ZMQ_INCLUDE_PATH @prefix@/include)
|
||||||
SET(ZMQ_LIB @prefix@/lib/libzmq.a)
|
SET(ZMQ_LIB @prefix@/lib/libzmq.a)
|
||||||
@@ -78,6 +80,22 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|||||||
SET(CMAKE_OSX_ARCHITECTURES "x86_64")
|
SET(CMAKE_OSX_ARCHITECTURES "x86_64")
|
||||||
SET(LLVM_ENABLE_PIC OFF)
|
SET(LLVM_ENABLE_PIC OFF)
|
||||||
SET(LLVM_ENABLE_PIE OFF)
|
SET(LLVM_ENABLE_PIE OFF)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||||
|
SET(ANDROID TRUE)
|
||||||
|
if(ARCHITECTURE STREQUAL "arm")
|
||||||
|
SET(CMAKE_ANDROID_ARCH_ABI "armeabi-v7a")
|
||||||
|
SET(CMAKE_SYSTEM_PROCESSOR "armv7-a")
|
||||||
|
SET(CMAKE_ANDROID_ARM_MODE ON)
|
||||||
|
SET(CMAKE_C_COMPILER_TARGET arm-linux-androideabi)
|
||||||
|
SET(CMAKE_CXX_COMPILER_TARGET arm-linux-androideabi)
|
||||||
|
SET(_CMAKE_TOOLCHAIN_PREFIX arm-linux-androideabi-)
|
||||||
|
elseif(ARCHITECTURE STREQUAL "aarch64")
|
||||||
|
SET(CMAKE_ANDROID_ARCH_ABI "arm64-v8a")
|
||||||
|
SET(CMAKE_SYSTEM_PROCESSOR "aarch64")
|
||||||
|
endif()
|
||||||
|
SET(CMAKE_ANDROID_STANDALONE_TOOLCHAIN @prefix@/native)
|
||||||
|
SET(CMAKE_C_COMPILER "${_CMAKE_TOOLCHAIN_PREFIX}clang")
|
||||||
|
SET(CMAKE_CXX_COMPILER "${_CMAKE_TOOLCHAIN_PREFIX}clang++")
|
||||||
else()
|
else()
|
||||||
SET(CMAKE_C_COMPILER @CC@)
|
SET(CMAKE_C_COMPILER @CC@)
|
||||||
SET(CMAKE_CXX_COMPILER @CXX@)
|
SET(CMAKE_CXX_COMPILER @CXX@)
|
||||||
@@ -89,13 +107,21 @@ if(ARCHITECTURE STREQUAL "arm")
|
|||||||
set(ARM_ID "armv7-a")
|
set(ARM_ID "armv7-a")
|
||||||
set(BUILD_64 OFF)
|
set(BUILD_64 OFF)
|
||||||
set(CMAKE_BUILD_TYPE release)
|
set(CMAKE_BUILD_TYPE release)
|
||||||
set(BUILD_TAG "linux-armv7")
|
if(ANDROID)
|
||||||
|
set(BUILD_TAG "android-armv7")
|
||||||
|
else()
|
||||||
|
set(BUILD_TAG "linux-armv7")
|
||||||
|
endif()
|
||||||
set(ARM7)
|
set(ARM7)
|
||||||
elseif(ARCHITECTURE STREQUAL "aarch64")
|
elseif(ARCHITECTURE STREQUAL "aarch64")
|
||||||
set(ARCH "armv8-a")
|
set(ARCH "armv8-a")
|
||||||
set(ARM ON)
|
set(ARM ON)
|
||||||
set(ARM_ID "armv8-a")
|
set(ARM_ID "armv8-a")
|
||||||
set(BUILD_TAG "linux-armv8")
|
if(ANDROID)
|
||||||
|
set(BUILD_TAG "android-armv8")
|
||||||
|
else()
|
||||||
|
set(BUILD_TAG "linux-armv8")
|
||||||
|
endif()
|
||||||
set(BUILD_64 ON)
|
set(BUILD_64 ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
#include <random>
|
||||||
#include <boost/timer/timer.hpp>
|
#include <boost/timer/timer.hpp>
|
||||||
#include <boost/uuid/uuid.hpp>
|
#include <boost/uuid/uuid.hpp>
|
||||||
#include <boost/uuid/random_generator.hpp>
|
#include <boost/uuid/random_generator.hpp>
|
||||||
@@ -230,7 +231,7 @@ namespace math_helper
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
template<uint64_t scale, int default_interval, bool start_immediate = true>
|
template<typename get_interval, bool start_immediate = true>
|
||||||
class once_a_time
|
class once_a_time
|
||||||
{
|
{
|
||||||
uint64_t get_time() const
|
uint64_t get_time() const
|
||||||
@@ -251,12 +252,18 @@ namespace math_helper
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_next_interval()
|
||||||
|
{
|
||||||
|
m_interval = get_interval()();
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
once_a_time():m_interval(default_interval * scale)
|
once_a_time()
|
||||||
{
|
{
|
||||||
m_last_worked_time = 0;
|
m_last_worked_time = 0;
|
||||||
if(!start_immediate)
|
if(!start_immediate)
|
||||||
m_last_worked_time = get_time();
|
m_last_worked_time = get_time();
|
||||||
|
set_next_interval();
|
||||||
}
|
}
|
||||||
|
|
||||||
void trigger()
|
void trigger()
|
||||||
@@ -273,6 +280,7 @@ namespace math_helper
|
|||||||
{
|
{
|
||||||
bool res = functr();
|
bool res = functr();
|
||||||
m_last_worked_time = get_time();
|
m_last_worked_time = get_time();
|
||||||
|
set_next_interval();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -283,9 +291,13 @@ namespace math_helper
|
|||||||
uint64_t m_interval;
|
uint64_t m_interval;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<uint64_t N> struct get_constant_interval { public: uint64_t operator()() const { return N; } };
|
||||||
|
|
||||||
template<int default_interval, bool start_immediate = true>
|
template<int default_interval, bool start_immediate = true>
|
||||||
class once_a_time_seconds: public once_a_time<1000000, default_interval, start_immediate> {};
|
class once_a_time_seconds: public once_a_time<get_constant_interval<default_interval * (uint64_t)1000000>, start_immediate> {};
|
||||||
template<int default_interval, bool start_immediate = true>
|
template<int default_interval, bool start_immediate = true>
|
||||||
class once_a_time_milliseconds: public once_a_time<1000, default_interval, start_immediate> {};
|
class once_a_time_milliseconds: public once_a_time<get_constant_interval<default_interval * (uint64_t)1000>, start_immediate> {};
|
||||||
|
template<typename get_interval, bool start_immediate = true>
|
||||||
|
class once_a_time_seconds_range: public once_a_time<get_interval, start_immediate> {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -226,3 +226,19 @@ To get all build options run:
|
|||||||
./gitian-build.py --help
|
./gitian-build.py --help
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Doing Successive Builds
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
If you need to do multiple iterations (while developing/testing) you can use the
|
||||||
|
`--rebuild` option instead of `--build` on subsequent iterations. This skips the
|
||||||
|
initial check for the freshness of the depends tools. In particular, doing this
|
||||||
|
check all the time prevents rebuilding when you have no network access.
|
||||||
|
|
||||||
|
|
||||||
|
Local-Only Builds
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
If you need to run builds while disconnected from the internet, make sure you have
|
||||||
|
local up-to-date repos in advance. Then specify your local repo using the `--url`
|
||||||
|
option when building. This will avoid attempts to git pull across a network.
|
||||||
|
|
||||||
|
|||||||
138
contrib/gitian/gitian-android.yml
Normal file
138
contrib/gitian/gitian-android.yml
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
---
|
||||||
|
name: "monero-android-0.15"
|
||||||
|
enable_cache: true
|
||||||
|
suites:
|
||||||
|
- "bionic"
|
||||||
|
architectures:
|
||||||
|
- "amd64"
|
||||||
|
packages:
|
||||||
|
- "curl"
|
||||||
|
- "gperf"
|
||||||
|
- "gcc-7"
|
||||||
|
- "g++-7"
|
||||||
|
- "gcc"
|
||||||
|
- "g++"
|
||||||
|
- "binutils-gold"
|
||||||
|
- "git"
|
||||||
|
- "pkg-config"
|
||||||
|
- "build-essential"
|
||||||
|
- "autoconf"
|
||||||
|
- "libtool"
|
||||||
|
- "automake"
|
||||||
|
- "faketime"
|
||||||
|
- "bsdmainutils"
|
||||||
|
- "ca-certificates"
|
||||||
|
- "python"
|
||||||
|
- "cmake"
|
||||||
|
- "ccache"
|
||||||
|
- "protobuf-compiler"
|
||||||
|
- "libdbus-1-dev"
|
||||||
|
- "libharfbuzz-dev"
|
||||||
|
- "libprotobuf-dev"
|
||||||
|
- "python3-zmq"
|
||||||
|
- "unzip"
|
||||||
|
remotes:
|
||||||
|
- "url": "https://github.com/monero-project/monero.git"
|
||||||
|
"dir": "monero"
|
||||||
|
files: []
|
||||||
|
script: |
|
||||||
|
|
||||||
|
WRAP_DIR=$HOME/wrapped
|
||||||
|
HOSTS="arm-linux-android aarch64-linux-android"
|
||||||
|
FAKETIME_HOST_PROGS="clang clang++ ar ranlib nm"
|
||||||
|
FAKETIME_PROGS="date"
|
||||||
|
HOST_CFLAGS="-O2 -g"
|
||||||
|
HOST_CXXFLAGS="-O2 -g"
|
||||||
|
HOST_LDFLAGS=-static-libstdc++
|
||||||
|
|
||||||
|
export GZIP="-9n"
|
||||||
|
export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME""
|
||||||
|
export TZ="UTC"
|
||||||
|
export BUILD_DIR=`pwd`
|
||||||
|
mkdir -p ${WRAP_DIR}
|
||||||
|
if test -n "$GBUILD_CACHE_ENABLED"; then
|
||||||
|
export SOURCES_PATH=${GBUILD_COMMON_CACHE}
|
||||||
|
export BASE_CACHE=${GBUILD_PACKAGE_CACHE}
|
||||||
|
mkdir -p ${BASE_CACHE} ${SOURCES_PATH}
|
||||||
|
fi
|
||||||
|
|
||||||
|
export ZERO_AR_DATE=1
|
||||||
|
|
||||||
|
function create_global_faketime_wrappers {
|
||||||
|
for prog in ${FAKETIME_PROGS}; do
|
||||||
|
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog}
|
||||||
|
echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
|
||||||
|
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog}
|
||||||
|
echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog}
|
||||||
|
echo "\$REAL \$@" >> $WRAP_DIR/${prog}
|
||||||
|
chmod +x ${WRAP_DIR}/${prog}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_per-host_faketime_wrappers {
|
||||||
|
for i in $HOSTS; do
|
||||||
|
ABI=$i
|
||||||
|
if expr $i : arm- > /dev/null
|
||||||
|
then
|
||||||
|
ABI=$i"eabi"
|
||||||
|
fi
|
||||||
|
NDKDIR="${BUILD_DIR}/monero/contrib/depends/$i/native/bin"
|
||||||
|
for prog in ${FAKETIME_HOST_PROGS}; do
|
||||||
|
WRAPPER=${WRAP_DIR}/${ABI}-${prog}
|
||||||
|
echo '#!/usr/bin/env bash' > ${WRAPPER}
|
||||||
|
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAPPER}
|
||||||
|
echo "export FAKETIME=\"$1\"" >> ${WRAPPER}
|
||||||
|
echo "$NDKDIR/${ABI}-$prog \$@" >> ${WRAPPER}
|
||||||
|
chmod +x ${WRAPPER}
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Faketime for depends so intermediate results are comparable
|
||||||
|
DUMMYTIME="2000-01-01 12:00:00"
|
||||||
|
export PATH_orig=${PATH}
|
||||||
|
create_global_faketime_wrappers "$DUMMYTIME"
|
||||||
|
create_per-host_faketime_wrappers "$DUMMYTIME"
|
||||||
|
export PATH=${WRAP_DIR}:${PATH}
|
||||||
|
|
||||||
|
# gcc 7+ honors SOURCE_DATE_EPOCH, no faketime needed
|
||||||
|
export SOURCE_DATE_EPOCH=`date -d "$DUMMYTIME" +%s`
|
||||||
|
|
||||||
|
git config --global core.abbrev 9
|
||||||
|
cd monero
|
||||||
|
# Set the version string that gets added to the tar archive name
|
||||||
|
version="`git describe`"
|
||||||
|
if [[ $version == *"-"*"-"* ]]; then
|
||||||
|
version="`git rev-parse --short=9 HEAD`"
|
||||||
|
version="`echo $version | head -c 9`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
BASEPREFIX=`pwd`/contrib/depends
|
||||||
|
# Build dependencies for each host
|
||||||
|
for i in $HOSTS; do
|
||||||
|
make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Faketime for binaries
|
||||||
|
export PATH=${PATH_orig}
|
||||||
|
create_global_faketime_wrappers "${REFERENCE_DATETIME}"
|
||||||
|
create_per-host_faketime_wrappers "${REFERENCE_DATETIME}"
|
||||||
|
export PATH=${WRAP_DIR}:${PATH}
|
||||||
|
|
||||||
|
ORIGPATH="$PATH"
|
||||||
|
# Build in a new dir for each host
|
||||||
|
for i in ${HOSTS}; do
|
||||||
|
export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
|
||||||
|
mkdir build && cd build
|
||||||
|
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DCMAKE_BUILD_TYPE=Release
|
||||||
|
make ${MAKEOPTS}
|
||||||
|
chmod 755 bin/*
|
||||||
|
cp ../LICENSE bin
|
||||||
|
chmod 644 bin/LICENSE
|
||||||
|
DISTNAME=monero-${i}-${version}
|
||||||
|
mv bin ${DISTNAME}
|
||||||
|
find ${DISTNAME}/ | sort | tar --no-recursion --owner=0 --group=0 -c -T - | bzip2 -9 > ${OUTDIR}/${DISTNAME}.tar.bz2
|
||||||
|
cd ..
|
||||||
|
rm -rf build
|
||||||
|
done
|
||||||
|
|
||||||
@@ -46,19 +46,11 @@ def setup():
|
|||||||
print('Reboot is required')
|
print('Reboot is required')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
def build():
|
def rebuild():
|
||||||
global args, workdir
|
global args, workdir
|
||||||
|
|
||||||
os.makedirs('out/' + args.version, exist_ok=True)
|
|
||||||
print('\nBuilding Dependencies\n')
|
print('\nBuilding Dependencies\n')
|
||||||
os.chdir('builder')
|
os.makedirs('../out/' + args.version, exist_ok=True)
|
||||||
os.makedirs('inputs', exist_ok=True)
|
|
||||||
|
|
||||||
subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://downloads.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz'])
|
|
||||||
subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://bitcoincore.org/cfields/osslsigncode-Backports-to-1.7.1.patch'])
|
|
||||||
subprocess.check_output(["echo 'a8c4e9cafba922f89de0df1f2152e7be286aba73f78505169bc351a7938dd911 inputs/osslsigncode-Backports-to-1.7.1.patch' | sha256sum -c"], shell=True)
|
|
||||||
subprocess.check_output(["echo 'f9a8cdb38b9c309326764ebc937cba1523a3a751a7ab05df3ecc99d18ae466c9 inputs/osslsigncode-1.7.1.tar.gz' | sha256sum -c"], shell=True)
|
|
||||||
subprocess.check_call(['make', '-C', 'inputs/monero/contrib/depends', 'download', 'SOURCES_PATH=' + os.getcwd() + '/cache/common'])
|
|
||||||
|
|
||||||
if args.linux:
|
if args.linux:
|
||||||
print('\nCompiling ' + args.version + ' Linux')
|
print('\nCompiling ' + args.version + ' Linux')
|
||||||
@@ -66,6 +58,12 @@ def build():
|
|||||||
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-linux', '--destination', '../sigs/', 'inputs/monero/contrib/gitian/gitian-linux.yml'])
|
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-linux', '--destination', '../sigs/', 'inputs/monero/contrib/gitian/gitian-linux.yml'])
|
||||||
subprocess.check_call('mv build/out/monero-*.tar.bz2 ../out/'+args.version, shell=True)
|
subprocess.check_call('mv build/out/monero-*.tar.bz2 ../out/'+args.version, shell=True)
|
||||||
|
|
||||||
|
if args.android:
|
||||||
|
print('\nCompiling ' + args.version + ' Android')
|
||||||
|
subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, 'inputs/monero/contrib/gitian/gitian-android.yml'])
|
||||||
|
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-android', '--destination', '../sigs/', 'inputs/monero/contrib/gitian/gitian-android.yml'])
|
||||||
|
subprocess.check_call('mv build/out/monero-*.tar.bz2 ../out/'+args.version, shell=True)
|
||||||
|
|
||||||
if args.windows:
|
if args.windows:
|
||||||
print('\nCompiling ' + args.version + ' Windows')
|
print('\nCompiling ' + args.version + ' Windows')
|
||||||
subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, 'inputs/monero/contrib/gitian/gitian-win.yml'])
|
subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, 'inputs/monero/contrib/gitian/gitian-win.yml'])
|
||||||
@@ -84,17 +82,37 @@ def build():
|
|||||||
print('\nCommitting '+args.version+' Unsigned Sigs\n')
|
print('\nCommitting '+args.version+' Unsigned Sigs\n')
|
||||||
os.chdir('sigs')
|
os.chdir('sigs')
|
||||||
subprocess.check_call(['git', 'add', args.version+'-linux/'+args.signer])
|
subprocess.check_call(['git', 'add', args.version+'-linux/'+args.signer])
|
||||||
|
subprocess.check_call(['git', 'add', args.version+'-android/'+args.signer])
|
||||||
subprocess.check_call(['git', 'add', args.version+'-win/'+args.signer])
|
subprocess.check_call(['git', 'add', args.version+'-win/'+args.signer])
|
||||||
subprocess.check_call(['git', 'add', args.version+'-osx/'+args.signer])
|
subprocess.check_call(['git', 'add', args.version+'-osx/'+args.signer])
|
||||||
subprocess.check_call(['git', 'commit', '-m', 'Add '+args.version+' unsigned sigs for '+args.signer])
|
subprocess.check_call(['git', 'commit', '-m', 'Add '+args.version+' unsigned sigs for '+args.signer])
|
||||||
os.chdir(workdir)
|
os.chdir(workdir)
|
||||||
|
|
||||||
|
|
||||||
|
def build():
|
||||||
|
global args, workdir
|
||||||
|
|
||||||
|
print('\nChecking Depends Freshness\n')
|
||||||
|
os.chdir('builder')
|
||||||
|
os.makedirs('inputs', exist_ok=True)
|
||||||
|
|
||||||
|
subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://downloads.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz'])
|
||||||
|
subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://bitcoincore.org/cfields/osslsigncode-Backports-to-1.7.1.patch'])
|
||||||
|
subprocess.check_output(["echo 'a8c4e9cafba922f89de0df1f2152e7be286aba73f78505169bc351a7938dd911 inputs/osslsigncode-Backports-to-1.7.1.patch' | sha256sum -c"], shell=True)
|
||||||
|
subprocess.check_output(["echo 'f9a8cdb38b9c309326764ebc937cba1523a3a751a7ab05df3ecc99d18ae466c9 inputs/osslsigncode-1.7.1.tar.gz' | sha256sum -c"], shell=True)
|
||||||
|
subprocess.check_call(['make', '-C', 'inputs/monero/contrib/depends', 'download', 'SOURCES_PATH=' + os.getcwd() + '/cache/common'])
|
||||||
|
|
||||||
|
rebuild()
|
||||||
|
|
||||||
|
|
||||||
def verify():
|
def verify():
|
||||||
global args, workdir
|
global args, workdir
|
||||||
os.chdir('builder')
|
os.chdir('builder')
|
||||||
|
|
||||||
print('\nVerifying v'+args.version+' Linux\n')
|
print('\nVerifying v'+args.version+' Linux\n')
|
||||||
subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-linux', 'inputs/monero/contrib/gitian/gitian-linux.yml'])
|
subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-linux', 'inputs/monero/contrib/gitian/gitian-linux.yml'])
|
||||||
|
print('\nVerifying v'+args.version+' Android\n')
|
||||||
|
subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-android', 'inputs/monero/contrib/gitian/gitian-android.yml'])
|
||||||
print('\nVerifying v'+args.version+' Windows\n')
|
print('\nVerifying v'+args.version+' Windows\n')
|
||||||
subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-win', 'inputs/monero/contrib/gitian/gitian-win.yml'])
|
subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-win', 'inputs/monero/contrib/gitian/gitian-win.yml'])
|
||||||
print('\nVerifying v'+args.version+' MacOS\n')
|
print('\nVerifying v'+args.version+' MacOS\n')
|
||||||
@@ -111,7 +129,9 @@ def main():
|
|||||||
parser.add_argument('-v', '--verify', action='store_true', dest='verify', help='Verify the Gitian build')
|
parser.add_argument('-v', '--verify', action='store_true', dest='verify', help='Verify the Gitian build')
|
||||||
parser.add_argument('-b', '--build', action='store_true', dest='build', help='Do a Gitian build')
|
parser.add_argument('-b', '--build', action='store_true', dest='build', help='Do a Gitian build')
|
||||||
parser.add_argument('-B', '--buildsign', action='store_true', dest='buildsign', help='Build both signed and unsigned binaries')
|
parser.add_argument('-B', '--buildsign', action='store_true', dest='buildsign', help='Build both signed and unsigned binaries')
|
||||||
parser.add_argument('-o', '--os', dest='os', default='lwm', help='Specify which Operating Systems the build is for. Default is %(default)s. l for Linux, w for Windows, m for MacOS')
|
parser.add_argument('-o', '--os', dest='os', default='lawm', help='Specify which Operating Systems the build is for. Default is %(default)s. l for Linux, a for Android, w for Windows, m for MacOS')
|
||||||
|
parser.add_argument('-r', '--rebuild', action='store_true', dest='rebuild', help='Redo a Gitian build')
|
||||||
|
parser.add_argument('-R', '--rebuildsign', action='store_true', dest='rebuildsign', help='Redo and sign a Gitian build')
|
||||||
parser.add_argument('-j', '--jobs', dest='jobs', default='2', help='Number of processes to use. Default %(default)s')
|
parser.add_argument('-j', '--jobs', dest='jobs', default='2', help='Number of processes to use. Default %(default)s')
|
||||||
parser.add_argument('-m', '--memory', dest='memory', default='2000', help='Memory to allocate in MiB. Default %(default)s')
|
parser.add_argument('-m', '--memory', dest='memory', default='2000', help='Memory to allocate in MiB. Default %(default)s')
|
||||||
parser.add_argument('-k', '--kvm', action='store_true', dest='kvm', help='Use KVM instead of LXC')
|
parser.add_argument('-k', '--kvm', action='store_true', dest='kvm', help='Use KVM instead of LXC')
|
||||||
@@ -127,6 +147,7 @@ def main():
|
|||||||
workdir = os.getcwd()
|
workdir = os.getcwd()
|
||||||
|
|
||||||
args.linux = 'l' in args.os
|
args.linux = 'l' in args.os
|
||||||
|
args.android = 'a' in args.os
|
||||||
args.windows = 'w' in args.os
|
args.windows = 'w' in args.os
|
||||||
args.macos = 'm' in args.os
|
args.macos = 'm' in args.os
|
||||||
|
|
||||||
@@ -136,6 +157,10 @@ def main():
|
|||||||
args.build = True
|
args.build = True
|
||||||
args.sign = True
|
args.sign = True
|
||||||
|
|
||||||
|
if args.rebuildsign:
|
||||||
|
args.rebuild = True
|
||||||
|
args.sign = True
|
||||||
|
|
||||||
if args.kvm and args.docker:
|
if args.kvm and args.docker:
|
||||||
raise Exception('Error: cannot have both kvm and docker')
|
raise Exception('Error: cannot have both kvm and docker')
|
||||||
|
|
||||||
@@ -152,9 +177,10 @@ def main():
|
|||||||
os.environ['LXC_GUEST_IP'] = '10.0.3.5'
|
os.environ['LXC_GUEST_IP'] = '10.0.3.5'
|
||||||
|
|
||||||
# Disable MacOS build if no SDK found
|
# Disable MacOS build if no SDK found
|
||||||
if args.build and args.macos and not os.path.isfile('builder/inputs/MacOSX10.11.sdk.tar.gz'):
|
if args.macos and not os.path.isfile('builder/inputs/MacOSX10.11.sdk.tar.gz'):
|
||||||
print('Cannot build for MacOS, SDK does not exist. Will build for other OSes')
|
|
||||||
args.macos = False
|
args.macos = False
|
||||||
|
if args.build:
|
||||||
|
print('Cannot build for MacOS, SDK does not exist. Will build for other OSes')
|
||||||
|
|
||||||
script_name = os.path.basename(sys.argv[0])
|
script_name = os.path.basename(sys.argv[0])
|
||||||
# Signer and version shouldn't be empty
|
# Signer and version shouldn't be empty
|
||||||
@@ -189,6 +215,10 @@ def main():
|
|||||||
if args.build:
|
if args.build:
|
||||||
build()
|
build()
|
||||||
|
|
||||||
|
if args.rebuild:
|
||||||
|
os.chdir('builder')
|
||||||
|
rebuild()
|
||||||
|
|
||||||
if args.verify:
|
if args.verify:
|
||||||
verify()
|
verify()
|
||||||
|
|
||||||
|
|||||||
@@ -162,9 +162,12 @@ script: |
|
|||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DBACKCOMPAT=ON
|
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DBACKCOMPAT=ON
|
||||||
make ${MAKEOPTS}
|
make ${MAKEOPTS}
|
||||||
|
chmod 755 bin/*
|
||||||
|
cp ../LICENSE bin
|
||||||
|
chmod 644 bin/LICENSE
|
||||||
DISTNAME=monero-${i}-${version}
|
DISTNAME=monero-${i}-${version}
|
||||||
mv bin ${DISTNAME}
|
mv bin ${DISTNAME}
|
||||||
find ${DISTNAME}/ | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | bzip2 -9 > ${OUTDIR}/${DISTNAME}.tar.bz2
|
find ${DISTNAME}/ | sort | tar --no-recursion --owner=0 --group=0 -c -T - | bzip2 -9 > ${OUTDIR}/${DISTNAME}.tar.bz2
|
||||||
cd ..
|
cd ..
|
||||||
rm -rf build
|
rm -rf build
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -109,9 +109,12 @@ script: |
|
|||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake
|
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake
|
||||||
make ${MAKEOPTS}
|
make ${MAKEOPTS}
|
||||||
|
chmod 755 bin/*
|
||||||
|
cp ../LICENSE bin
|
||||||
|
chmod 644 bin/LICENSE
|
||||||
DISTNAME=monero-${i}-${version}
|
DISTNAME=monero-${i}-${version}
|
||||||
mv bin ${DISTNAME}
|
mv bin ${DISTNAME}
|
||||||
find ${DISTNAME}/ | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | bzip2 -9 > ${OUTDIR}/${DISTNAME}.tar.bz2
|
find ${DISTNAME}/ | sort | tar --no-recursion --owner=0 --group=0 -c -T - | bzip2 -9 > ${OUTDIR}/${DISTNAME}.tar.bz2
|
||||||
cd ..
|
cd ..
|
||||||
rm -rf build
|
rm -rf build
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ script: |
|
|||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake
|
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake
|
||||||
make ${MAKEOPTS}
|
make ${MAKEOPTS}
|
||||||
|
cp ../LICENSE bin
|
||||||
DISTNAME=monero-${i}-${version}
|
DISTNAME=monero-${i}-${version}
|
||||||
mv bin ${DISTNAME}
|
mv bin ${DISTNAME}
|
||||||
find ${DISTNAME}/ | sort | zip -X@ ${OUTDIR}/${DISTNAME}.zip
|
find ${DISTNAME}/ | sort | zip -X@ ${OUTDIR}/${DISTNAME}.zip
|
||||||
|
|||||||
@@ -8356,7 +8356,11 @@ bool simple_wallet::get_transfers(std::vector<std::string>& local_args, std::vec
|
|||||||
m_in_manual_refresh.store(true, std::memory_order_relaxed);
|
m_in_manual_refresh.store(true, std::memory_order_relaxed);
|
||||||
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){m_in_manual_refresh.store(false, std::memory_order_relaxed);});
|
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){m_in_manual_refresh.store(false, std::memory_order_relaxed);});
|
||||||
|
|
||||||
m_wallet->update_pool_state();
|
std::vector<std::pair<cryptonote::transaction, bool>> process_txs;
|
||||||
|
m_wallet->update_pool_state(process_txs);
|
||||||
|
if (!process_txs.empty())
|
||||||
|
m_wallet->process_pool_state(process_txs);
|
||||||
|
|
||||||
std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>> payments;
|
std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>> payments;
|
||||||
m_wallet->get_unconfirmed_payments(payments, m_current_subaddress_account, subaddr_indices);
|
m_wallet->get_unconfirmed_payments(payments, m_current_subaddress_account, subaddr_indices);
|
||||||
for (std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>>::const_iterator i = payments.begin(); i != payments.end(); ++i) {
|
for (std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>>::const_iterator i = payments.begin(); i != payments.end(); ++i) {
|
||||||
@@ -8803,22 +8807,41 @@ void simple_wallet::check_for_messages()
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
void simple_wallet::wallet_idle_thread()
|
void simple_wallet::wallet_idle_thread()
|
||||||
{
|
{
|
||||||
|
const boost::posix_time::ptime start_time = boost::posix_time::microsec_clock::universal_time();
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> lock(m_idle_mutex);
|
boost::unique_lock<boost::mutex> lock(m_idle_mutex);
|
||||||
if (!m_idle_run.load(std::memory_order_relaxed))
|
if (!m_idle_run.load(std::memory_order_relaxed))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifndef _WIN32
|
// if another thread was busy (ie, a foreground refresh thread), we'll end up here at
|
||||||
m_inactivity_checker.do_call(boost::bind(&simple_wallet::check_inactivity, this));
|
// some random time that's not what we slept for, so we should not call refresh now
|
||||||
|
// or we'll be leaking that fact through timing
|
||||||
|
const boost::posix_time::ptime now0 = boost::posix_time::microsec_clock::universal_time();
|
||||||
|
const uint64_t dt_actual = (now0 - start_time).total_microseconds() % 1000000;
|
||||||
|
#ifdef _WIN32
|
||||||
|
static const uint64_t threshold = 10000;
|
||||||
|
#else
|
||||||
|
static const uint64_t threshold = 2000;
|
||||||
#endif
|
#endif
|
||||||
m_refresh_checker.do_call(boost::bind(&simple_wallet::check_refresh, this));
|
if (dt_actual < threshold) // if less than a threshold... would a very slow machine always miss it ?
|
||||||
m_mms_checker.do_call(boost::bind(&simple_wallet::check_mms, this));
|
{
|
||||||
m_rpc_payment_checker.do_call(boost::bind(&simple_wallet::check_rpc_payment, this));
|
#ifndef _WIN32
|
||||||
|
m_inactivity_checker.do_call(boost::bind(&simple_wallet::check_inactivity, this));
|
||||||
|
#endif
|
||||||
|
m_refresh_checker.do_call(boost::bind(&simple_wallet::check_refresh, this));
|
||||||
|
m_mms_checker.do_call(boost::bind(&simple_wallet::check_mms, this));
|
||||||
|
m_rpc_payment_checker.do_call(boost::bind(&simple_wallet::check_rpc_payment, this));
|
||||||
|
|
||||||
if (!m_idle_run.load(std::memory_order_relaxed))
|
if (!m_idle_run.load(std::memory_order_relaxed))
|
||||||
break;
|
break;
|
||||||
m_idle_cond.wait_for(lock, boost::chrono::seconds(1));
|
}
|
||||||
|
|
||||||
|
// aim for the next multiple of 1 second
|
||||||
|
const boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time();
|
||||||
|
const auto dt = (now - start_time).total_microseconds();
|
||||||
|
const auto wait = 1000000 - dt % 1000000;
|
||||||
|
m_idle_cond.wait_for(lock, boost::chrono::microseconds(wait));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@@ -10002,7 +10025,11 @@ bool simple_wallet::show_transfer(const std::vector<std::string> &args)
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_wallet->update_pool_state();
|
std::vector<std::pair<cryptonote::transaction, bool>> process_txs;
|
||||||
|
m_wallet->update_pool_state(process_txs);
|
||||||
|
if (!process_txs.empty())
|
||||||
|
m_wallet->process_pool_state(process_txs);
|
||||||
|
|
||||||
std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>> pool_payments;
|
std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>> pool_payments;
|
||||||
m_wallet->get_unconfirmed_payments(pool_payments, m_current_subaddress_account);
|
m_wallet->get_unconfirmed_payments(pool_payments, m_current_subaddress_account);
|
||||||
for (std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>>::const_iterator i = pool_payments.begin(); i != pool_payments.end(); ++i) {
|
for (std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>>::const_iterator i = pool_payments.begin(); i != pool_payments.end(); ++i) {
|
||||||
|
|||||||
@@ -448,10 +448,12 @@ namespace cryptonote
|
|||||||
std::atomic<bool> m_locked;
|
std::atomic<bool> m_locked;
|
||||||
std::atomic<bool> m_in_command;
|
std::atomic<bool> m_in_command;
|
||||||
|
|
||||||
|
template<uint64_t mini, uint64_t maxi> struct get_random_interval { public: uint64_t operator()() const { return crypto::rand_range(mini, maxi); } };
|
||||||
|
|
||||||
epee::math_helper::once_a_time_seconds<1> m_inactivity_checker;
|
epee::math_helper::once_a_time_seconds<1> m_inactivity_checker;
|
||||||
epee::math_helper::once_a_time_seconds<90> m_refresh_checker;
|
epee::math_helper::once_a_time_seconds_range<get_random_interval<80 * 1000000, 100 * 1000000>> m_refresh_checker;
|
||||||
epee::math_helper::once_a_time_seconds<90> m_mms_checker;
|
epee::math_helper::once_a_time_seconds_range<get_random_interval<90 * 1000000, 110 * 1000000>> m_mms_checker;
|
||||||
epee::math_helper::once_a_time_seconds<90> m_rpc_payment_checker;
|
epee::math_helper::once_a_time_seconds_range<get_random_interval<90 * 1000000, 115 * 1000000>> m_rpc_payment_checker;
|
||||||
|
|
||||||
std::atomic<bool> m_need_payment;
|
std::atomic<bool> m_need_payment;
|
||||||
boost::posix_time::ptime m_last_rpc_payment_mining_time;
|
boost::posix_time::ptime m_last_rpc_payment_mining_time;
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ void NodeRPCProxy::invalidate()
|
|||||||
m_rpc_payment_seed_height = 0;
|
m_rpc_payment_seed_height = 0;
|
||||||
m_rpc_payment_seed_hash = crypto::null_hash;
|
m_rpc_payment_seed_hash = crypto::null_hash;
|
||||||
m_rpc_payment_next_seed_hash = crypto::null_hash;
|
m_rpc_payment_next_seed_hash = crypto::null_hash;
|
||||||
|
m_height_time = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> NodeRPCProxy::get_rpc_version(uint32_t &rpc_version)
|
boost::optional<std::string> NodeRPCProxy::get_rpc_version(uint32_t &rpc_version)
|
||||||
@@ -101,6 +102,7 @@ boost::optional<std::string> NodeRPCProxy::get_rpc_version(uint32_t &rpc_version
|
|||||||
void NodeRPCProxy::set_height(uint64_t h)
|
void NodeRPCProxy::set_height(uint64_t h)
|
||||||
{
|
{
|
||||||
m_height = h;
|
m_height = h;
|
||||||
|
m_height_time = time(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> NodeRPCProxy::get_info()
|
boost::optional<std::string> NodeRPCProxy::get_info()
|
||||||
@@ -126,12 +128,20 @@ boost::optional<std::string> NodeRPCProxy::get_info()
|
|||||||
m_target_height = resp_t.target_height;
|
m_target_height = resp_t.target_height;
|
||||||
m_block_weight_limit = resp_t.block_weight_limit ? resp_t.block_weight_limit : resp_t.block_size_limit;
|
m_block_weight_limit = resp_t.block_weight_limit ? resp_t.block_weight_limit : resp_t.block_size_limit;
|
||||||
m_get_info_time = now;
|
m_get_info_time = now;
|
||||||
|
m_height_time = now;
|
||||||
}
|
}
|
||||||
return boost::optional<std::string>();
|
return boost::optional<std::string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::string> NodeRPCProxy::get_height(uint64_t &height)
|
boost::optional<std::string> NodeRPCProxy::get_height(uint64_t &height)
|
||||||
{
|
{
|
||||||
|
const time_t now = time(NULL);
|
||||||
|
if (now < m_height_time + 30) // re-cache every 30 seconds
|
||||||
|
{
|
||||||
|
height = m_height;
|
||||||
|
return boost::optional<std::string>();
|
||||||
|
}
|
||||||
|
|
||||||
auto res = get_info();
|
auto res = get_info();
|
||||||
if (res)
|
if (res)
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ private:
|
|||||||
crypto::hash m_rpc_payment_seed_hash;
|
crypto::hash m_rpc_payment_seed_hash;
|
||||||
crypto::hash m_rpc_payment_next_seed_hash;
|
crypto::hash m_rpc_payment_next_seed_hash;
|
||||||
uint32_t m_rpc_payment_cookie;
|
uint32_t m_rpc_payment_cookie;
|
||||||
|
time_t m_height_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2519,12 +2519,14 @@ void wallet2::parse_block_round(const cryptonote::blobdata &blob, cryptonote::bl
|
|||||||
error = !cryptonote::parse_and_validate_block_from_blob(blob, bl, bl_id);
|
error = !cryptonote::parse_and_validate_block_from_blob(blob, bl, bl_id);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
void wallet2::pull_blocks(uint64_t start_height, uint64_t &blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices)
|
void wallet2::pull_blocks(uint64_t start_height, uint64_t &blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices, uint64_t ¤t_height)
|
||||||
{
|
{
|
||||||
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::request req = AUTO_VAL_INIT(req);
|
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::request req = AUTO_VAL_INIT(req);
|
||||||
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::response res = AUTO_VAL_INIT(res);
|
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::response res = AUTO_VAL_INIT(res);
|
||||||
req.block_ids = short_chain_history;
|
req.block_ids = short_chain_history;
|
||||||
|
|
||||||
|
MDEBUG("Pulling blocks: start_height " << start_height);
|
||||||
|
|
||||||
req.prune = true;
|
req.prune = true;
|
||||||
req.start_height = start_height;
|
req.start_height = start_height;
|
||||||
req.no_miner_tx = m_refresh_type == RefreshNoCoinbase;
|
req.no_miner_tx = m_refresh_type == RefreshNoCoinbase;
|
||||||
@@ -2544,6 +2546,10 @@ void wallet2::pull_blocks(uint64_t start_height, uint64_t &blocks_start_height,
|
|||||||
blocks_start_height = res.start_height;
|
blocks_start_height = res.start_height;
|
||||||
blocks = std::move(res.blocks);
|
blocks = std::move(res.blocks);
|
||||||
o_indices = std::move(res.output_indices);
|
o_indices = std::move(res.output_indices);
|
||||||
|
current_height = res.current_height;
|
||||||
|
|
||||||
|
MDEBUG("Pulled blocks: blocks_start_height " << blocks_start_height << ", count " << blocks.size()
|
||||||
|
<< ", height " << blocks_start_height + blocks.size() << ", node height " << res.current_height);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
void wallet2::pull_hashes(uint64_t start_height, uint64_t &blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<crypto::hash> &hashes)
|
void wallet2::pull_hashes(uint64_t start_height, uint64_t &blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<crypto::hash> &hashes)
|
||||||
@@ -2726,9 +2732,10 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
|
|||||||
refresh(trusted_daemon, start_height, blocks_fetched, received_money);
|
refresh(trusted_daemon, start_height, blocks_fetched, received_money);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
void wallet2::pull_and_parse_next_blocks(uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::vector<cryptonote::block_complete_entry> &prev_blocks, const std::vector<parsed_block> &prev_parsed_blocks, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<parsed_block> &parsed_blocks, bool &error, std::exception_ptr &exception)
|
void wallet2::pull_and_parse_next_blocks(uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::vector<cryptonote::block_complete_entry> &prev_blocks, const std::vector<parsed_block> &prev_parsed_blocks, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<parsed_block> &parsed_blocks, bool &last, bool &error, std::exception_ptr &exception)
|
||||||
{
|
{
|
||||||
error = false;
|
error = false;
|
||||||
|
last = false;
|
||||||
exception = NULL;
|
exception = NULL;
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -2746,7 +2753,8 @@ void wallet2::pull_and_parse_next_blocks(uint64_t start_height, uint64_t &blocks
|
|||||||
|
|
||||||
// pull the new blocks
|
// pull the new blocks
|
||||||
std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> o_indices;
|
std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> o_indices;
|
||||||
pull_blocks(start_height, blocks_start_height, short_chain_history, blocks, o_indices);
|
uint64_t current_height;
|
||||||
|
pull_blocks(start_height, blocks_start_height, short_chain_history, blocks, o_indices, current_height);
|
||||||
THROW_WALLET_EXCEPTION_IF(blocks.size() != o_indices.size(), error::wallet_internal_error, "Mismatched sizes of blocks and o_indices");
|
THROW_WALLET_EXCEPTION_IF(blocks.size() != o_indices.size(), error::wallet_internal_error, "Mismatched sizes of blocks and o_indices");
|
||||||
|
|
||||||
tools::threadpool& tpool = tools::threadpool::getInstance();
|
tools::threadpool& tpool = tools::threadpool::getInstance();
|
||||||
@@ -2784,6 +2792,7 @@ void wallet2::pull_and_parse_next_blocks(uint64_t start_height, uint64_t &blocks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
waiter.wait(&tpool);
|
waiter.wait(&tpool);
|
||||||
|
last = !blocks.empty() && cryptonote::get_block_height(parsed_blocks.back().block) + 1 == current_height;
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
@@ -2820,7 +2829,7 @@ void wallet2::remove_obsolete_pool_txs(const std::vector<crypto::hash> &tx_hashe
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
void wallet2::update_pool_state(bool refreshed)
|
void wallet2::update_pool_state(std::vector<std::pair<cryptonote::transaction, bool>> &process_txs, bool refreshed)
|
||||||
{
|
{
|
||||||
MTRACE("update_pool_state start");
|
MTRACE("update_pool_state start");
|
||||||
|
|
||||||
@@ -2968,11 +2977,6 @@ void wallet2::update_pool_state(bool refreshed)
|
|||||||
LOG_PRINT_L1("We sent that one");
|
LOG_PRINT_L1("We sent that one");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_PRINT_L1("Already saw that one, it's for us");
|
|
||||||
txids.push_back({txid, true});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get those txes
|
// get those txes
|
||||||
@@ -3015,13 +3019,7 @@ void wallet2::update_pool_state(bool refreshed)
|
|||||||
[tx_hash](const std::pair<crypto::hash, bool> &e) { return e.first == tx_hash; });
|
[tx_hash](const std::pair<crypto::hash, bool> &e) { return e.first == tx_hash; });
|
||||||
if (i != txids.end())
|
if (i != txids.end())
|
||||||
{
|
{
|
||||||
process_new_transaction(tx_hash, tx, std::vector<uint64_t>(), 0, 0, time(NULL), false, true, tx_entry.double_spend_seen, {});
|
process_txs.push_back(std::make_pair(tx, tx_entry.double_spend_seen));
|
||||||
m_scanned_pool_txs[0].insert(tx_hash);
|
|
||||||
if (m_scanned_pool_txs[0].size() > 5000)
|
|
||||||
{
|
|
||||||
std::swap(m_scanned_pool_txs[0], m_scanned_pool_txs[1]);
|
|
||||||
m_scanned_pool_txs[0].clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -3052,6 +3050,24 @@ void wallet2::update_pool_state(bool refreshed)
|
|||||||
MTRACE("update_pool_state end");
|
MTRACE("update_pool_state end");
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
void wallet2::process_pool_state(const std::vector<std::pair<cryptonote::transaction, bool>> &txs)
|
||||||
|
{
|
||||||
|
const time_t now = time(NULL);
|
||||||
|
for (const auto &e: txs)
|
||||||
|
{
|
||||||
|
const cryptonote::transaction &tx = e.first;
|
||||||
|
const bool double_spend_seen = e.second;
|
||||||
|
const crypto::hash tx_hash = get_transaction_hash(tx);
|
||||||
|
process_new_transaction(tx_hash, tx, std::vector<uint64_t>(), 0, 0, now, false, true, double_spend_seen, {});
|
||||||
|
m_scanned_pool_txs[0].insert(tx_hash);
|
||||||
|
if (m_scanned_pool_txs[0].size() > 5000)
|
||||||
|
{
|
||||||
|
std::swap(m_scanned_pool_txs[0], m_scanned_pool_txs[1]);
|
||||||
|
m_scanned_pool_txs[0].clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, bool force)
|
void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, bool force)
|
||||||
{
|
{
|
||||||
std::vector<crypto::hash> hashes;
|
std::vector<crypto::hash> hashes;
|
||||||
@@ -3255,7 +3271,15 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
|
|||||||
});
|
});
|
||||||
|
|
||||||
auto scope_exit_handler_hwdev = epee::misc_utils::create_scope_leave_handler([&](){hwdev.computing_key_images(false);});
|
auto scope_exit_handler_hwdev = epee::misc_utils::create_scope_leave_handler([&](){hwdev.computing_key_images(false);});
|
||||||
bool first = true;
|
|
||||||
|
// get updated pool state first, but do not process those txes just yet,
|
||||||
|
// since that might cause a password prompt, which would introduce a data
|
||||||
|
// leak allowing a passive adversary with traffic analysis capability to
|
||||||
|
// infer when we get an incoming output
|
||||||
|
std::vector<std::pair<cryptonote::transaction, bool>> process_pool_txs;
|
||||||
|
update_pool_state(process_pool_txs, refreshed);
|
||||||
|
|
||||||
|
bool first = true, last = false;
|
||||||
while(m_run.load(std::memory_order_relaxed))
|
while(m_run.load(std::memory_order_relaxed))
|
||||||
{
|
{
|
||||||
uint64_t next_blocks_start_height;
|
uint64_t next_blocks_start_height;
|
||||||
@@ -3277,7 +3301,8 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
|
|||||||
refreshed = true;
|
refreshed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tpool.submit(&waiter, [&]{pull_and_parse_next_blocks(start_height, next_blocks_start_height, short_chain_history, blocks, parsed_blocks, next_blocks, next_parsed_blocks, error, exception);});
|
if (!last)
|
||||||
|
tpool.submit(&waiter, [&]{pull_and_parse_next_blocks(start_height, next_blocks_start_height, short_chain_history, blocks, parsed_blocks, next_blocks, next_parsed_blocks, last, error, exception);});
|
||||||
|
|
||||||
if (!first)
|
if (!first)
|
||||||
{
|
{
|
||||||
@@ -3384,8 +3409,8 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// If stop() is called we don't need to check pending transactions
|
// If stop() is called we don't need to check pending transactions
|
||||||
if (check_pool && m_run.load(std::memory_order_relaxed))
|
if (check_pool && m_run.load(std::memory_order_relaxed) && !process_pool_txs.empty())
|
||||||
update_pool_state(refreshed);
|
process_pool_state(process_pool_txs);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
@@ -13187,7 +13212,7 @@ uint64_t wallet2::get_blockchain_height_by_date(uint16_t year, uint8_t month, ui
|
|||||||
bool wallet2::is_synced()
|
bool wallet2::is_synced()
|
||||||
{
|
{
|
||||||
uint64_t height;
|
uint64_t height;
|
||||||
boost::optional<std::string> result = m_node_rpc_proxy.get_target_height(height);
|
boost::optional<std::string> result = m_node_rpc_proxy.get_height(height);
|
||||||
if (result && *result != CORE_RPC_STATUS_OK)
|
if (result && *result != CORE_RPC_STATUS_OK)
|
||||||
return false;
|
return false;
|
||||||
return get_blockchain_current_height() >= height;
|
return get_blockchain_current_height() >= height;
|
||||||
|
|||||||
@@ -1219,7 +1219,8 @@ private:
|
|||||||
bool import_key_images(signed_tx_set & signed_tx, size_t offset=0, bool only_selected_transfers=false);
|
bool import_key_images(signed_tx_set & signed_tx, size_t offset=0, bool only_selected_transfers=false);
|
||||||
crypto::public_key get_tx_pub_key_from_received_outs(const tools::wallet2::transfer_details &td) const;
|
crypto::public_key get_tx_pub_key_from_received_outs(const tools::wallet2::transfer_details &td) const;
|
||||||
|
|
||||||
void update_pool_state(bool refreshed = false);
|
void update_pool_state(std::vector<std::pair<cryptonote::transaction, bool>> &process_txs, bool refreshed = false);
|
||||||
|
void process_pool_state(const std::vector<std::pair<cryptonote::transaction, bool>> &txs);
|
||||||
void remove_obsolete_pool_txs(const std::vector<crypto::hash> &tx_hashes);
|
void remove_obsolete_pool_txs(const std::vector<crypto::hash> &tx_hashes);
|
||||||
|
|
||||||
std::string encrypt(const char *plaintext, size_t len, const crypto::secret_key &skey, bool authenticated = true) const;
|
std::string encrypt(const char *plaintext, size_t len, const crypto::secret_key &skey, bool authenticated = true) const;
|
||||||
@@ -1403,10 +1404,10 @@ private:
|
|||||||
void get_short_chain_history(std::list<crypto::hash>& ids, uint64_t granularity = 1) const;
|
void get_short_chain_history(std::list<crypto::hash>& ids, uint64_t granularity = 1) const;
|
||||||
bool clear();
|
bool clear();
|
||||||
void clear_soft(bool keep_key_images=false);
|
void clear_soft(bool keep_key_images=false);
|
||||||
void pull_blocks(uint64_t start_height, uint64_t& blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices);
|
void pull_blocks(uint64_t start_height, uint64_t& blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices, uint64_t ¤t_height);
|
||||||
void pull_hashes(uint64_t start_height, uint64_t& blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<crypto::hash> &hashes);
|
void pull_hashes(uint64_t start_height, uint64_t& blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<crypto::hash> &hashes);
|
||||||
void fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, bool force = false);
|
void fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, bool force = false);
|
||||||
void pull_and_parse_next_blocks(uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::vector<cryptonote::block_complete_entry> &prev_blocks, const std::vector<parsed_block> &prev_parsed_blocks, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<parsed_block> &parsed_blocks, bool &error, std::exception_ptr &exception);
|
void pull_and_parse_next_blocks(uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::vector<cryptonote::block_complete_entry> &prev_blocks, const std::vector<parsed_block> &prev_parsed_blocks, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<parsed_block> &parsed_blocks, bool &last, bool &error, std::exception_ptr &exception);
|
||||||
void process_parsed_blocks(uint64_t start_height, const std::vector<cryptonote::block_complete_entry> &blocks, const std::vector<parsed_block> &parsed_blocks, uint64_t& blocks_added, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache = NULL);
|
void process_parsed_blocks(uint64_t start_height, const std::vector<cryptonote::block_complete_entry> &blocks, const std::vector<parsed_block> &parsed_blocks, uint64_t& blocks_added, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache = NULL);
|
||||||
uint64_t select_transfers(uint64_t needed_money, std::vector<size_t> unused_transfers_indices, std::vector<size_t>& selected_transfers) const;
|
uint64_t select_transfers(uint64_t needed_money, std::vector<size_t> unused_transfers_indices, std::vector<size_t>& selected_transfers) const;
|
||||||
bool prepare_file_names(const std::string& file_path);
|
bool prepare_file_names(const std::string& file_path);
|
||||||
|
|||||||
@@ -2438,7 +2438,10 @@ namespace tools
|
|||||||
|
|
||||||
if (req.pool)
|
if (req.pool)
|
||||||
{
|
{
|
||||||
m_wallet->update_pool_state();
|
std::vector<std::pair<cryptonote::transaction, bool>> process_txs;
|
||||||
|
m_wallet->update_pool_state(process_txs);
|
||||||
|
if (!process_txs.empty())
|
||||||
|
m_wallet->process_pool_state(process_txs);
|
||||||
|
|
||||||
std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>> payments;
|
std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>> payments;
|
||||||
m_wallet->get_unconfirmed_payments(payments, account_index, subaddr_indices);
|
m_wallet->get_unconfirmed_payments(payments, account_index, subaddr_indices);
|
||||||
@@ -2518,7 +2521,10 @@ namespace tools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_wallet->update_pool_state();
|
std::vector<std::pair<cryptonote::transaction, bool>> process_txs;
|
||||||
|
m_wallet->update_pool_state(process_txs);
|
||||||
|
if (!process_txs.empty())
|
||||||
|
m_wallet->process_pool_state(process_txs);
|
||||||
|
|
||||||
std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>> pool_payments;
|
std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>> pool_payments;
|
||||||
m_wallet->get_unconfirmed_payments(pool_payments, req.account_index);
|
m_wallet->get_unconfirmed_payments(pool_payments, req.account_index);
|
||||||
|
|||||||
Reference in New Issue
Block a user