mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Compare commits
28 Commits
0efb6366df
...
300626ae45
Author | SHA1 | Date | |
---|---|---|---|
|
300626ae45 | ||
|
3d5dc160d8 | ||
|
032fc21198 | ||
|
05ca6cffff | ||
|
2ab561d281 | ||
|
280988bee3 | ||
|
a497df0339 | ||
|
db676a7e5f | ||
|
94e6637c33 | ||
|
bbb0cceb7a | ||
|
3f143096c8 | ||
|
000495df8e | ||
|
714ea55dbe | ||
|
11323c3851 | ||
|
548121d366 | ||
|
b65038ec94 | ||
|
f3b065cd9c | ||
|
feb6a1ad3f | ||
|
2e509b96c4 | ||
|
f0decc8790 | ||
|
865b24ea00 | ||
|
1f5fa7e7cf | ||
|
59ddac5656 | ||
|
05732aceaf | ||
|
0577b4d9de | ||
|
4717fe8045 | ||
|
acda80ed4f | ||
|
d8e04255e0 |
@ -116,8 +116,8 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
|
||||
BITCOIN_QT_CHECK([
|
||||
TEMP_CPPFLAGS=$CPPFLAGS
|
||||
TEMP_CXXFLAGS=$CXXFLAGS
|
||||
CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
|
||||
CXXFLAGS="$PIC_FLAGS $CXXFLAGS"
|
||||
CPPFLAGS="$QT_INCLUDES $CORE_CPPFLAGS $CPPFLAGS"
|
||||
CXXFLAGS="$PIC_FLAGS $CORE_CXXFLAGS $CXXFLAGS"
|
||||
_BITCOIN_QT_IS_STATIC
|
||||
if test "x$bitcoin_cv_static_qt" = xyes; then
|
||||
_BITCOIN_QT_CHECK_STATIC_LIBS
|
||||
@ -177,8 +177,8 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
|
||||
AC_MSG_CHECKING(whether -fPIE can be used with this Qt config)
|
||||
TEMP_CPPFLAGS=$CPPFLAGS
|
||||
TEMP_CXXFLAGS=$CXXFLAGS
|
||||
CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
|
||||
CXXFLAGS="$PIE_FLAGS $CXXFLAGS"
|
||||
CPPFLAGS="$QT_INCLUDES $CORE_CPPFLAGS $CPPFLAGS"
|
||||
CXXFLAGS="$PIE_FLAGS $CORE_CXXFLAGS $CXXFLAGS"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <QtCore/qconfig.h>
|
||||
#ifndef QT_VERSION
|
||||
@ -200,7 +200,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
|
||||
BITCOIN_QT_CHECK([
|
||||
AC_MSG_CHECKING(whether -fPIC is needed with this Qt config)
|
||||
TEMP_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
|
||||
CPPFLAGS="$QT_INCLUDES $CORE_CPPFLAGS $CPPFLAGS"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <QtCore/qconfig.h>
|
||||
#ifndef QT_VERSION
|
||||
|
@ -25,8 +25,7 @@ export JOB_NUMBER=${JOB_NUMBER:-1}
|
||||
|
||||
echo "Fallback to default values in env (if not yet set)"
|
||||
# The number of parallel jobs to pass down to make and test_runner.py
|
||||
MAKEJOBS="-j$(nproc)"
|
||||
export MAKEJOBS
|
||||
export MAKEJOBS=${MAKEJOBS:--j$(nproc)}
|
||||
# A folder for the ci system to put temporary files (ccache, datadirs for tests, ...)
|
||||
# This folder only exists on the ci host.
|
||||
export BASE_SCRATCH_DIR=${BASE_SCRATCH_DIR:-$BASE_ROOT_DIR/ci/scratch}
|
||||
|
@ -9,8 +9,7 @@ export LC_ALL=C.UTF-8
|
||||
export CONTAINER_NAME=ci_native_qt5
|
||||
export PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libdbus-1-dev libharfbuzz-dev"
|
||||
export DEP_OPTS="NO_UPNP=1 DEBUG=1"
|
||||
# TODO: we have few rpcs that aren't covered by any test, re-enable the line below once it's fixed
|
||||
# export TEST_RUNNER_EXTRA="--previous-releases --coverage --extended --exclude feature_pruning,feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash
|
||||
export TEST_RUNNER_EXTRA="--previous-releases --coverage --extended --exclude feature_pruning,feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash
|
||||
export RUN_UNIT_TESTS_SEQUENTIAL="true"
|
||||
export RUN_UNIT_TESTS="false"
|
||||
export GOAL="install"
|
||||
|
82
configure.ac
82
configure.ac
@ -372,7 +372,9 @@ case $host in
|
||||
esac
|
||||
|
||||
if test "x$enable_debug" = xyes; then
|
||||
dnl Clear default -g -O2 flags
|
||||
dnl If debugging is enabled, and the user hasn't overriden CXXFLAGS, clear
|
||||
dnl them, to prevent autoconfs "-g -O2" being added. Otherwise we'd end up
|
||||
dnl with "-O0 -g3 -g -O2".
|
||||
if test "x$CXXFLAGS_overridden" = xno; then
|
||||
CXXFLAGS=""
|
||||
fi
|
||||
@ -397,11 +399,11 @@ else
|
||||
# Stacktraces will be suboptimal due to optimization, but better than nothing. Also, -fno-omit-frame-pointer
|
||||
# mitigates this a little bit
|
||||
if test "x$GCC" = xyes; then
|
||||
CFLAGS="$CFLAGS -g1 -fno-omit-frame-pointer"
|
||||
DEBUG_CFLAGS="$DEBUG_CFLAGS -g1 -fno-omit-frame-pointer"
|
||||
fi
|
||||
|
||||
if test "x$GXX" = xyes; then
|
||||
CXXFLAGS="$CXXFLAGS -g1 -fno-omit-frame-pointer"
|
||||
DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -g1 -fno-omit-frame-pointer"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -429,7 +431,7 @@ if test x$LINK_WRAP_SUPPORTED = "xyes"; then
|
||||
fi
|
||||
|
||||
# Needed for MinGW targets when debug symbols are enabled as compiled objects get very large
|
||||
AX_CHECK_COMPILE_FLAG([-Wa,-mbig-obj], [CXXFLAGS="$CXXFLAGS -Wa,-mbig-obj"],,,)
|
||||
AX_CHECK_COMPILE_FLAG([-Wa,-mbig-obj], [DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -Wa,-mbig-obj"],,,)
|
||||
|
||||
if test x$use_sanitizers != x; then
|
||||
dnl First check if the compiler accepts flags. If an incompatible pair like
|
||||
@ -532,7 +534,7 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
|
||||
fi
|
||||
|
||||
dnl Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review.
|
||||
AX_CHECK_COMPILE_FLAG([-fno-extended-identifiers],[[CXXFLAGS="$CXXFLAGS -fno-extended-identifiers"]],,[[$CXXFLAG_WERROR]])
|
||||
AX_CHECK_COMPILE_FLAG([-fno-extended-identifiers],[[CORE_CXXFLAGS="$CORE_CXXFLAGS -fno-extended-identifiers"]],,[[$CXXFLAG_WERROR]])
|
||||
|
||||
enable_arm_crc=no
|
||||
enable_arm_shani=no
|
||||
@ -683,7 +685,7 @@ CXXFLAGS="$TEMP_CXXFLAGS"
|
||||
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -DHAVE_BUILD_INFO -DGSL_NO_IOSTREAMS"
|
||||
CORE_CPPFLAGS="$CORE_CPPFLAGS -DHAVE_BUILD_INFO -DGSL_NO_IOSTREAMS"
|
||||
|
||||
AC_ARG_WITH([utils],
|
||||
[AS_HELP_STRING([--with-utils],
|
||||
@ -755,7 +757,10 @@ case $host in
|
||||
AC_MSG_ERROR("windres not found")
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -D_WIN32_WINNT=0x0601 -D_WIN32_IE=0x0501 -DWIN32_LEAN_AND_MEAN"
|
||||
CORE_CPPFLAGS="$CORE_CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -D_WIN32_WINNT=0x0601 -D_WIN32_IE=0x0501 -DWIN32_LEAN_AND_MEAN"
|
||||
dnl Prevent the definition of min/max macros.
|
||||
dnl We always want to use the standard library.
|
||||
CORE_CPPFLAGS="$CORE_CPPFLAGS -DNOMINMAX"
|
||||
|
||||
dnl libtool insists upon adding -nostdlib and a list of objects/libs to link against.
|
||||
dnl That breaks our ability to build dll's with static libgcc/libstdc++/libssp. Override
|
||||
@ -766,14 +771,14 @@ case $host in
|
||||
postdeps_CXX=
|
||||
|
||||
dnl We require Windows 7 (NT 6.1) or later
|
||||
AX_CHECK_LINK_FLAG([[-Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1]],[LDFLAGS="$LDFLAGS -Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1"],,[[$LDFLAG_WERROR]])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1]],[CORE_LDFLAGS="$CORE_LDFLAGS -Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1"],,[[$LDFLAG_WERROR]])
|
||||
;;
|
||||
*darwin*)
|
||||
TARGET_OS=darwin
|
||||
if test x$cross_compiling != xyes; then
|
||||
BUILD_OS=darwin
|
||||
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-headerpad_max_install_names]], [LDFLAGS="$LDFLAGS -Wl,-headerpad_max_install_names"],, [[$LDFLAG_WERROR]])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-headerpad_max_install_names]], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-headerpad_max_install_names"],, [[$LDFLAG_WERROR]])
|
||||
|
||||
AC_CHECK_PROG([BREW],brew, brew)
|
||||
if test x$BREW = xbrew; then
|
||||
@ -800,8 +805,8 @@ case $host in
|
||||
|
||||
gmp_prefix=$($BREW --prefix gmp 2>/dev/null)
|
||||
if test x$gmp_prefix != x; then
|
||||
CPPFLAGS="$CPPFLAGS -I$gmp_prefix/include"
|
||||
LDFLAGS="$LDFLAGS -L$gmp_prefix/lib"
|
||||
CORE_CPPFLAGS="$CORE_CPPFLAGS -I$gmp_prefix/include"
|
||||
CORE_LDFLAGS="$CORE_LDFLAGS -L$gmp_prefix/lib"
|
||||
fi
|
||||
|
||||
case $host in
|
||||
@ -813,20 +818,20 @@ case $host in
|
||||
if test "x$use_upnp" != xno && $BREW list --versions miniupnpc >/dev/null; then
|
||||
miniupnpc_prefix=$($BREW --prefix miniupnpc 2>/dev/null)
|
||||
if test "x$suppress_external_warnings" != xno; then
|
||||
CPPFLAGS="$CPPFLAGS -isystem $miniupnpc_prefix/include"
|
||||
CORE_CPPFLAGS="$CORE_CPPFLAGS -isystem $miniupnpc_prefix/include"
|
||||
else
|
||||
CPPFLAGS="$CPPFLAGS -I$miniupnpc_prefix/include"
|
||||
CORE_CPPFLAGS="$CORE_CPPFLAGS -I$miniupnpc_prefix/include"
|
||||
fi
|
||||
LDFLAGS="$LDFLAGS -L$miniupnpc_prefix/lib"
|
||||
CORE_LDFLAGS="$CORE_LDFLAGS -L$miniupnpc_prefix/lib"
|
||||
fi
|
||||
if test "x$use_natpmp" != xno && $BREW list --versions libnatpmp >/dev/null; then
|
||||
libnatpmp_prefix=$($BREW --prefix libnatpmp 2>/dev/null)
|
||||
if test "x$suppress_external_warnings" != xno; then
|
||||
CPPFLAGS="$CPPFLAGS -isystem $libnatpmp_prefix/include"
|
||||
CORE_CPPFLAGS="$CORE_CPPFLAGS -isystem $libnatpmp_prefix/include"
|
||||
else
|
||||
CPPFLAGS="$CPPFLAGS -I$libnatpmp_prefix/include"
|
||||
CORE_CPPFLAGS="$CORE_CPPFLAGS -I$libnatpmp_prefix/include"
|
||||
fi
|
||||
LDFLAGS="$LDFLAGS -L$libnatpmp_prefix/lib"
|
||||
CORE_LDFLAGS="$CORE_LDFLAGS -L$libnatpmp_prefix/lib"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@ -849,7 +854,7 @@ case $host in
|
||||
esac
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0"
|
||||
CORE_CPPFLAGS="$CORE_CPPFLAGS -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0"
|
||||
OBJCXXFLAGS="$CXXFLAGS"
|
||||
;;
|
||||
*android*)
|
||||
@ -912,11 +917,17 @@ if test x$use_lcov = xyes; then
|
||||
AC_SUBST(COV_TOOL_WRAPPER, "cov_tool_wrapper.sh")
|
||||
LCOV="$LCOV --gcov-tool $(pwd)/$COV_TOOL_WRAPPER"
|
||||
|
||||
AX_CHECK_LINK_FLAG([[--coverage]], [LDFLAGS="$LDFLAGS --coverage"],
|
||||
AX_CHECK_LINK_FLAG([[--coverage]], [CORE_LDFLAGS="$CORE_LDFLAGS --coverage"],
|
||||
[AC_MSG_ERROR("lcov testing requested but --coverage linker flag does not work")])
|
||||
AX_CHECK_COMPILE_FLAG([--coverage],[CXXFLAGS="$CXXFLAGS --coverage"],
|
||||
AX_CHECK_COMPILE_FLAG([--coverage],[CORE_CXXFLAGS="$CORE_CXXFLAGS --coverage"],
|
||||
[AC_MSG_ERROR("lcov testing requested but --coverage flag does not work")])
|
||||
CXXFLAGS="$CXXFLAGS -Og"
|
||||
dnl If coverage is enabled, and the user hasn't overriden CXXFLAGS, clear
|
||||
dnl them, to prevent autoconfs "-g -O2" being added. Otherwise we'd end up
|
||||
dnl with "--coverage -Og -O0 -g -O2".
|
||||
if test "$CXXFLAGS_overridden" = "no"; then
|
||||
CXXFLAGS=""
|
||||
fi
|
||||
CORE_CXXFLAGS="$CORE_CXXFLAGS -Og -O0"
|
||||
fi
|
||||
|
||||
if test x$use_lcov_branch != xno; then
|
||||
@ -942,13 +953,13 @@ AC_FUNC_STRERROR_R
|
||||
if test x$ac_cv_sys_file_offset_bits != x &&
|
||||
test x$ac_cv_sys_file_offset_bits != xno &&
|
||||
test x$ac_cv_sys_file_offset_bits != xunknown; then
|
||||
CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
|
||||
CORE_CPPFLAGS="$CORE_CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
|
||||
fi
|
||||
|
||||
if test x$ac_cv_sys_large_files != x &&
|
||||
test x$ac_cv_sys_large_files != xno &&
|
||||
test x$ac_cv_sys_large_files != xunknown; then
|
||||
CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files"
|
||||
CORE_CPPFLAGS="$CORE_CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files"
|
||||
fi
|
||||
|
||||
if test "x$enable_gprof" = xyes; then
|
||||
@ -1037,8 +1048,8 @@ dnl These flags are specific to ld64, and may cause issues with other linkers.
|
||||
dnl For example: GNU ld will interpret -dead_strip as -de and then try and use
|
||||
dnl "ad_strip" as the symbol for the entry point.
|
||||
if test x$TARGET_OS = xdarwin; then
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-dead_strip]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip"],, [[$LDFLAG_WERROR]])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-dead_strip_dylibs]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip_dylibs"],, [[$LDFLAG_WERROR]])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-dead_strip]], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-dead_strip"],, [[$LDFLAG_WERROR]])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-dead_strip_dylibs]], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-dead_strip_dylibs"],, [[$LDFLAG_WERROR]])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-fixup_chains]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-fixup_chains"], [], [[$LDFLAG_WERROR]])
|
||||
fi
|
||||
|
||||
@ -1048,7 +1059,6 @@ AC_CHECK_DECLS([getifaddrs, freeifaddrs],[CHECK_SOCKET],,
|
||||
[#include <sys/types.h>
|
||||
#include <ifaddrs.h>]
|
||||
)
|
||||
AC_CHECK_DECLS([strnlen])
|
||||
|
||||
dnl These are used for daemonization in dashd
|
||||
AC_CHECK_DECLS([fork])
|
||||
@ -1361,7 +1371,7 @@ if test "x$enable_fuzz" = "xyes"; then
|
||||
[[-fsanitize=$use_sanitizers]],
|
||||
[AC_MSG_RESULT([no])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
CPPFLAGS="$CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"],
|
||||
CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"],
|
||||
[],
|
||||
[AC_LANG_PROGRAM([[
|
||||
#include <cstdint>
|
||||
@ -1385,7 +1395,7 @@ else
|
||||
QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES)
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"
|
||||
CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"
|
||||
fi
|
||||
|
||||
if test x$enable_wallet != xno; then
|
||||
@ -1518,7 +1528,7 @@ fi
|
||||
|
||||
dnl Check for reduced exports
|
||||
if test x$use_reduce_exports = xyes; then
|
||||
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[CXXFLAGS="$CXXFLAGS -fvisibility=hidden"],
|
||||
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[CORE_CXXFLAGS="$CORE_CXXFLAGS -fvisibility=hidden"],
|
||||
[AC_MSG_ERROR([Cannot set hidden symbol visibility. Use --disable-reduce-exports.])],[[$CXXFLAG_WERROR]])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,--exclude-libs,ALL]],[RELDFLAGS="-Wl,--exclude-libs,ALL"],,[[$LDFLAG_WERROR]])
|
||||
AX_CHECK_LINK_FLAG([-Wl,-no_exported_symbols], [LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -Wl,-no_exported_symbols"], [], [$LDFLAG_WERROR])
|
||||
@ -1870,10 +1880,14 @@ AC_SUBST(BITCOIN_MP_NODE_NAME)
|
||||
AC_SUBST(BITCOIN_MP_GUI_NAME)
|
||||
|
||||
AC_SUBST(RELDFLAGS)
|
||||
AC_SUBST(CORE_LDFLAGS)
|
||||
AC_SUBST(CORE_CPPFLAGS)
|
||||
AC_SUBST(CORE_CXXFLAGS)
|
||||
AC_SUBST(DEBUG_CFLAGS)
|
||||
AC_SUBST(DEBUG_CPPFLAGS)
|
||||
AC_SUBST(DEBUG_CXXFLAGS)
|
||||
AC_SUBST(WARN_CXXFLAGS)
|
||||
AC_SUBST(NOWARN_CXXFLAGS)
|
||||
AC_SUBST(DEBUG_CXXFLAGS)
|
||||
AC_SUBST(ERROR_CXXFLAGS)
|
||||
AC_SUBST(GPROF_CXXFLAGS)
|
||||
AC_SUBST(GPROF_LDFLAGS)
|
||||
@ -1995,10 +2009,10 @@ echo " target os = $host_os"
|
||||
echo " build os = $build_os"
|
||||
echo
|
||||
echo " CC = $CC"
|
||||
echo " CFLAGS = $PTHREAD_CFLAGS $CFLAGS"
|
||||
echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CPPFLAGS"
|
||||
echo " CFLAGS = $DEBUG_CFLAGS $PTHREAD_CFLAGS $CFLAGS"
|
||||
echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CORE_CPPFLAGS $CPPFLAGS"
|
||||
echo " CXX = $CXX"
|
||||
echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CXXFLAGS"
|
||||
echo " LDFLAGS = $PTHREAD_LIBS $HARDENED_LDFLAGS $GPROF_LDFLAGS $LDFLAGS"
|
||||
echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CORE_CXXFLAGS $CXXFLAGS"
|
||||
echo " LDFLAGS = $PTHREAD_LIBS $HARDENED_LDFLAGS $GPROF_LDFLAGS $CORE_LDFLAGS $LDFLAGS"
|
||||
echo " ARFLAGS = $ARFLAGS"
|
||||
echo
|
||||
|
@ -9,9 +9,10 @@ print-%: FORCE
|
||||
|
||||
DIST_SUBDIRS = secp256k1
|
||||
|
||||
AM_LDFLAGS = $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS) $(GPROF_LDFLAGS) $(SANITIZER_LDFLAGS)
|
||||
AM_CXXFLAGS = $(DEBUG_CXXFLAGS) $(HARDENED_CXXFLAGS) $(WARN_CXXFLAGS) $(NOWARN_CXXFLAGS) $(ERROR_CXXFLAGS) $(GPROF_CXXFLAGS) $(SANITIZER_CXXFLAGS)
|
||||
AM_CPPFLAGS = $(DEBUG_CPPFLAGS) $(HARDENED_CPPFLAGS)
|
||||
AM_LDFLAGS = $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS) $(GPROF_LDFLAGS) $(SANITIZER_LDFLAGS) $(CORE_LDFLAGS)
|
||||
AM_CFLAGS = $(DEBUG_CFLAGS)
|
||||
AM_CXXFLAGS = $(DEBUG_CXXFLAGS) $(HARDENED_CXXFLAGS) $(WARN_CXXFLAGS) $(NOWARN_CXXFLAGS) $(ERROR_CXXFLAGS) $(GPROF_CXXFLAGS) $(SANITIZER_CXXFLAGS) $(CORE_CXXFLAGS)
|
||||
AM_CPPFLAGS = $(DEBUG_CPPFLAGS) $(HARDENED_CPPFLAGS) $(CORE_CPPFLAGS)
|
||||
AM_LIBTOOLFLAGS = --preserve-dup-deps
|
||||
PTHREAD_FLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
|
||||
EXTRA_LIBRARIES =
|
||||
@ -162,9 +163,9 @@ BITCOIN_CORE_H = \
|
||||
coinjoin/util.h \
|
||||
coins.h \
|
||||
common/bloom.h \
|
||||
compat.h \
|
||||
compat/assumptions.h \
|
||||
compat/byteswap.h \
|
||||
compat/compat.h \
|
||||
compat/cpuid.h \
|
||||
compat/endian.h \
|
||||
compressor.h \
|
||||
@ -279,7 +280,7 @@ BITCOIN_CORE_H = \
|
||||
node/psbt.h \
|
||||
node/transaction.h \
|
||||
node/txreconciliation.h \
|
||||
node/ui_interface.h \
|
||||
node/interface_ui.h \
|
||||
node/utxo_snapshot.h \
|
||||
noui.h \
|
||||
outputtype.h \
|
||||
@ -512,7 +513,7 @@ libbitcoin_server_a_SOURCES = \
|
||||
node/psbt.cpp \
|
||||
node/transaction.cpp \
|
||||
node/txreconciliation.cpp \
|
||||
node/ui_interface.cpp \
|
||||
node/interface_ui.cpp \
|
||||
noui.cpp \
|
||||
policy/fees.cpp \
|
||||
policy/packages.cpp \
|
||||
@ -792,7 +793,6 @@ libbitcoin_util_a_SOURCES = \
|
||||
support/lockedpool.cpp \
|
||||
chainparamsbase.cpp \
|
||||
clientversion.cpp \
|
||||
compat/strnlen.cpp \
|
||||
fs.cpp \
|
||||
interfaces/echo.cpp \
|
||||
interfaces/handler.cpp \
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <banman.h>
|
||||
|
||||
#include <netaddress.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <sync.h>
|
||||
#include <util/system.h>
|
||||
#include <util/time.h>
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include <chainparamsbase.h>
|
||||
#include <clientversion.h>
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <compat/stdin.h>
|
||||
#include <policy/feerate.h>
|
||||
#include <rpc/client.h>
|
||||
@ -556,7 +556,7 @@ public:
|
||||
peer.is_outbound ? "out" : "in",
|
||||
ConnectionTypeForNetinfo(peer.conn_type),
|
||||
peer.network,
|
||||
peer.transport_protocol_type.rfind('v', 0) == 0 ? peer.transport_protocol_type[1] : ' ',
|
||||
peer.transport_protocol_type.starts_with('v') == 0 ? peer.transport_protocol_type[1] : ' ',
|
||||
PingTimeToString(peer.min_ping),
|
||||
PingTimeToString(peer.ping),
|
||||
peer.last_send ? ToString(time_now - peer.last_send) : "",
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <chainparams.h>
|
||||
#include <clientversion.h>
|
||||
#include <coins.h>
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <consensus/consensus.h>
|
||||
#include <core_io.h>
|
||||
#include <key_io.h>
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <chainparamsbase.h>
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <logging.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/system.h>
|
||||
|
@ -10,12 +10,12 @@
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <clientversion.h>
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <init.h>
|
||||
#include <interfaces/chain.h>
|
||||
#include <interfaces/init.h>
|
||||
#include <node/context.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <noui.h>
|
||||
#include <shutdown.h>
|
||||
#include <util/check.h>
|
||||
|
@ -8,6 +8,7 @@
|
||||
#ifndef BITCOIN_COMPAT_ASSUMPTIONS_H
|
||||
#define BITCOIN_COMPAT_ASSUMPTIONS_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
|
||||
// Assumption: We assume that the macro NDEBUG is not defined.
|
||||
|
@ -3,24 +3,24 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_COMPAT_H
|
||||
#define BITCOIN_COMPAT_H
|
||||
#ifndef BITCOIN_COMPAT_COMPAT_H
|
||||
#define BITCOIN_COMPAT_COMPAT_H
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include <config/bitcoin-config.h>
|
||||
#endif
|
||||
|
||||
// Windows defines FD_SETSIZE to 64 (see _fd_types.h in mingw-w64),
|
||||
// which is too small for our usage, but allows us to redefine it safely.
|
||||
// We redefine it to be 1024, to match glibc, see typesizes.h.
|
||||
#ifdef WIN32
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#ifdef FD_SETSIZE
|
||||
#undef FD_SETSIZE // prevent redefinition compiler warning
|
||||
#undef FD_SETSIZE
|
||||
#endif
|
||||
#define FD_SETSIZE 1024 // max number of fds in fd_set
|
||||
#define FD_SETSIZE 1024
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
@ -37,54 +37,46 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
// We map Linux / BSD error functions and codes, to the equivalent
|
||||
// Windows definitions, and use the WSA* names throughout our code.
|
||||
// Note that glibc defines EWOULDBLOCK as EAGAIN (see errno.h).
|
||||
#ifndef WIN32
|
||||
typedef unsigned int SOCKET;
|
||||
#include <errno.h>
|
||||
#include <cerrno>
|
||||
#define WSAGetLastError() errno
|
||||
#define WSAEINVAL EINVAL
|
||||
#define WSAEALREADY EALREADY
|
||||
#define WSAEWOULDBLOCK EWOULDBLOCK
|
||||
#define WSAEAGAIN EAGAIN
|
||||
#define WSAEMSGSIZE EMSGSIZE
|
||||
#define WSAEINTR EINTR
|
||||
#define WSAEINPROGRESS EINPROGRESS
|
||||
#define WSAEADDRINUSE EADDRINUSE
|
||||
#define WSAENOTSOCK EBADF
|
||||
#define INVALID_SOCKET (SOCKET)(~0)
|
||||
#define SOCKET_ERROR -1
|
||||
#define SD_SEND SHUT_WR
|
||||
#else
|
||||
#ifndef WSAEAGAIN
|
||||
// WSAEAGAIN doesn't exist on Windows
|
||||
#ifdef EAGAIN
|
||||
#define WSAEAGAIN EAGAIN
|
||||
#else
|
||||
#define WSAEAGAIN WSAEWOULDBLOCK
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef S_IRUSR
|
||||
#define S_IRUSR 0400
|
||||
#define S_IWUSR 0200
|
||||
#endif
|
||||
#else
|
||||
// Windows defines MAX_PATH as it's maximum path length.
|
||||
// We define MAX_PATH for use on non-Windows systems.
|
||||
#ifndef WIN32
|
||||
#define MAX_PATH 1024
|
||||
#endif
|
||||
|
||||
// ssize_t is POSIX, and not present when using MSVC.
|
||||
#ifdef _MSC_VER
|
||||
#if !defined(ssize_t)
|
||||
#ifdef _WIN64
|
||||
typedef int64_t ssize_t;
|
||||
#else
|
||||
typedef int32_t ssize_t;
|
||||
#endif
|
||||
#endif
|
||||
#include <BaseTsd.h>
|
||||
typedef SSIZE_T ssize_t;
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_STRNLEN == 0
|
||||
size_t strnlen( const char *start, size_t max_len);
|
||||
#endif // HAVE_DECL_STRNLEN
|
||||
|
||||
// The type of the option value passed to getsockopt & setsockopt
|
||||
// differs between Windows and non-Windows.
|
||||
#ifndef WIN32
|
||||
typedef void* sockopt_arg_type;
|
||||
#else
|
||||
@ -135,4 +127,4 @@ bool static inline IsSelectableSocket(const SOCKET& s) {
|
||||
#define MSG_DONTWAIT 0
|
||||
#endif
|
||||
|
||||
#endif // BITCOIN_COMPAT_H
|
||||
#endif // BITCOIN_COMPAT_COMPAT_H
|
@ -1,18 +0,0 @@
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include <config/bitcoin-config.h>
|
||||
#endif
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#if HAVE_DECL_STRNLEN == 0
|
||||
size_t strnlen( const char *start, size_t max_len)
|
||||
{
|
||||
const char *end = (const char *)memchr(start, '\0', max_len);
|
||||
|
||||
return end ? (size_t)(end - start) : max_len;
|
||||
}
|
||||
#endif // HAVE_DECL_STRNLEN
|
@ -11,9 +11,6 @@
|
||||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <codecvt>
|
||||
#include <limits>
|
||||
#include <windows.h>
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include <chainparamsbase.h>
|
||||
#include <netbase.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <rpc/protocol.h> // For HTTP status codes
|
||||
#include <shutdown.h>
|
||||
#include <sync.h>
|
||||
|
@ -3,7 +3,7 @@
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <compat/endian.h>
|
||||
#include <crypto/sha256.h>
|
||||
#include <fs.h>
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef BITCOIN_I2P_H
|
||||
#define BITCOIN_I2P_H
|
||||
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <fs.h>
|
||||
#include <netaddress.h>
|
||||
#include <sync.h>
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <chainparams.h>
|
||||
#include <index/base.h>
|
||||
#include <node/blockstorage.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <shutdown.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/thread.h>
|
||||
|
15
src/init.cpp
15
src/init.cpp
@ -39,7 +39,7 @@
|
||||
#include <netgroup.h>
|
||||
#include <node/blockstorage.h>
|
||||
#include <node/context.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <node/txreconciliation.h>
|
||||
#include <policy/feerate.h>
|
||||
#include <policy/fees.h>
|
||||
@ -1441,11 +1441,6 @@ bool AppInitLockDataDirectory()
|
||||
bool AppInitInterfaces(NodeContext& node)
|
||||
{
|
||||
node.chain = interfaces::MakeChain(node);
|
||||
// Create client interfaces for wallets that are supposed to be loaded
|
||||
// according to -wallet and -disablewallet options. This only constructs
|
||||
// the interfaces, it doesn't load wallet data. Wallets actually get loaded
|
||||
// when load() and start() interface methods are called below.
|
||||
g_wallet_init_interface.Construct(node);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1515,11 +1510,17 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
|
||||
GetMainSignals().RegisterBackgroundSignalScheduler(*node.scheduler);
|
||||
|
||||
tableRPC.InitPlatformRestrictions();
|
||||
// Create client interfaces for wallets that are supposed to be loaded
|
||||
// according to -wallet and -disablewallet options. This only constructs
|
||||
// the interfaces, it doesn't load wallet data. Wallets actually get loaded
|
||||
// when load() and start() interface methods are called below.
|
||||
g_wallet_init_interface.Construct(node);
|
||||
uiInterface.InitWallet();
|
||||
|
||||
/* Register RPC commands regardless of -server setting so they will be
|
||||
* available in the GUI RPC console even if external calls are disabled.
|
||||
*/
|
||||
tableRPC.InitPlatformRestrictions();
|
||||
RegisterAllCoreRPCCommands(tableRPC);
|
||||
for (const auto& client : node.chain_clients) {
|
||||
client->registerRpcs();
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <crypto/sha256.h>
|
||||
#include <key.h>
|
||||
#include <logging.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <random.h>
|
||||
#include <util/string.h>
|
||||
#include <util/system.h>
|
||||
|
@ -309,6 +309,10 @@ public:
|
||||
using ShowProgressFn = std::function<void(const std::string& title, int progress, bool resume_possible)>;
|
||||
virtual std::unique_ptr<Handler> handleShowProgress(ShowProgressFn fn) = 0;
|
||||
|
||||
//! Register handler for wallet client constructed messages.
|
||||
using InitWalletFn = std::function<void()>;
|
||||
virtual std::unique_ptr<Handler> handleInitWallet(InitWalletFn fn) = 0;
|
||||
|
||||
//! Register handler for number of connections changed messages.
|
||||
using NotifyNumConnectionsChangedFn = std::function<void(int new_num_connections)>;
|
||||
virtual std::unique_ptr<Handler> handleNotifyNumConnectionsChanged(NotifyNumConnectionsChangedFn fn) = 0;
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <consensus/validation.h>
|
||||
#include <masternode/sync.h>
|
||||
#include <node/blockstorage.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <scheduler.h>
|
||||
#include <spork.h>
|
||||
#include <txmempool.h>
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <util/thread.h>
|
||||
|
||||
#ifdef USE_NATPMP
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <natpmp.h>
|
||||
#endif // USE_NATPMP
|
||||
|
||||
|
@ -8,11 +8,11 @@
|
||||
#include <governance/governance.h>
|
||||
#include <netfulfilledman.h>
|
||||
#include <netmessagemaker.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <shutdown.h>
|
||||
#include <validation.h>
|
||||
#include <util/time.h>
|
||||
#include <util/translation.h>
|
||||
#include <validation.h>
|
||||
|
||||
class CMasternodeSync;
|
||||
|
||||
|
17
src/net.cpp
17
src/net.cpp
@ -15,7 +15,7 @@
|
||||
#include <addrman.h>
|
||||
#include <banman.h>
|
||||
#include <clientversion.h>
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <consensus/consensus.h>
|
||||
#include <crypto/sha256.h>
|
||||
#include <node/eviction.h>
|
||||
@ -25,7 +25,7 @@
|
||||
#include <net_permissions.h>
|
||||
#include <netaddress.h>
|
||||
#include <netbase.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <protocol.h>
|
||||
#include <random.h>
|
||||
#include <scheduler.h>
|
||||
@ -1120,16 +1120,9 @@ constexpr std::array<std::string_view, 256> V2ShortIDs() {
|
||||
static_assert(std::size(V2_DASH_IDS) <= 128);
|
||||
|
||||
std::array<std::string_view, 256> ret{};
|
||||
for (size_t idx{0}; idx < std::size(ret); idx++) {
|
||||
if (idx < 128 && idx < std::size(V2_BITCOIN_IDS)) {
|
||||
ret[idx] = V2_BITCOIN_IDS[idx];
|
||||
} else if (idx >= 128 && idx - 128 < std::size(V2_DASH_IDS)) {
|
||||
ret[idx] = V2_DASH_IDS[idx - 128];
|
||||
} else {
|
||||
ret[idx] = "";
|
||||
}
|
||||
}
|
||||
|
||||
std::fill(ret.begin(), ret.end(), "");
|
||||
std::copy(V2_BITCOIN_IDS.begin(), V2_BITCOIN_IDS.end(), ret.begin());
|
||||
std::copy(V2_DASH_IDS.begin(), V2_DASH_IDS.end(), ret.begin() + 128);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <bip324.h>
|
||||
#include <chainparams.h>
|
||||
#include <common/bloom.h>
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <consensus/amount.h>
|
||||
#include <fs.h>
|
||||
#include <crypto/siphash.h>
|
||||
|
@ -10,7 +10,7 @@
|
||||
#endif
|
||||
|
||||
#include <attributes.h>
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <crypto/siphash.h>
|
||||
#include <prevector.h>
|
||||
#include <random.h>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include <netbase.h>
|
||||
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <sync.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/sock.h>
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <config/bitcoin-config.h>
|
||||
#endif
|
||||
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <netaddress.h>
|
||||
#include <serialize.h>
|
||||
#include <util/sock.h>
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
|
||||
#include <util/translation.h>
|
||||
|
||||
@ -15,6 +15,7 @@ struct UISignals {
|
||||
boost::signals2::signal<CClientUIInterface::ThreadSafeMessageBoxSig, boost::signals2::optional_last_value<bool>> ThreadSafeMessageBox;
|
||||
boost::signals2::signal<CClientUIInterface::ThreadSafeQuestionSig, boost::signals2::optional_last_value<bool>> ThreadSafeQuestion;
|
||||
boost::signals2::signal<CClientUIInterface::InitMessageSig> InitMessage;
|
||||
boost::signals2::signal<CClientUIInterface::InitWalletSig> InitWallet;
|
||||
boost::signals2::signal<CClientUIInterface::NotifyNumConnectionsChangedSig> NotifyNumConnectionsChanged;
|
||||
boost::signals2::signal<CClientUIInterface::NotifyNetworkActiveChangedSig> NotifyNetworkActiveChanged;
|
||||
boost::signals2::signal<CClientUIInterface::NotifyAlertChangedSig> NotifyAlertChanged;
|
||||
@ -37,6 +38,7 @@ static UISignals g_ui_signals;
|
||||
ADD_SIGNALS_IMPL_WRAPPER(ThreadSafeMessageBox);
|
||||
ADD_SIGNALS_IMPL_WRAPPER(ThreadSafeQuestion);
|
||||
ADD_SIGNALS_IMPL_WRAPPER(InitMessage);
|
||||
ADD_SIGNALS_IMPL_WRAPPER(InitWallet);
|
||||
ADD_SIGNALS_IMPL_WRAPPER(NotifyNumConnectionsChanged);
|
||||
ADD_SIGNALS_IMPL_WRAPPER(NotifyNetworkActiveChanged);
|
||||
ADD_SIGNALS_IMPL_WRAPPER(NotifyAlertChanged);
|
||||
@ -51,6 +53,7 @@ ADD_SIGNALS_IMPL_WRAPPER(BannedListChanged);
|
||||
bool CClientUIInterface::ThreadSafeMessageBox(const bilingual_str& message, const std::string& caption, unsigned int style) { return g_ui_signals.ThreadSafeMessageBox(message, caption, style).value_or(false);}
|
||||
bool CClientUIInterface::ThreadSafeQuestion(const bilingual_str& message, const std::string& non_interactive_message, const std::string& caption, unsigned int style) { return g_ui_signals.ThreadSafeQuestion(message, non_interactive_message, caption, style).value_or(false);}
|
||||
void CClientUIInterface::InitMessage(const std::string& message) { return g_ui_signals.InitMessage(message); }
|
||||
void CClientUIInterface::InitWallet() { return g_ui_signals.InitWallet(); }
|
||||
void CClientUIInterface::NotifyNumConnectionsChanged(int newNumConnections) { return g_ui_signals.NotifyNumConnectionsChanged(newNumConnections); }
|
||||
void CClientUIInterface::NotifyNetworkActiveChanged(bool networkActive) { return g_ui_signals.NotifyNetworkActiveChanged(networkActive); }
|
||||
void CClientUIInterface::NotifyAlertChanged() { return g_ui_signals.NotifyAlertChanged(); }
|
@ -3,8 +3,8 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_NODE_UI_INTERFACE_H
|
||||
#define BITCOIN_NODE_UI_INTERFACE_H
|
||||
#ifndef BITCOIN_NODE_INTERFACE_UI_H
|
||||
#define BITCOIN_NODE_INTERFACE_UI_H
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
@ -83,6 +83,9 @@ public:
|
||||
/** Progress message during initialization. */
|
||||
ADD_SIGNALS_DECL_WRAPPER(InitMessage, void, const std::string& message);
|
||||
|
||||
/** Wallet client created. */
|
||||
ADD_SIGNALS_DECL_WRAPPER(InitWallet, void, );
|
||||
|
||||
/** Number of network connections changed. */
|
||||
ADD_SIGNALS_DECL_WRAPPER(NotifyNumConnectionsChanged, void, int newNumConnections);
|
||||
|
||||
@ -128,4 +131,4 @@ constexpr auto AbortError = InitError;
|
||||
|
||||
extern CClientUIInterface uiInterface;
|
||||
|
||||
#endif // BITCOIN_NODE_UI_INTERFACE_H
|
||||
#endif // BITCOIN_NODE_INTERFACE_UI_H
|
@ -30,7 +30,7 @@
|
||||
#include <node/blockstorage.h>
|
||||
#include <node/coin.h>
|
||||
#include <node/context.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <node/transaction.h>
|
||||
#include <policy/feerate.h>
|
||||
#include <policy/fees.h>
|
||||
@ -527,6 +527,10 @@ public:
|
||||
{
|
||||
return MakeHandler(::uiInterface.ShowProgress_connect(fn));
|
||||
}
|
||||
std::unique_ptr<Handler> handleInitWallet(InitWalletFn fn) override
|
||||
{
|
||||
return MakeHandler(::uiInterface.InitWallet_connect(fn));
|
||||
}
|
||||
std::unique_ptr<Handler> handleNotifyNumConnectionsChanged(NotifyNumConnectionsChangedFn fn) override
|
||||
{
|
||||
return MakeHandler(::uiInterface.NotifyNumConnectionsChanged_connect(fn));
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <noui.h>
|
||||
|
||||
#include <logging.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <string>
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <interfaces/node.h>
|
||||
#include <net.h>
|
||||
#include <node/context.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <noui.h>
|
||||
#include <qt/bitcoingui.h>
|
||||
#include <qt/clientmodel.h>
|
||||
@ -262,7 +262,6 @@ void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle)
|
||||
// We don't hold a direct pointer to the splash screen after creation, but the splash
|
||||
// screen will take care of deleting itself when finish() happens.
|
||||
m_splash->show();
|
||||
connect(this, &BitcoinApplication::requestedInitialize, m_splash, &SplashScreen::handleLoadWallet);
|
||||
connect(this, &BitcoinApplication::splashFinished, m_splash, &SplashScreen::finish);
|
||||
connect(this, &BitcoinApplication::requestedShutdown, m_splash, &QWidget::close);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <interfaces/coinjoin.h>
|
||||
#include <interfaces/handler.h>
|
||||
#include <interfaces/node.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <qt/governancelist.h>
|
||||
#include <qt/masternodelist.h>
|
||||
#include <util/system.h>
|
||||
|
@ -29,9 +29,6 @@
|
||||
#include <cmath>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <shellapi.h>
|
||||
#include <shlobj.h>
|
||||
#include <shlwapi.h>
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <qt/bitcoin.h>
|
||||
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <util/translation.h>
|
||||
#include <util/url.h>
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <clientversion.h>
|
||||
#include <interfaces/node.h>
|
||||
#include <key_io.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <policy/policy.h>
|
||||
#include <util/system.h>
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <chainparams.h>
|
||||
#include <interfaces/node.h>
|
||||
#include <key_io.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <policy/fees.h>
|
||||
#include <txmempool.h>
|
||||
#include <wallet/coincontrol.h>
|
||||
|
@ -199,6 +199,7 @@ void SplashScreen::subscribeToCoreSignals()
|
||||
// Connect signals to client
|
||||
m_handler_init_message = m_node->handleInitMessage(std::bind(InitMessage, this, std::placeholders::_1));
|
||||
m_handler_show_progress = m_node->handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
m_handler_init_wallet = m_node->handleInitWallet([this]() { handleLoadWallet(); });
|
||||
}
|
||||
|
||||
void SplashScreen::handleLoadWallet()
|
||||
|
@ -66,6 +66,7 @@ private:
|
||||
bool m_shutdown = false;
|
||||
std::unique_ptr<interfaces::Handler> m_handler_init_message;
|
||||
std::unique_ptr<interfaces::Handler> m_handler_show_progress;
|
||||
std::unique_ptr<interfaces::Handler> m_handler_init_wallet;
|
||||
std::unique_ptr<interfaces::Handler> m_handler_load_wallet;
|
||||
std::list<std::unique_ptr<interfaces::Wallet>> m_connected_wallets;
|
||||
std::list<std::unique_ptr<interfaces::Handler>> m_connected_wallet_handlers;
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <qt/walletmodel.h>
|
||||
|
||||
#include <interfaces/node.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
|
||||
#include <optional>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <qt/walletframe.h>
|
||||
|
||||
#include <fs.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <psbt.h>
|
||||
#include <qt/governancelist.h>
|
||||
#include <qt/guiutil.h>
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <interfaces/handler.h>
|
||||
#include <interfaces/node.h>
|
||||
#include <key_io.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <psbt.h>
|
||||
#include <util/system.h> // for GetBoolArg
|
||||
#include <util/translation.h>
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <qt/walletmodel.h>
|
||||
|
||||
#include <interfaces/node.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <util/strencodings.h>
|
||||
|
||||
#include <QAction>
|
||||
|
@ -9,24 +9,23 @@
|
||||
#include <crypto/chacha20.h>
|
||||
#include <crypto/sha256.h>
|
||||
#include <crypto/sha512.h>
|
||||
#include <support/cleanse.h>
|
||||
#ifdef WIN32
|
||||
#include <compat.h> // for Windows API
|
||||
#include <wincrypt.h>
|
||||
#endif
|
||||
#include <logging.h>
|
||||
#include <randomenv.h>
|
||||
#include <support/allocators/secure.h>
|
||||
#include <span.h>
|
||||
#include <sync.h> // for Mutex
|
||||
#include <util/time.h> // for GetTimeMicros()
|
||||
#include <support/allocators/secure.h>
|
||||
#include <support/cleanse.h>
|
||||
#include <sync.h>
|
||||
#include <util/time.h>
|
||||
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <stdlib.h>
|
||||
#include <thread>
|
||||
|
||||
#ifndef WIN32
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
@ -729,7 +728,7 @@ bool Random_SanityCheck()
|
||||
* GetOSRand() overwrites all 32 bytes of the output given a maximum
|
||||
* number of tries.
|
||||
*/
|
||||
static const ssize_t MAX_TRIES = 1024;
|
||||
static constexpr int MAX_TRIES{1024};
|
||||
uint8_t data[NUM_OS_RANDOM_BYTES];
|
||||
bool overwritten[NUM_OS_RANDOM_BYTES] = {}; /* Tracks which bytes have been overwritten at least once */
|
||||
int num_overwritten;
|
||||
|
@ -14,22 +14,23 @@
|
||||
#include <crypto/sha512.h>
|
||||
#include <span.h>
|
||||
#include <support/cleanse.h>
|
||||
#include <util/time.h> // for GetTime()
|
||||
#ifdef WIN32
|
||||
#include <compat.h> // for Windows API
|
||||
#endif
|
||||
#include <util/time.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <chrono>
|
||||
#include <climits>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/types.h> // must go before a number of other headers
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#include <winreg.h>
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/resource.h>
|
||||
|
@ -365,6 +365,7 @@ static RPCHelpMan coinjoinsalt_set()
|
||||
}
|
||||
#endif // ENABLE_WALLET
|
||||
|
||||
// TODO: remove it completely
|
||||
static RPCHelpMan getpoolinfo()
|
||||
{
|
||||
return RPCHelpMan{"getpoolinfo",
|
||||
@ -469,7 +470,6 @@ void RegisterCoinJoinRPCCommands(CRPCTable &t)
|
||||
static const CRPCCommand commands[] =
|
||||
{ // category actor (function)
|
||||
// --------------------- -----------------------
|
||||
{ "dash", &getpoolinfo, },
|
||||
{ "dash", &getcoinjoininfo, },
|
||||
#ifdef ENABLE_WALLET
|
||||
{ "dash", &coinjoin, },
|
||||
@ -480,6 +480,8 @@ static const CRPCCommand commands[] =
|
||||
{ "dash", &coinjoinsalt_generate, },
|
||||
{ "dash", &coinjoinsalt_get, },
|
||||
{ "dash", &coinjoinsalt_set, },
|
||||
|
||||
{ "hidden", &getpoolinfo, },
|
||||
#endif // ENABLE_WALLET
|
||||
};
|
||||
// clang-format on
|
||||
|
@ -134,6 +134,7 @@ static UniValue GetNextMasternodeForPayment(const CChain& active_chain, CDetermi
|
||||
return obj;
|
||||
}
|
||||
|
||||
// TODO: drop it
|
||||
static RPCHelpMan masternode_winner()
|
||||
{
|
||||
return RPCHelpMan{"masternode winner",
|
||||
@ -154,6 +155,7 @@ static RPCHelpMan masternode_winner()
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: drop it
|
||||
static RPCHelpMan masternode_current()
|
||||
{
|
||||
return RPCHelpMan{"masternode current",
|
||||
@ -227,7 +229,7 @@ static RPCHelpMan masternode_status()
|
||||
}
|
||||
|
||||
UniValue mnObj(UniValue::VOBJ);
|
||||
// keep compatibility with legacy status for now (might get deprecated/removed later)
|
||||
// keep compatibility with legacy status for now (TODO: get deprecated/removed later)
|
||||
mnObj.pushKV("outpoint", node.mn_activeman->GetOutPoint().ToStringShort());
|
||||
mnObj.pushKV("service", node.mn_activeman->GetService().ToStringAddrPort());
|
||||
auto dmn = CHECK_NONFATAL(node.dmnman)->GetListAtChainTip().GetMN(node.mn_activeman->GetProTxHash());
|
||||
@ -750,8 +752,8 @@ static const CRPCCommand commands[] =
|
||||
{ "dash", &masternode_status, },
|
||||
{ "dash", &masternode_payments, },
|
||||
{ "dash", &masternode_winners, },
|
||||
{ "dash", &masternode_current, },
|
||||
{ "dash", &masternode_winner, },
|
||||
{ "hidden", &masternode_current, },
|
||||
{ "hidden", &masternode_winner, },
|
||||
};
|
||||
// clang-format on
|
||||
for (const auto& command : commands) {
|
||||
|
@ -241,7 +241,7 @@ static RPCHelpMan getpeerinfo()
|
||||
obj.pushKV("masternode", stats.m_masternode_connection);
|
||||
if (fStateStats) {
|
||||
if (IsDeprecatedRPCEnabled("banscore")) {
|
||||
// banscore is deprecated in v21 for removal in v22
|
||||
// TODO: banscore is deprecated in v21 for removal in v22, maybe impossible due to usages in p2p_quorum_data.py
|
||||
obj.pushKV("banscore", statestats.m_misbehavior_score);
|
||||
}
|
||||
obj.pushKV("startingheight", statestats.m_starting_height);
|
||||
@ -1126,10 +1126,10 @@ static const CRPCCommand commands[] =
|
||||
{ "network", &setban, },
|
||||
{ "network", &listbanned, },
|
||||
{ "network", &clearbanned, },
|
||||
{ "network", &cleardiscouraged, },
|
||||
{ "network", &setnetworkactive, },
|
||||
{ "network", &getnodeaddresses, },
|
||||
|
||||
{ "hidden", &cleardiscouraged, },
|
||||
{ "hidden", &addconnection, },
|
||||
{ "hidden", &addpeeraddress, },
|
||||
{ "hidden", &sendmsgtopeer },
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <logging.h>
|
||||
#include <util/tokenpipe.h>
|
||||
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <warnings.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef BITCOIN_STATS_RAWSENDER_H
|
||||
#define BITCOIN_STATS_RAWSENDER_H
|
||||
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <sync.h>
|
||||
#include <threadinterrupt.h>
|
||||
|
||||
|
@ -10,9 +10,6 @@
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/mman.h> // for mmap
|
||||
|
@ -450,6 +450,8 @@ BOOST_AUTO_TEST_CASE(DoS_bantime)
|
||||
peerLogic->Misbehaving(dummyNode.GetId(), DISCOURAGEMENT_THRESHOLD);
|
||||
BOOST_CHECK(peerLogic->SendMessages(&dummyNode));
|
||||
BOOST_CHECK(banman->IsDiscouraged(addr));
|
||||
banman->ClearDiscouraged();
|
||||
BOOST_CHECK(!banman->IsDiscouraged(addr));
|
||||
|
||||
peerLogic->FinalizeNode(dummyNode);
|
||||
}
|
||||
|
@ -357,9 +357,7 @@ FUZZ_TARGET_INIT(rpc, initialize_rpc)
|
||||
rpc_testing_setup->CallRPC(rpc_command, arguments);
|
||||
} catch (const UniValue& json_rpc_error) {
|
||||
const std::string error_msg{find_value(json_rpc_error, "message").get_str()};
|
||||
// Once c++20 is allowed, starts_with can be used.
|
||||
// if (error_msg.starts_with("Internal bug detected")) {
|
||||
if (0 == error_msg.rfind("Internal bug detected", 0)) {
|
||||
if (error_msg.starts_with("Internal bug detected")) {
|
||||
// Only allow the intentional internal bug
|
||||
assert(error_msg.find("trigger_internal_bug") != std::string::npos);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <attributes.h>
|
||||
#include <chainparamsbase.h>
|
||||
#include <coins.h>
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <consensus/amount.h>
|
||||
#include <consensus/consensus.h>
|
||||
#include <key.h>
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <netaddress.h>
|
||||
#include <test/fuzz/FuzzedDataProvider.h>
|
||||
#include <util/strencodings.h>
|
||||
|
@ -3,7 +3,7 @@
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <net.h>
|
||||
#include <net_processing.h>
|
||||
#include <netaddress.h>
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <clientversion.h>
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <net.h>
|
||||
#include <net_processing.h>
|
||||
#include <netaddress.h>
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <threadinterrupt.h>
|
||||
#include <util/sock.h>
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef BITCOIN_TEST_UTIL_NET_H
|
||||
#define BITCOIN_TEST_UTIL_NET_H
|
||||
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <net.h>
|
||||
#include <net_permissions.h>
|
||||
#include <net_processing.h>
|
||||
|
@ -37,9 +37,11 @@
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <timedata.h>
|
||||
|
||||
#include <netaddress.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <sync.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/system.h>
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <chainparamsbase.h>
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <crypto/hmac_sha256.h>
|
||||
#include <net.h>
|
||||
#include <netaddress.h>
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <txdb.h>
|
||||
|
||||
#include <chain.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <pow.h>
|
||||
#include <random.h>
|
||||
#include <shutdown.h>
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef BITCOIN_UTIL_EDGE_H
|
||||
#define BITCOIN_UTIL_EDGE_H
|
||||
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <cstdint>
|
||||
|
@ -5,40 +5,20 @@
|
||||
#ifndef BITCOIN_UTIL_RANGES_H
|
||||
#define BITCOIN_UTIL_RANGES_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <ranges>
|
||||
#include <optional>
|
||||
|
||||
//#if __cplusplus > 201703L // C++20 compiler
|
||||
//namespace ranges = std::ranges;
|
||||
//#else
|
||||
|
||||
#define MK_RANGE(FUN) \
|
||||
template <typename X, typename Z> \
|
||||
inline auto FUN(const X& ds, const Z& fn) { \
|
||||
return std::FUN(cbegin(ds), cend(ds), fn); \
|
||||
} \
|
||||
template <typename X, typename Z> \
|
||||
inline auto FUN(X& ds, const Z& fn) { \
|
||||
return std::FUN(begin(ds), end(ds), fn); \
|
||||
}
|
||||
|
||||
|
||||
namespace ranges {
|
||||
MK_RANGE(all_of)
|
||||
MK_RANGE(any_of)
|
||||
MK_RANGE(count_if)
|
||||
MK_RANGE(find_if)
|
||||
using namespace std::ranges;
|
||||
|
||||
template <typename X, typename Z>
|
||||
constexpr inline auto find_if_opt(const X& ds, const Z& fn) {
|
||||
const auto it = ranges::find_if(ds, fn);
|
||||
if (it != end(ds)) {
|
||||
return std::make_optional(*it);
|
||||
}
|
||||
return std::optional<std::decay_t<decltype(*it)>>{};
|
||||
template <typename X, typename Z>
|
||||
constexpr inline auto find_if_opt(const X& ds, const Z& fn) {
|
||||
const auto it = std::ranges::find_if(ds, fn);
|
||||
if (it != std::end(ds)) {
|
||||
return std::make_optional(*it);
|
||||
}
|
||||
|
||||
return std::optional<std::decay_t<decltype(*it)>>{};
|
||||
}
|
||||
}
|
||||
|
||||
//#endif // C++20 compiler
|
||||
#endif // BITCOIN_UTIL_RANGES_H
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <logging.h>
|
||||
#include <threadinterrupt.h>
|
||||
#include <tinyformat.h>
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef BITCOIN_UTIL_SOCK_H
|
||||
#define BITCOIN_UTIL_SOCK_H
|
||||
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <threadinterrupt.h>
|
||||
#include <util/time.h>
|
||||
|
||||
|
@ -60,9 +60,6 @@
|
||||
#pragma warning(disable:4717)
|
||||
#endif
|
||||
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <codecvt>
|
||||
|
||||
#include <io.h> /* for _commit */
|
||||
|
@ -16,8 +16,8 @@
|
||||
#endif
|
||||
|
||||
#include <attributes.h>
|
||||
#include <compat.h>
|
||||
#include <compat/assumptions.h>
|
||||
#include <compat/compat.h>
|
||||
#include <consensus/amount.h>
|
||||
#include <fs.h>
|
||||
#include <logging.h>
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <config/bitcoin-config.h>
|
||||
#endif
|
||||
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
#include <util/time.h>
|
||||
|
||||
#include <util/check.h>
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef BITCOIN_UTIL_TIME_H
|
||||
#define BITCOIN_UTIL_TIME_H
|
||||
|
||||
#include <compat.h>
|
||||
#include <compat/compat.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <stdint.h>
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <logging/timer.h>
|
||||
#include <node/blockstorage.h>
|
||||
#include <node/coinstats.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <node/utxo_snapshot.h>
|
||||
#include <policy/policy.h>
|
||||
#include <policy/settings.h>
|
||||
|
@ -3,6 +3,7 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <compat/compat.h>
|
||||
#include <fs.h>
|
||||
#include <wallet/bdb.h>
|
||||
#include <wallet/db.h>
|
||||
@ -12,8 +13,15 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/stat.h>
|
||||
|
||||
// Windows may not define S_IRUSR or S_IWUSR. We define both
|
||||
// here, with the same values as glibc (see stat.h).
|
||||
#ifdef WIN32
|
||||
#ifndef S_IRUSR
|
||||
#define S_IRUSR 0400
|
||||
#define S_IWUSR 0200
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <interfaces/wallet.h>
|
||||
#include <net.h>
|
||||
#include <node/context.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <univalue.h>
|
||||
#include <util/check.h>
|
||||
#include <util/error.h>
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <policy/settings.h>
|
||||
#include <primitives/block.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <reverse_iterator.h>
|
||||
#include <script/descriptor.h>
|
||||
#include <script/script.h>
|
||||
#include <script/sign.h>
|
||||
@ -5324,44 +5325,29 @@ bool CWallet::AutoBackupWallet(const fs::path& wallet_path, bilingual_str& error
|
||||
}
|
||||
|
||||
// Keep only the last 10 backups, including the new one of course
|
||||
typedef std::multimap<std::time_t, fs::path> folder_set_t;
|
||||
folder_set_t folder_set;
|
||||
fs::directory_iterator end_iter;
|
||||
std::multimap<fs::file_time_type, fs::path> folder_set;
|
||||
// Build map of backup files for current(!) wallet sorted by last write time
|
||||
fs::path currentFile;
|
||||
for (fs::directory_iterator dir_iter(backupsDir); dir_iter != end_iter; ++dir_iter)
|
||||
{
|
||||
for (const auto& entry : fs::directory_iterator(backupsDir)) {
|
||||
// Only check regular files
|
||||
if ( fs::is_regular_file(dir_iter->status()))
|
||||
{
|
||||
currentFile = dir_iter->path().filename();
|
||||
if (entry.is_regular_file()) {
|
||||
currentFile = entry.path().filename();
|
||||
// Only add the backups for the current wallet, e.g. wallet.dat.*
|
||||
if (fs::PathToString(dir_iter->path().stem()) == strWalletName) {
|
||||
folder_set.insert(folder_set_t::value_type(
|
||||
// TODO: C++17 compliant time conversion code is abominable, switch to C++20
|
||||
// compliant code when C++17 support is dropped
|
||||
std::chrono::system_clock::to_time_t(
|
||||
std::chrono::time_point_cast<std::chrono::system_clock::duration>(
|
||||
fs::last_write_time(dir_iter->path()) - fs::file_time_type::clock::now() + std::chrono::system_clock::now()
|
||||
)
|
||||
),
|
||||
*dir_iter
|
||||
));
|
||||
if (fs::PathToString(entry.path().stem()) == strWalletName) {
|
||||
folder_set.insert(decltype(folder_set)::value_type(fs::last_write_time(entry.path()), entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Loop backward through backup files and keep the N newest ones (1 <= N <= 10)
|
||||
int counter = 0;
|
||||
for(auto it = folder_set.rbegin(); it != folder_set.rend(); ++it) {
|
||||
std::pair<const std::time_t, fs::path> file = *it;
|
||||
int counter{0};
|
||||
for (const auto& [entry_time, entry] : reverse_iterate(folder_set)) {
|
||||
counter++;
|
||||
if (counter > nWalletBackups)
|
||||
{
|
||||
if (counter > nWalletBackups) {
|
||||
// More than nWalletBackups backups: delete oldest one(s)
|
||||
try {
|
||||
fs::remove(file.second);
|
||||
WalletLogPrintf("Old backup deleted: %s\n", fs::PathToString(file.second));
|
||||
fs::remove(entry);
|
||||
WalletLogPrintf("Old backup deleted: %s\n", fs::PathToString(entry));
|
||||
} catch(fs::filesystem_error &error) {
|
||||
warnings.push_back(strprintf(_("Failed to delete backup, error: %s"), fsbridge::get_filesystem_error_message(error)));
|
||||
WalletLogPrintf("%s\n", Join(warnings, Untranslated("\n")).original);
|
||||
|
@ -9,6 +9,7 @@ Test the following RPCs:
|
||||
- getchaintxstats
|
||||
- gettxoutsetinfo
|
||||
- getblockheader
|
||||
- getblockheaders
|
||||
- getdifficulty
|
||||
- getnetworkhashps
|
||||
- waitforblockheight
|
||||
@ -76,7 +77,8 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
self._test_getblockchaininfo()
|
||||
self._test_getchaintxstats()
|
||||
self._test_gettxoutsetinfo()
|
||||
self._test_getblockheader()
|
||||
self._test_getblockheader(rpc_name='getblockheader')
|
||||
self._test_getblockheader(rpc_name='getblockheaders')
|
||||
self._test_getdifficulty()
|
||||
self._test_getnetworkhashps()
|
||||
self._test_stopatheight()
|
||||
@ -319,17 +321,20 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
# Unknown hash_type raises an error
|
||||
assert_raises_rpc_error(-8, "'foo hash' is not a valid hash_type", node.gettxoutsetinfo, "foo hash")
|
||||
|
||||
def _test_getblockheader(self):
|
||||
self.log.info("Test getblockheader")
|
||||
def _test_getblockheader(self, rpc_name):
|
||||
self.log.info(f"Test {rpc_name}")
|
||||
node = self.nodes[0]
|
||||
|
||||
assert_raises_rpc_error(-8, "hash must be of length 64 (not 8, for 'nonsense')", node.getblockheader, "nonsense")
|
||||
assert_raises_rpc_error(-8, "hash must be hexadecimal string (not 'ZZZ7bb8b1697ea987f3b223ba7819250cae33efacb068d23dc24859824a77844')", node.getblockheader, "ZZZ7bb8b1697ea987f3b223ba7819250cae33efacb068d23dc24859824a77844")
|
||||
assert_raises_rpc_error(-5, "Block not found", node.getblockheader, "0cf7bb8b1697ea987f3b223ba7819250cae33efacb068d23dc24859824a77844")
|
||||
rpc_call = getattr(node, rpc_name)
|
||||
assert_raises_rpc_error(-8, "hash must be of length 64 (not 8, for 'nonsense')", rpc_call, "nonsense")
|
||||
assert_raises_rpc_error(-8, "hash must be hexadecimal string (not 'ZZZ7bb8b1697ea987f3b223ba7819250cae33efacb068d23dc24859824a77844')", rpc_call, "ZZZ7bb8b1697ea987f3b223ba7819250cae33efacb068d23dc24859824a77844")
|
||||
assert_raises_rpc_error(-5, "Block not found", rpc_call, "0cf7bb8b1697ea987f3b223ba7819250cae33efacb068d23dc24859824a77844")
|
||||
|
||||
besthash = node.getbestblockhash()
|
||||
secondbesthash = node.getblockhash(HEIGHT - 1)
|
||||
header = node.getblockheader(blockhash=besthash)
|
||||
header = rpc_call(blockhash=besthash)
|
||||
if rpc_name == 'getblockheaders':
|
||||
assert_equal(len(header), 1)
|
||||
header = header[0]
|
||||
|
||||
assert_equal(header['hash'], besthash)
|
||||
assert_equal(header['height'], HEIGHT)
|
||||
@ -349,15 +354,19 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
assert isinstance(header['difficulty'], Decimal)
|
||||
|
||||
# Test with verbose=False, which should return the header as hex.
|
||||
header_hex = node.getblockheader(blockhash=besthash, verbose=False)
|
||||
header_hex = rpc_call(blockhash=besthash, verbose=False)
|
||||
if rpc_name == 'getblockheaders':
|
||||
header_hex = header_hex[0]
|
||||
|
||||
assert_is_hex_string(header_hex)
|
||||
|
||||
header = from_hex(CBlockHeader(), header_hex)
|
||||
header.calc_sha256()
|
||||
assert_equal(header.hash, besthash)
|
||||
|
||||
assert 'previousblockhash' not in node.getblockheader(node.getblockhash(0))
|
||||
assert 'nextblockhash' not in node.getblockheader(node.getbestblockhash())
|
||||
if rpc_name == 'getblockheader':
|
||||
assert 'previousblockhash' not in node.getblockheader(node.getblockhash(0))
|
||||
assert 'nextblockhash' not in node.getblockheader(node.getbestblockhash())
|
||||
|
||||
def _test_getdifficulty(self):
|
||||
self.log.info("Test getdifficulty")
|
||||
|
@ -39,7 +39,6 @@ from http import HTTPStatus
|
||||
import http.client
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import socket
|
||||
import time
|
||||
import urllib.parse
|
||||
@ -101,11 +100,6 @@ class AuthServiceProxy():
|
||||
'User-Agent': USER_AGENT,
|
||||
'Authorization': self.__auth_header,
|
||||
'Content-type': 'application/json'}
|
||||
if os.name == 'nt':
|
||||
# Windows somehow does not like to re-use connections
|
||||
# TODO: Find out why the connection would disconnect occasionally and make it reusable on Windows
|
||||
# Avoid "ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine"
|
||||
self._set_conn()
|
||||
try:
|
||||
self.__conn.request(method, path, postdata, headers)
|
||||
return self._get_response()
|
||||
@ -116,10 +110,8 @@ class AuthServiceProxy():
|
||||
self.__conn.request(method, path, postdata, headers)
|
||||
return self._get_response()
|
||||
except OSError as e:
|
||||
retry = (
|
||||
'[WinError 10053] An established connection was aborted by the software in your host machine' in str(e))
|
||||
# Workaround for a bug on macOS. See https://bugs.python.org/issue33450
|
||||
retry = retry or ('[Errno 41] Protocol wrong type for socket' in str(e))
|
||||
retry = '[Errno 41] Protocol wrong type for socket' in str(e)
|
||||
if retry:
|
||||
self.__conn.close()
|
||||
self.__conn.request(method, path, postdata, headers)
|
||||
|
@ -892,6 +892,14 @@ class RPCCoverage():
|
||||
# Consider RPC generate covered, because it is overloaded in
|
||||
# test_framework/test_node.py and not seen by the coverage check.
|
||||
covered_cmds = set({'generate'})
|
||||
# TODO: implement functional tests for coinjoinsalt
|
||||
covered_cmds.add('coinjoinsalt')
|
||||
# TODO: implement functional tests for voteraw
|
||||
covered_cmds.add('voteraw')
|
||||
# TODO: implement functional tests for getmerkleblocks
|
||||
covered_cmds.add('getmerkleblocks')
|
||||
# TODO: drop it with v23+: remove `debug` in favour of `logging`
|
||||
covered_cmds.add('debug')
|
||||
|
||||
if not os.path.isfile(coverage_ref_filename):
|
||||
raise RuntimeError("No coverage reference found")
|
||||
|
Loading…
Reference in New Issue
Block a user