mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Compare commits
43 Commits
b9f358defc
...
c164096a55
Author | SHA1 | Date | |
---|---|---|---|
|
c164096a55 | ||
|
7530f3d245 | ||
|
5bf0409eba | ||
|
a9cfd39390 | ||
|
0968a0023b | ||
|
04ce1fea52 | ||
|
16c2e13fb4 | ||
|
a1b256b06f | ||
|
c6dd3dd567 | ||
|
ff29c62103 | ||
|
27d9763b1b | ||
|
26cc5a1c90 | ||
|
d0131a5259 | ||
|
4f1b5c165b | ||
|
a49162ffae | ||
|
8dd0db7de9 | ||
|
187fe17650 | ||
|
eef863554a | ||
|
e7702292d1 | ||
|
b7099eed47 | ||
|
64cdc42130 | ||
|
440fd3fe21 | ||
|
3931608858 | ||
|
f147373a32 | ||
|
2a2a2693d0 | ||
|
11eeae2ab9 | ||
|
f16265dd50 | ||
|
b212ca0515 | ||
|
66e77f7879 | ||
|
995cae46af | ||
|
61a0140362 | ||
|
86c88977ba | ||
|
a34937df51 | ||
|
d00f8a1316 | ||
|
3910a7547f | ||
|
67b0621edf | ||
|
d85003a7af | ||
|
a1becc2ef3 | ||
|
d2a2713ceb | ||
|
b112911d6c | ||
|
8283396d4c | ||
|
9d8fa38965 | ||
|
1a630ba785 |
12
.github/workflows/build.yml
vendored
12
.github/workflows/build.yml
vendored
@ -114,22 +114,22 @@ jobs:
|
|||||||
- build_target: linux64
|
- build_target: linux64
|
||||||
host: x86_64-pc-linux-gnu
|
host: x86_64-pc-linux-gnu
|
||||||
depends_on: linux64
|
depends_on: linux64
|
||||||
- build_target: linux64_tsan
|
- build_target: linux64_cxx20
|
||||||
host: x86_64-pc-linux-gnu
|
|
||||||
depends_on: linux64
|
|
||||||
- build_target: linux64_ubsan
|
|
||||||
host: x86_64-pc-linux-gnu
|
host: x86_64-pc-linux-gnu
|
||||||
depends_on: linux64
|
depends_on: linux64
|
||||||
- build_target: linux64_fuzz
|
- build_target: linux64_fuzz
|
||||||
host: x86_64-pc-linux-gnu
|
host: x86_64-pc-linux-gnu
|
||||||
depends_on: linux64
|
depends_on: linux64
|
||||||
- build_target: linux64_cxx20
|
- build_target: linux64_nowallet
|
||||||
host: x86_64-pc-linux-gnu
|
host: x86_64-pc-linux-gnu
|
||||||
depends_on: linux64
|
depends_on: linux64
|
||||||
- build_target: linux64_sqlite
|
- build_target: linux64_sqlite
|
||||||
host: x86_64-pc-linux-gnu
|
host: x86_64-pc-linux-gnu
|
||||||
depends_on: linux64
|
depends_on: linux64
|
||||||
- build_target: linux64_nowallet
|
- build_target: linux64_tsan
|
||||||
|
host: x86_64-pc-linux-gnu
|
||||||
|
depends_on: linux64
|
||||||
|
- build_target: linux64_ubsan
|
||||||
host: x86_64-pc-linux-gnu
|
host: x86_64-pc-linux-gnu
|
||||||
depends_on: linux64
|
depends_on: linux64
|
||||||
container:
|
container:
|
||||||
|
@ -40,26 +40,11 @@ builder-image:
|
|||||||
needs:
|
needs:
|
||||||
- builder-image
|
- builder-image
|
||||||
image: $CI_REGISTRY_IMAGE:builder-$CI_COMMIT_REF_SLUG
|
image: $CI_REGISTRY_IMAGE:builder-$CI_COMMIT_REF_SLUG
|
||||||
variables:
|
|
||||||
SDK_URL: https://bitcoincore.org/depends-sources/sdks
|
|
||||||
XCODE_VERSION: "15.0"
|
|
||||||
XCODE_BUILD_ID: 15A240d
|
|
||||||
before_script:
|
before_script:
|
||||||
- echo HOST=$HOST
|
|
||||||
- |
|
- |
|
||||||
if [ "$HOST" = "x86_64-apple-darwin" ]; then
|
echo HOST=${HOST}
|
||||||
mkdir -p depends/SDKs
|
if [[ "${HOST}" == "x86_64-apple-darwin" ]]; then
|
||||||
mkdir -p depends/sdk-sources
|
./contrib/containers/guix/scripts/setup-sdk
|
||||||
OSX_SDK_BASENAME="Xcode-${XCODE_VERSION}-${XCODE_BUILD_ID}-extracted-SDK-with-libcxx-headers.tar.gz"
|
|
||||||
OSX_SDK_PATH="depends/sdk-sources/${OSX_SDK_BASENAME}"
|
|
||||||
if [ ! -f "$OSX_SDK_PATH" ]; then
|
|
||||||
echo "Downloading MacOS SDK"
|
|
||||||
curl --location --fail "${SDK_URL}/${OSX_SDK_BASENAME}" -o "$OSX_SDK_PATH"
|
|
||||||
fi
|
|
||||||
if [ -f "$OSX_SDK_PATH" ]; then
|
|
||||||
echo "Extracting MacOS SDK"
|
|
||||||
tar -C depends/SDKs -xf "$OSX_SDK_PATH"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
script:
|
script:
|
||||||
- make -j$(nproc) -C depends HOST=$HOST $DEP_OPTS
|
- make -j$(nproc) -C depends HOST=$HOST $DEP_OPTS
|
||||||
@ -193,13 +178,13 @@ x86_64-w64-mingw32:
|
|||||||
variables:
|
variables:
|
||||||
HOST: x86_64-w64-mingw32
|
HOST: x86_64-w64-mingw32
|
||||||
|
|
||||||
x86_64-pc-linux-gnu-debug:
|
x86_64-pc-linux-gnu_debug:
|
||||||
extends: .build-depends-template
|
extends: .build-depends-template
|
||||||
variables:
|
variables:
|
||||||
HOST: x86_64-pc-linux-gnu
|
HOST: x86_64-pc-linux-gnu
|
||||||
DEP_OPTS: "DEBUG=1"
|
DEP_OPTS: "DEBUG=1"
|
||||||
|
|
||||||
x86_64-pc-linux-gnu-nowallet:
|
x86_64-pc-linux-gnu_nowallet:
|
||||||
extends:
|
extends:
|
||||||
- .build-depends-template
|
- .build-depends-template
|
||||||
- .skip-in-fast-mode-template
|
- .skip-in-fast-mode-template
|
||||||
@ -207,13 +192,13 @@ x86_64-pc-linux-gnu-nowallet:
|
|||||||
HOST: x86_64-pc-linux-gnu
|
HOST: x86_64-pc-linux-gnu
|
||||||
DEP_OPTS: "NO_WALLET=1"
|
DEP_OPTS: "NO_WALLET=1"
|
||||||
|
|
||||||
x86_64-pc-linux-gnu-multiprocess:
|
x86_64-pc-linux-gnu_multiprocess:
|
||||||
extends:
|
extends:
|
||||||
- .build-depends-template
|
- .build-depends-template
|
||||||
- .skip-in-fast-mode-template
|
- .skip-in-fast-mode-template
|
||||||
variables:
|
variables:
|
||||||
HOST: x86_64-pc-linux-gnu
|
HOST: x86_64-pc-linux-gnu
|
||||||
DEP_OPTS: "MULTIPROCESS=1"
|
DEP_OPTS: "DEBUG=1 MULTIPROCESS=1"
|
||||||
|
|
||||||
x86_64-apple-darwin:
|
x86_64-apple-darwin:
|
||||||
extends:
|
extends:
|
||||||
@ -243,7 +228,7 @@ win64-build:
|
|||||||
linux64-build:
|
linux64-build:
|
||||||
extends: .build-template
|
extends: .build-template
|
||||||
needs:
|
needs:
|
||||||
- x86_64-pc-linux-gnu-debug
|
- x86_64-pc-linux-gnu_debug
|
||||||
variables:
|
variables:
|
||||||
BUILD_TARGET: linux64
|
BUILD_TARGET: linux64
|
||||||
|
|
||||||
@ -252,7 +237,7 @@ linux64_cxx20-build:
|
|||||||
- .build-template
|
- .build-template
|
||||||
- .skip-in-fast-mode-template
|
- .skip-in-fast-mode-template
|
||||||
needs:
|
needs:
|
||||||
- x86_64-pc-linux-gnu-debug
|
- x86_64-pc-linux-gnu_debug
|
||||||
variables:
|
variables:
|
||||||
BUILD_TARGET: linux64_cxx20
|
BUILD_TARGET: linux64_cxx20
|
||||||
|
|
||||||
@ -261,7 +246,7 @@ linux64_sqlite-build:
|
|||||||
- .build-template
|
- .build-template
|
||||||
- .skip-in-fast-mode-template
|
- .skip-in-fast-mode-template
|
||||||
needs:
|
needs:
|
||||||
- x86_64-pc-linux-gnu-debug
|
- x86_64-pc-linux-gnu_debug
|
||||||
variables:
|
variables:
|
||||||
BUILD_TARGET: linux64_sqlite
|
BUILD_TARGET: linux64_sqlite
|
||||||
|
|
||||||
@ -270,7 +255,7 @@ linux64_fuzz-build:
|
|||||||
- .build-template
|
- .build-template
|
||||||
- .skip-in-fast-mode-template
|
- .skip-in-fast-mode-template
|
||||||
needs:
|
needs:
|
||||||
- x86_64-pc-linux-gnu-debug
|
- x86_64-pc-linux-gnu_debug
|
||||||
variables:
|
variables:
|
||||||
BUILD_TARGET: linux64_fuzz
|
BUILD_TARGET: linux64_fuzz
|
||||||
|
|
||||||
@ -279,7 +264,7 @@ linux64_fuzz-build:
|
|||||||
# - .build-template
|
# - .build-template
|
||||||
# - .skip-in-fast-mode-template
|
# - .skip-in-fast-mode-template
|
||||||
# needs:
|
# needs:
|
||||||
# - x86_64-pc-linux-gnu-debug
|
# - x86_64-pc-linux-gnu_debug
|
||||||
# variables:
|
# variables:
|
||||||
# BUILD_TARGET: linux64_asan
|
# BUILD_TARGET: linux64_asan
|
||||||
|
|
||||||
@ -288,7 +273,7 @@ linux64_tsan-build:
|
|||||||
- .build-template
|
- .build-template
|
||||||
- .skip-in-fast-mode-template
|
- .skip-in-fast-mode-template
|
||||||
needs:
|
needs:
|
||||||
- x86_64-pc-linux-gnu-debug
|
- x86_64-pc-linux-gnu_debug
|
||||||
variables:
|
variables:
|
||||||
BUILD_TARGET: linux64_tsan
|
BUILD_TARGET: linux64_tsan
|
||||||
|
|
||||||
@ -297,7 +282,7 @@ linux64_ubsan-build:
|
|||||||
- .build-template
|
- .build-template
|
||||||
- .skip-in-fast-mode-template
|
- .skip-in-fast-mode-template
|
||||||
needs:
|
needs:
|
||||||
- x86_64-pc-linux-gnu-debug
|
- x86_64-pc-linux-gnu_debug
|
||||||
variables:
|
variables:
|
||||||
BUILD_TARGET: linux64_ubsan
|
BUILD_TARGET: linux64_ubsan
|
||||||
|
|
||||||
@ -306,7 +291,7 @@ linux64_nowallet-build:
|
|||||||
- .build-template
|
- .build-template
|
||||||
- .skip-in-fast-mode-template
|
- .skip-in-fast-mode-template
|
||||||
needs:
|
needs:
|
||||||
- x86_64-pc-linux-gnu-nowallet
|
- x86_64-pc-linux-gnu_nowallet
|
||||||
variables:
|
variables:
|
||||||
BUILD_TARGET: linux64_nowallet
|
BUILD_TARGET: linux64_nowallet
|
||||||
|
|
||||||
@ -315,7 +300,7 @@ linux64_multiprocess-build:
|
|||||||
- .build-template
|
- .build-template
|
||||||
- .skip-in-fast-mode-template
|
- .skip-in-fast-mode-template
|
||||||
needs:
|
needs:
|
||||||
- x86_64-pc-linux-gnu-multiprocess
|
- x86_64-pc-linux-gnu_multiprocess
|
||||||
variables:
|
variables:
|
||||||
BUILD_TARGET: linux64_multiprocess
|
BUILD_TARGET: linux64_multiprocess
|
||||||
|
|
||||||
@ -324,7 +309,7 @@ linux64_multiprocess-build:
|
|||||||
# - .build-template
|
# - .build-template
|
||||||
# - .skip-in-fast-mode-template
|
# - .skip-in-fast-mode-template
|
||||||
# needs:
|
# needs:
|
||||||
# - x86_64-pc-linux-gnu-debug
|
# - x86_64-pc-linux-gnu_debug
|
||||||
# variables:
|
# variables:
|
||||||
# BUILD_TARGET: linux64_valgrind
|
# BUILD_TARGET: linux64_valgrind
|
||||||
|
|
||||||
|
@ -20,17 +20,8 @@ mkdir -p $CACHE_DIR/sdk-sources
|
|||||||
ln -s $CACHE_DIR/depends ${DEPENDS_DIR}/built
|
ln -s $CACHE_DIR/depends ${DEPENDS_DIR}/built
|
||||||
ln -s $CACHE_DIR/sdk-sources ${DEPENDS_DIR}/sdk-sources
|
ln -s $CACHE_DIR/sdk-sources ${DEPENDS_DIR}/sdk-sources
|
||||||
|
|
||||||
mkdir -p ${DEPENDS_DIR}/SDKs
|
if [[ "${HOST}" == "x86_64-apple-darwin" ]]; then
|
||||||
|
./contrib/containers/guix/scripts/setup-sdk
|
||||||
if [ -n "$XCODE_VERSION" ]; then
|
|
||||||
OSX_SDK_BASENAME="Xcode-${XCODE_VERSION}-${XCODE_BUILD_ID}-extracted-SDK-with-libcxx-headers.tar.gz"
|
|
||||||
OSX_SDK_PATH="${DEPENDS_DIR}/sdk-sources/${OSX_SDK_BASENAME}"
|
|
||||||
if [ ! -f "$OSX_SDK_PATH" ]; then
|
|
||||||
curl --location --fail "${SDK_URL}/${OSX_SDK_BASENAME}" -o "$OSX_SDK_PATH"
|
|
||||||
fi
|
|
||||||
if [ -f "$OSX_SDK_PATH" ]; then
|
|
||||||
tar -C ${DEPENDS_DIR}/SDKs -xf "$OSX_SDK_PATH"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS
|
make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS
|
||||||
|
@ -18,28 +18,30 @@ export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/
|
|||||||
|
|
||||||
if [ "$BUILD_TARGET" = "arm-linux" ]; then
|
if [ "$BUILD_TARGET" = "arm-linux" ]; then
|
||||||
source ./ci/test/00_setup_env_arm.sh
|
source ./ci/test/00_setup_env_arm.sh
|
||||||
elif [ "$BUILD_TARGET" = "win64" ]; then
|
|
||||||
source ./ci/test/00_setup_env_win64.sh
|
|
||||||
elif [ "$BUILD_TARGET" = "linux64" ]; then
|
elif [ "$BUILD_TARGET" = "linux64" ]; then
|
||||||
source ./ci/test/00_setup_env_native_qt5.sh
|
source ./ci/test/00_setup_env_native_qt5.sh
|
||||||
elif [ "$BUILD_TARGET" = "linux64_asan" ]; then
|
elif [ "$BUILD_TARGET" = "linux64_asan" ]; then
|
||||||
source ./ci/test/00_setup_env_native_asan.sh
|
source ./ci/test/00_setup_env_native_asan.sh
|
||||||
|
elif [ "$BUILD_TARGET" = "linux64_cxx20" ]; then
|
||||||
|
source ./ci/test/00_setup_env_native_cxx20.sh
|
||||||
|
elif [ "$BUILD_TARGET" = "linux64_fuzz" ]; then
|
||||||
|
source ./ci/test/00_setup_env_native_fuzz.sh
|
||||||
|
elif [ "$BUILD_TARGET" = "linux64_multiprocess" ]; then
|
||||||
|
source ./ci/test/00_setup_env_native_multiprocess.sh
|
||||||
|
elif [ "$BUILD_TARGET" = "linux64_nowallet" ]; then
|
||||||
|
source ./ci/test/00_setup_env_native_nowallet.sh
|
||||||
|
elif [ "$BUILD_TARGET" = "linux64_sqlite" ]; then
|
||||||
|
source ./ci/test/00_setup_env_native_sqlite.sh
|
||||||
elif [ "$BUILD_TARGET" = "linux64_tsan" ]; then
|
elif [ "$BUILD_TARGET" = "linux64_tsan" ]; then
|
||||||
source ./ci/test/00_setup_env_native_tsan.sh
|
source ./ci/test/00_setup_env_native_tsan.sh
|
||||||
elif [ "$BUILD_TARGET" = "linux64_ubsan" ]; then
|
elif [ "$BUILD_TARGET" = "linux64_ubsan" ]; then
|
||||||
source ./ci/test/00_setup_env_native_ubsan.sh
|
source ./ci/test/00_setup_env_native_ubsan.sh
|
||||||
elif [ "$BUILD_TARGET" = "linux64_fuzz" ]; then
|
|
||||||
source ./ci/test/00_setup_env_native_fuzz.sh
|
|
||||||
elif [ "$BUILD_TARGET" = "linux64_cxx20" ]; then
|
|
||||||
source ./ci/test/00_setup_env_native_cxx20.sh
|
|
||||||
elif [ "$BUILD_TARGET" = "linux64_sqlite" ]; then
|
|
||||||
source ./ci/test/00_setup_env_native_sqlite.sh
|
|
||||||
elif [ "$BUILD_TARGET" = "linux64_nowallet" ]; then
|
|
||||||
source ./ci/test/00_setup_env_native_nowallet.sh
|
|
||||||
elif [ "$BUILD_TARGET" = "linux64_valgrind" ]; then
|
elif [ "$BUILD_TARGET" = "linux64_valgrind" ]; then
|
||||||
source ./ci/test/00_setup_env_native_valgrind.sh
|
source ./ci/test/00_setup_env_native_valgrind.sh
|
||||||
elif [ "$BUILD_TARGET" = "mac" ]; then
|
elif [ "$BUILD_TARGET" = "mac" ]; then
|
||||||
source ./ci/test/00_setup_env_mac.sh
|
source ./ci/test/00_setup_env_mac.sh
|
||||||
elif [ "$BUILD_TARGET" = "s390x" ]; then
|
elif [ "$BUILD_TARGET" = "s390x" ]; then
|
||||||
source ./ci/test/00_setup_env_s390x.sh
|
source ./ci/test/00_setup_env_s390x.sh
|
||||||
|
elif [ "$BUILD_TARGET" = "win64" ]; then
|
||||||
|
source ./ci/test/00_setup_env_win64.sh
|
||||||
fi
|
fi
|
||||||
|
@ -42,7 +42,7 @@ echo "Using socketevents mode: $SOCKETEVENTS"
|
|||||||
EXTRA_ARGS="--dashd-arg=-socketevents=$SOCKETEVENTS"
|
EXTRA_ARGS="--dashd-arg=-socketevents=$SOCKETEVENTS"
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
LD_LIBRARY_PATH=$DEPENDS_DIR/$HOST/lib ${TEST_RUNNER_ENV} ./test/functional/test_runner.py --ci --attempts=3 --ansi --combinedlogslen=4000 --timeout-factor=${TEST_RUNNER_TIMEOUT_FACTOR} ${TEST_RUNNER_EXTRA} --failfast --nocleanup --tmpdir=$(pwd)/testdatadirs $PASS_ARGS $EXTRA_ARGS
|
LD_LIBRARY_PATH=$DEPENDS_DIR/$HOST/lib ./test/functional/test_runner.py --ci --attempts=3 --ansi --combinedlogslen=4000 --timeout-factor=${TEST_RUNNER_TIMEOUT_FACTOR} ${TEST_RUNNER_EXTRA} --failfast --nocleanup --tmpdir=$(pwd)/testdatadirs $PASS_ARGS $EXTRA_ARGS
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ if [ "$DIRECT_WINE_EXEC_TESTS" = "true" ]; then
|
|||||||
wine ./src/test/test_dash.exe
|
wine ./src/test/test_dash.exe
|
||||||
else
|
else
|
||||||
if [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then
|
if [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then
|
||||||
${TEST_RUNNER_ENV} ./src/test/test_dash --catch_system_errors=no -l test_suite
|
./src/test/test_dash --catch_system_errors=no -l test_suite
|
||||||
else
|
else
|
||||||
${TEST_RUNNER_ENV} make $MAKEJOBS check VERBOSE=1
|
make $MAKEJOBS check VERBOSE=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -43,7 +43,6 @@ export RUN_SECURITY_TESTS=${RUN_SECURITY_TESTS:-false}
|
|||||||
# This is needed because some ci machines have slow CPU or disk, so sanitizers
|
# This is needed because some ci machines have slow CPU or disk, so sanitizers
|
||||||
# might be slow or a reindex might be waiting on disk IO.
|
# might be slow or a reindex might be waiting on disk IO.
|
||||||
export TEST_RUNNER_TIMEOUT_FACTOR=${TEST_RUNNER_TIMEOUT_FACTOR:-4}
|
export TEST_RUNNER_TIMEOUT_FACTOR=${TEST_RUNNER_TIMEOUT_FACTOR:-4}
|
||||||
export TEST_RUNNER_ENV=${TEST_RUNNER_ENV:-}
|
|
||||||
export RUN_FUZZ_TESTS=${RUN_FUZZ_TESTS:-false}
|
export RUN_FUZZ_TESTS=${RUN_FUZZ_TESTS:-false}
|
||||||
export EXPECTED_TESTS_DURATION_IN_SECONDS=${EXPECTED_TESTS_DURATION_IN_SECONDS:-1000}
|
export EXPECTED_TESTS_DURATION_IN_SECONDS=${EXPECTED_TESTS_DURATION_IN_SECONDS:-1000}
|
||||||
|
|
||||||
|
@ -11,5 +11,5 @@ export PACKAGES="cmake python3 llvm clang"
|
|||||||
export DEP_OPTS="DEBUG=1 MULTIPROCESS=1"
|
export DEP_OPTS="DEBUG=1 MULTIPROCESS=1"
|
||||||
export GOAL="install"
|
export GOAL="install"
|
||||||
export TEST_RUNNER_EXTRA="--v2transport"
|
export TEST_RUNNER_EXTRA="--v2transport"
|
||||||
export BITCOIN_CONFIG="--with-boost-process --enable-debug CC=clang CXX=clang++" # Use clang to avoid OOM
|
export BITCOIN_CONFIG="--with-boost-process --enable-debug CC=clang-16 CXX=clang++-16" # Use clang to avoid OOM
|
||||||
export TEST_RUNNER_ENV="BITCOIND=dash-node"
|
export BITCOIND=dash-node # Used in functional tests
|
||||||
|
@ -19,7 +19,6 @@ fi
|
|||||||
# Use debian to avoid 404 apt errors
|
# Use debian to avoid 404 apt errors
|
||||||
export CONTAINER_NAME=ci_s390x
|
export CONTAINER_NAME=ci_s390x
|
||||||
export RUN_UNIT_TESTS=true
|
export RUN_UNIT_TESTS=true
|
||||||
export TEST_RUNNER_ENV="LC_ALL=C"
|
|
||||||
export RUN_FUNCTIONAL_TESTS=true
|
export RUN_FUNCTIONAL_TESTS=true
|
||||||
export GOAL="install"
|
export GOAL="install"
|
||||||
export BITCOIN_CONFIG="--enable-reduce-exports --disable-gui-tests --with-boost-process" # GUI tests disabled for now, see https://github.com/bitcoin/bitcoin/issues/23730
|
export BITCOIN_CONFIG="--enable-reduce-exports --disable-gui-tests --with-boost-process" # GUI tests disabled for now, see https://github.com/bitcoin/bitcoin/issues/23730
|
||||||
|
14
configure.ac
14
configure.ac
@ -1053,7 +1053,7 @@ if test x$TARGET_OS = xdarwin; then
|
|||||||
AX_CHECK_LINK_FLAG([[-Wl,-fixup_chains]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-fixup_chains"], [], [[$LDFLAG_WERROR]])
|
AX_CHECK_LINK_FLAG([[-Wl,-fixup_chains]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-fixup_chains"], [], [[$LDFLAG_WERROR]])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_HEADERS([endian.h sys/endian.h byteswap.h stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h sys/select.h sys/prctl.h sys/sysctl.h vm/vm_param.h sys/vmmeter.h sys/resources.h])
|
AC_CHECK_HEADERS([sys/select.h sys/prctl.h sys/sysctl.h vm/vm_param.h sys/vmmeter.h sys/resources.h])
|
||||||
|
|
||||||
AC_CHECK_DECLS([getifaddrs, freeifaddrs],[CHECK_SOCKET],,
|
AC_CHECK_DECLS([getifaddrs, freeifaddrs],[CHECK_SOCKET],,
|
||||||
[#include <sys/types.h>
|
[#include <sys/types.h>
|
||||||
@ -1068,18 +1068,6 @@ AC_CHECK_DECLS([pipe2])
|
|||||||
|
|
||||||
AC_CHECK_FUNCS([timingsafe_bcmp])
|
AC_CHECK_FUNCS([timingsafe_bcmp])
|
||||||
|
|
||||||
AC_CHECK_DECLS([le16toh, le32toh, le64toh, htole16, htole32, htole64, be16toh, be32toh, be64toh, htobe16, htobe32, htobe64],,,
|
|
||||||
[#if HAVE_ENDIAN_H
|
|
||||||
#include <endian.h>
|
|
||||||
#elif HAVE_SYS_ENDIAN_H
|
|
||||||
#include <sys/endian.h>
|
|
||||||
#endif])
|
|
||||||
|
|
||||||
AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64],,,
|
|
||||||
[#if HAVE_BYTESWAP_H
|
|
||||||
#include <byteswap.h>
|
|
||||||
#endif])
|
|
||||||
|
|
||||||
dnl Check for mallopt(M_ARENA_MAX) (to set glibc arenas)
|
dnl Check for mallopt(M_ARENA_MAX) (to set glibc arenas)
|
||||||
AC_MSG_CHECKING(for mallopt M_ARENA_MAX)
|
AC_MSG_CHECKING(for mallopt M_ARENA_MAX)
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
|
||||||
|
@ -7,14 +7,17 @@ ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London"
|
|||||||
# (zlib1g-dev is needed for the Qt host binary builds, but should not be used by target binaries)
|
# (zlib1g-dev is needed for the Qt host binary builds, but should not be used by target binaries)
|
||||||
ENV APT_ARGS="-y --no-install-recommends --no-upgrade"
|
ENV APT_ARGS="-y --no-install-recommends --no-upgrade"
|
||||||
|
|
||||||
|
# Install packages for i386 on amd64 hosts, then install common packages
|
||||||
# Install packages for i386; disabled on aarch64 and arm64 hosts
|
RUN set -ex; \
|
||||||
RUN (dpkg --print-architecture | grep -Eq 'aarch64|arm64' || dpkg --add-architecture i386)
|
apt-get update && \
|
||||||
RUN (dpkg --print-architecture | grep -Eq 'aarch64|arm64' || (apt-get update && apt-get install $APT_ARGS \
|
if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
|
||||||
g++-multilib \
|
dpkg --add-architecture i386 && \
|
||||||
wine32) && rm -rf /var/lib/apt/lists/*)
|
apt-get update && \
|
||||||
|
apt-get install $APT_ARGS \
|
||||||
RUN apt-get update && apt-get install $APT_ARGS \
|
g++-multilib \
|
||||||
|
wine32; \
|
||||||
|
fi; \
|
||||||
|
apt-get install $APT_ARGS \
|
||||||
autotools-dev \
|
autotools-dev \
|
||||||
automake \
|
automake \
|
||||||
autoconf \
|
autoconf \
|
||||||
@ -23,13 +26,11 @@ RUN apt-get update && apt-get install $APT_ARGS \
|
|||||||
bsdmainutils \
|
bsdmainutils \
|
||||||
curl \
|
curl \
|
||||||
ccache \
|
ccache \
|
||||||
clang \
|
|
||||||
cmake \
|
cmake \
|
||||||
g++ \
|
g++ \
|
||||||
gettext \
|
gettext \
|
||||||
git \
|
git \
|
||||||
libc++-dev \
|
gnupg \
|
||||||
libc++abi-dev \
|
|
||||||
libtool \
|
libtool \
|
||||||
libxcb-icccm4 \
|
libxcb-icccm4 \
|
||||||
libxcb-image0 \
|
libxcb-image0 \
|
||||||
@ -42,11 +43,38 @@ RUN apt-get update && apt-get install $APT_ARGS \
|
|||||||
libxcb-xinerama0 \
|
libxcb-xinerama0 \
|
||||||
libxcb-xkb1 \
|
libxcb-xkb1 \
|
||||||
libxkbcommon-x11-0 \
|
libxkbcommon-x11-0 \
|
||||||
wget \
|
lsb-release \
|
||||||
|
software-properties-common \
|
||||||
unzip \
|
unzip \
|
||||||
|
wget \
|
||||||
m4 \
|
m4 \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
zlib1g-dev
|
zlib1g-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install Clang+LLVM and set it as default
|
||||||
|
# We don't need all packages but the default set doesn't include some
|
||||||
|
# packages we want so we will need to install some of them manually.
|
||||||
|
ARG LLVM_VERSION=16
|
||||||
|
RUN set -ex; \
|
||||||
|
echo "Installing LLVM and Clang ${LLVM_VERSION}..."; \
|
||||||
|
curl -sL https://apt.llvm.org/llvm.sh | bash -s "${LLVM_VERSION}"; \
|
||||||
|
echo "Installing additional packages..."; \
|
||||||
|
apt-get update && apt-get install $APT_ARGS \
|
||||||
|
"clang-format-${LLVM_VERSION}" \
|
||||||
|
"clang-tidy-${LLVM_VERSION}" \
|
||||||
|
"libc++-${LLVM_VERSION}-dev" \
|
||||||
|
"libc++abi-${LLVM_VERSION}-dev" \
|
||||||
|
"libclang-rt-${LLVM_VERSION}-dev"; \
|
||||||
|
rm -rf /var/lib/apt/lists/*; \
|
||||||
|
echo "Setting defaults..."; \
|
||||||
|
lldbUpdAltArgs="update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${LLVM_VERSION} 100"; \
|
||||||
|
for binName in clang clang++ clang-format clang-tidy clangd ld.lld lldb lldb-server; do \
|
||||||
|
lldbUpdAltArgs="${lldbUpdAltArgs} --slave /usr/bin/${binName} ${binName} /usr/bin/${binName}-${LLVM_VERSION}"; \
|
||||||
|
done; \
|
||||||
|
sh -c "${lldbUpdAltArgs}";
|
||||||
|
# LD_LIBRARY_PATH is empty by default, this is the first entry
|
||||||
|
ENV LD_LIBRARY_PATH="/usr/lib/llvm-${LLVM_VERSION}/lib"
|
||||||
|
|
||||||
# Python setup
|
# Python setup
|
||||||
# PYTHON_VERSION should match the value in .python-version
|
# PYTHON_VERSION should match the value in .python-version
|
||||||
@ -61,10 +89,11 @@ RUN apt-get update && apt-get install $APT_ARGS \
|
|||||||
libreadline-dev \
|
libreadline-dev \
|
||||||
libsqlite3-dev \
|
libsqlite3-dev \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
llvm \
|
|
||||||
make \
|
make \
|
||||||
tk-dev \
|
tk-dev \
|
||||||
xz-utils
|
xz-utils \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENV PYENV_ROOT="/usr/local/pyenv"
|
ENV PYENV_ROOT="/usr/local/pyenv"
|
||||||
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"
|
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"
|
||||||
RUN curl https://pyenv.run | bash \
|
RUN curl https://pyenv.run | bash \
|
||||||
@ -82,19 +111,38 @@ RUN pip3 install \
|
|||||||
pyzmq==22.3.0 \
|
pyzmq==22.3.0 \
|
||||||
vulture==2.3
|
vulture==2.3
|
||||||
|
|
||||||
# dash_hash
|
|
||||||
ARG DASH_HASH_VERSION=1.4.0
|
ARG DASH_HASH_VERSION=1.4.0
|
||||||
RUN git clone --depth 1 --no-tags --branch=${DASH_HASH_VERSION} https://github.com/dashpay/dash_hash
|
RUN set -ex; \
|
||||||
RUN cd dash_hash && pip3 install -r requirements.txt .
|
cd /tmp; \
|
||||||
|
git clone --depth 1 --no-tags --branch=${DASH_HASH_VERSION} https://github.com/dashpay/dash_hash; \
|
||||||
|
cd dash_hash && pip3 install -r requirements.txt .; \
|
||||||
|
cd .. && rm -rf dash_hash
|
||||||
|
|
||||||
|
ARG CPPCHECK_VERSION=2.13.0
|
||||||
|
RUN set -ex; \
|
||||||
|
curl -fL "https://github.com/danmar/cppcheck/archive/${CPPCHECK_VERSION}.tar.gz" -o /tmp/cppcheck.tar.gz; \
|
||||||
|
mkdir -p /opt/cppcheck && tar -xzf /tmp/cppcheck.tar.gz -C /opt/cppcheck --strip-components=1 && rm /tmp/cppcheck.tar.gz; \
|
||||||
|
cd /opt/cppcheck; \
|
||||||
|
mkdir build && cd build && cmake .. && cmake --build . -j "$(( $(nproc) - 1 ))"; \
|
||||||
|
mkdir /usr/local/share/Cppcheck && ln -s /opt/cppcheck/cfg/ /usr/local/share/Cppcheck/cfg; \
|
||||||
|
rm -rf /tmp/cppcheck.tar.gz
|
||||||
|
ENV PATH="/opt/cppcheck/build/bin:${PATH}"
|
||||||
|
|
||||||
|
ARG SHELLCHECK_VERSION=v0.7.1
|
||||||
|
RUN set -ex; \
|
||||||
|
curl -fL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" -o /tmp/shellcheck.tar.xz; \
|
||||||
|
mkdir -p /opt/shellcheck && tar -xf /tmp/shellcheck.tar.xz -C /opt/shellcheck --strip-components=1 && rm /tmp/shellcheck.tar.xz
|
||||||
|
ENV PATH="/opt/shellcheck:${PATH}"
|
||||||
|
|
||||||
|
# Add user with specified (or default) user/group ids and setup configuration files
|
||||||
ARG USER_ID=1000
|
ARG USER_ID=1000
|
||||||
ARG GROUP_ID=1000
|
ARG GROUP_ID=1000
|
||||||
|
RUN set -ex; \
|
||||||
# add user with specified (or default) user/group ids
|
groupadd -g ${GROUP_ID} dash; \
|
||||||
ENV USER_ID="${USER_ID}"
|
useradd -u ${USER_ID} -g dash -s /bin/bash -m -d /home/dash dash; \
|
||||||
ENV GROUP_ID="${GROUP_ID}"
|
mkdir -p /home/dash/.config/gdb; \
|
||||||
RUN groupadd -g ${GROUP_ID} dash
|
echo "add-auto-load-safe-path /usr/lib/llvm-${LLVM_VERSION}/lib" | tee /home/dash/.config/gdb/gdbinit; \
|
||||||
RUN useradd -u ${USER_ID} -g dash -s /bin/bash -m -d /home/dash dash
|
chown ${USER_ID}:${GROUP_ID} -R /home/dash
|
||||||
|
|
||||||
# Packages needed for all target builds
|
# Packages needed for all target builds
|
||||||
RUN apt-get update && apt-get install $APT_ARGS \
|
RUN apt-get update && apt-get install $APT_ARGS \
|
||||||
@ -111,17 +159,8 @@ RUN apt-get update && apt-get install $APT_ARGS \
|
|||||||
valgrind \
|
valgrind \
|
||||||
wine-stable \
|
wine-stable \
|
||||||
wine64 \
|
wine64 \
|
||||||
xorriso
|
xorriso \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
ARG CPPCHECK_VERSION=2.13.0
|
|
||||||
RUN curl -sL "https://github.com/danmar/cppcheck/archive/${CPPCHECK_VERSION}.tar.gz" | tar -xvzf - --directory /tmp/
|
|
||||||
RUN cd /tmp/cppcheck-${CPPCHECK_VERSION} && mkdir build && cd build && cmake .. && cmake --build . -j 8
|
|
||||||
ENV PATH="/tmp/cppcheck-${CPPCHECK_VERSION}/build/bin:${PATH}"
|
|
||||||
RUN mkdir /usr/local/share/Cppcheck && ln -s /tmp/cppcheck-${CPPCHECK_VERSION}/cfg/ /usr/local/share/Cppcheck/cfg
|
|
||||||
|
|
||||||
ARG SHELLCHECK_VERSION=v0.7.1
|
|
||||||
RUN curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar --xz -xf - --directory /tmp/
|
|
||||||
ENV PATH="/tmp/shellcheck-${SHELLCHECK_VERSION}:${PATH}"
|
|
||||||
|
|
||||||
# This is a hack. It is needed because gcc-multilib and g++-multilib are conflicting with g++-arm-linux-gnueabihf. This is
|
# This is a hack. It is needed because gcc-multilib and g++-multilib are conflicting with g++-arm-linux-gnueabihf. This is
|
||||||
# due to gcc-multilib installing the following symbolic link, which is needed for -m32 support. However, this causes
|
# due to gcc-multilib installing the following symbolic link, which is needed for -m32 support. However, this causes
|
||||||
@ -135,20 +174,6 @@ RUN \
|
|||||||
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix; \
|
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix; \
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
ARG LLVM_VERSION=16
|
|
||||||
# Setup Clang+LLVM support
|
|
||||||
RUN apt-get update && apt-get install $APT_ARGS \
|
|
||||||
lsb-release \
|
|
||||||
software-properties-common \
|
|
||||||
gnupg \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
RUN cd /tmp && \
|
|
||||||
wget https://apt.llvm.org/llvm.sh && \
|
|
||||||
chmod +x llvm.sh && \
|
|
||||||
/tmp/llvm.sh ${LLVM_VERSION} && \
|
|
||||||
rm -rf /tmp/llvm.sh
|
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
mkdir -p /src/dash && \
|
mkdir -p /src/dash && \
|
||||||
mkdir -p /cache/ccache && \
|
mkdir -p /cache/ccache && \
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
version: "3.9"
|
|
||||||
services:
|
services:
|
||||||
container:
|
container:
|
||||||
entrypoint: /bin/bash
|
entrypoint: /bin/bash
|
||||||
build:
|
build:
|
||||||
context: '..'
|
context: '..'
|
||||||
dockerfile: './develop/Dockerfile'
|
dockerfile: './develop/Dockerfile'
|
||||||
tty: true # Equivalent to -t
|
|
||||||
stdin_open: true # Equivalent to -i
|
|
||||||
ports:
|
ports:
|
||||||
- "9998:9998" # Mainnet Ports
|
- "9998:9998" # Mainnet Ports
|
||||||
- "9999:9999"
|
- "9999:9999"
|
||||||
- "19998:19998" # Testnet Ports
|
- "19998:19998" # Testnet Ports
|
||||||
- "19999:19999"
|
- "19999:19999"
|
||||||
|
security_opt:
|
||||||
|
- seccomp:unconfined
|
||||||
|
stdin_open: true # Equivalent to -i
|
||||||
|
tty: true # Equivalent to -t
|
||||||
|
|
||||||
# A note about volumes:
|
# A note about volumes:
|
||||||
#
|
#
|
||||||
|
@ -18,7 +18,11 @@ RUN apt-get update && \
|
|||||||
sudo \
|
sudo \
|
||||||
wget \
|
wget \
|
||||||
xz-utils && \
|
xz-utils && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*; \
|
||||||
|
targetLocale="en_US.UTF-8"; \
|
||||||
|
locale-gen ${targetLocale} && \
|
||||||
|
update-locale LC_ALL=${targetLocale} && \
|
||||||
|
update-locale LANG=${targetLocale};
|
||||||
|
|
||||||
ARG guix_download_path=ftp://ftp.gnu.org/gnu/guix
|
ARG guix_download_path=ftp://ftp.gnu.org/gnu/guix
|
||||||
ARG guix_version=1.4.0
|
ARG guix_version=1.4.0
|
||||||
@ -30,8 +34,7 @@ ENV PATH="/usr/local/bin:/usr/local/guix/current/bin:$PATH"
|
|||||||
|
|
||||||
# Application Setup
|
# Application Setup
|
||||||
# https://guix.gnu.org/manual/en/html_node/Application-Setup.html
|
# https://guix.gnu.org/manual/en/html_node/Application-Setup.html
|
||||||
ENV GUIX_LOCPATH="/usr/local/guix/profile" \
|
ENV GUIX_LOCPATH="/usr/local/guix/profile"
|
||||||
LC_ALL="en_US.UTF-8"
|
|
||||||
|
|
||||||
RUN guix_file_name=guix-binary-${guix_version}.$(uname -m)-linux.tar.xz && \
|
RUN guix_file_name=guix-binary-${guix_version}.$(uname -m)-linux.tar.xz && \
|
||||||
eval "guix_checksum=\${guix_checksum_$(uname -m)}" && \
|
eval "guix_checksum=\${guix_checksum_$(uname -m)}" && \
|
||||||
@ -74,18 +77,19 @@ RUN usermod -aG sudo ${USERNAME} && \
|
|||||||
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||||
|
|
||||||
# Copy required files to container
|
# Copy required files to container
|
||||||
COPY --from=docker_root ./motd.txt /etc/motd
|
COPY --from=docker_root ./motd.txt /etc/motd
|
||||||
COPY --from=docker_root ./scripts/entrypoint /usr/local/bin/entrypoint
|
COPY --from=docker_root ./scripts/entrypoint /usr/local/bin/entrypoint
|
||||||
COPY --from=docker_root ./scripts/guix-check /usr/local/bin/guix-check
|
COPY --from=docker_root ./scripts/guix-check /usr/local/bin/guix-check
|
||||||
COPY --from=docker_root ./scripts/guix-start /usr/local/bin/guix-start
|
COPY --from=docker_root ./scripts/guix-start /usr/local/bin/guix-start
|
||||||
|
COPY --from=docker_root ./scripts/setup-sdk /usr/local/bin/setup-sdk
|
||||||
|
|
||||||
# Create directories for mounting to save/restore cache and grant necessary permissions
|
# Create directories for mounting to save/restore cache and grant necessary permissions
|
||||||
RUN mkdir -p \
|
RUN mkdir -p \
|
||||||
/home/${USERNAME}/.cache \
|
/home/${USERNAME}/.cache \
|
||||||
/src/dash/depends/{built,sources,work} && \
|
/src/dash/depends/{built,sources,work}; \
|
||||||
chown -R ${USER_ID}:${GROUP_ID} \
|
chown -R ${USER_ID}:${GROUP_ID} \
|
||||||
/home/${USERNAME}/.cache \
|
/home/${USERNAME}/.cache \
|
||||||
/src
|
/src;
|
||||||
|
|
||||||
WORKDIR "/src/dash"
|
WORKDIR "/src/dash"
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
version: "3.9"
|
|
||||||
services:
|
services:
|
||||||
guix_ubuntu:
|
guix_ubuntu:
|
||||||
build:
|
build:
|
||||||
|
@ -9,19 +9,10 @@ if [[ ! -d "${WORKSPACE_PATH}" || ! "${WORKSPACE_PATH}" = /* || ! -f "${WORKSPAC
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
XCODE_VERSION="15.0"
|
|
||||||
XCODE_RELEASE="15A240d"
|
|
||||||
XCODE_ARCHIVE="Xcode-${XCODE_VERSION}-${XCODE_RELEASE}-extracted-SDK-with-libcxx-headers"
|
|
||||||
XCODE_SOURCE="${XCODE_SOURCE:-https://bitcoincore.org/depends-sources/sdks}"
|
|
||||||
|
|
||||||
export SDK_PATH="${SDK_PATH:-${WORKSPACE_PATH}/depends/SDKs}"
|
export SDK_PATH="${SDK_PATH:-${WORKSPACE_PATH}/depends/SDKs}"
|
||||||
|
export SDK_SRCS="${SDK_PATH:-${WORKSPACE_PATH}/depends/sdk-sources}"
|
||||||
|
|
||||||
# Check if macOS SDK is present, if not, download it
|
./contrib/containers/guix/scripts/setup-sdk
|
||||||
if [[ ! -d "${SDK_PATH}/${XCODE_ARCHIVE}" ]]; then
|
|
||||||
echo "Preparing macOS SDK..."
|
|
||||||
mkdir -p "${SDK_PATH}"
|
|
||||||
curl -L "${XCODE_SOURCE}/${XCODE_ARCHIVE}.tar.gz" | tar -xz -C "${SDK_PATH}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add safe.directory option only when WORKSPACE_PATH was specified via cmd-line arguments (happens in CI)
|
# Add safe.directory option only when WORKSPACE_PATH was specified via cmd-line arguments (happens in CI)
|
||||||
if [[ -n "${1}" ]]; then
|
if [[ -n "${1}" ]]; then
|
||||||
|
27
contrib/containers/guix/scripts/setup-sdk
Executable file
27
contrib/containers/guix/scripts/setup-sdk
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright (c) 2024 The Dash Core developers
|
||||||
|
# Distributed under the MIT software license, see the accompanying
|
||||||
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
export LC_ALL=C.UTF-8
|
||||||
|
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
SDK_URL="${SDK_URL:-https://bitcoincore.org/depends-sources/sdks}"
|
||||||
|
SDK_PATH="${SDK_PATH:-depends/SDKs}"
|
||||||
|
SDK_SRCS="${SDK_SOURCES:-depends/sdk-sources}"
|
||||||
|
XCODE_VERSION="${XCODE_VERSION:-15.0}"
|
||||||
|
XCODE_RELEASE="${XCODE_RELEASE:-15A240d}"
|
||||||
|
XCODE_ARCHIVE="Xcode-${XCODE_VERSION}-${XCODE_RELEASE}-extracted-SDK-with-libcxx-headers"
|
||||||
|
XCODE_AR_PATH="${SDK_SRCS}/${XCODE_ARCHIVE}.tar.gz"
|
||||||
|
|
||||||
|
if [ ! -d "${SDK_PATH}/${XCODE_ARCHIVE}" ]; then
|
||||||
|
if [ ! -f "${XCODE_AR_PATH}" ]; then
|
||||||
|
echo "Downloading macOS SDK..."
|
||||||
|
mkdir -p "${SDK_SRCS}"
|
||||||
|
curl --location --fail "${SDK_URL}/${XCODE_ARCHIVE}.tar.gz" -o "${XCODE_AR_PATH}"
|
||||||
|
fi
|
||||||
|
echo "Extracting macOS SDK..."
|
||||||
|
mkdir -p "${SDK_PATH}"
|
||||||
|
tar -C "${SDK_PATH}" -xf "${XCODE_AR_PATH}"
|
||||||
|
fi
|
@ -159,9 +159,15 @@ $(package)_config_opts_linux += -dbus-runtime
|
|||||||
ifneq ($(LTO),)
|
ifneq ($(LTO),)
|
||||||
$(package)_config_opts_linux += -ltcg
|
$(package)_config_opts_linux += -ltcg
|
||||||
endif
|
endif
|
||||||
$(package)_config_opts_linux += -platform linux-g++ -xplatform bitcoin-linux-g++
|
|
||||||
ifneq (,$(findstring -stdlib=libc++,$($(1)_cxx)))
|
ifneq (,$(findstring clang,$($(package)_cxx)))
|
||||||
$(package)_config_opts_x86_64_linux = -xplatform linux-clang-libc++
|
ifneq (,$(findstring -stdlib=libc++,$($(package)_cxx)))
|
||||||
|
$(package)_config_opts_linux += -platform linux-clang-libc++ -xplatform linux-clang-libc++
|
||||||
|
else
|
||||||
|
$(package)_config_opts_linux += -platform linux-clang -xplatform linux-clang
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
$(package)_config_opts_linux += -platform linux-g++ -xplatform bitcoin-linux-g++
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(package)_config_opts_mingw32 = -no-opengl
|
$(package)_config_opts_mingw32 = -no-opengl
|
||||||
|
@ -73,6 +73,7 @@ endif
|
|||||||
|
|
||||||
# test_dash binary #
|
# test_dash binary #
|
||||||
BITCOIN_TESTS =\
|
BITCOIN_TESTS =\
|
||||||
|
test/argsman_tests.cpp \
|
||||||
test/arith_uint256_tests.cpp \
|
test/arith_uint256_tests.cpp \
|
||||||
test/scriptnum10.h \
|
test/scriptnum10.h \
|
||||||
test/addrman_tests.cpp \
|
test/addrman_tests.cpp \
|
||||||
|
@ -17,12 +17,12 @@ static void EllSwiftCreate(benchmark::Bench& bench)
|
|||||||
uint256 entropy = GetRandHash();
|
uint256 entropy = GetRandHash();
|
||||||
|
|
||||||
bench.batch(1).unit("pubkey").run([&] {
|
bench.batch(1).unit("pubkey").run([&] {
|
||||||
auto ret = key.EllSwiftCreate(AsBytes(Span{entropy}));
|
auto ret = key.EllSwiftCreate(MakeByteSpan(entropy));
|
||||||
/* Use the first 32 bytes of the ellswift encoded public key as next private key. */
|
/* Use the first 32 bytes of the ellswift encoded public key as next private key. */
|
||||||
key.Set(UCharCast(ret.data()), UCharCast(ret.data()) + 32, true);
|
key.Set(UCharCast(ret.data()), UCharCast(ret.data()) + 32, true);
|
||||||
assert(key.IsValid());
|
assert(key.IsValid());
|
||||||
/* Use the last 32 bytes of the ellswift encoded public key as next entropy. */
|
/* Use the last 32 bytes of the ellswift encoded public key as next entropy. */
|
||||||
std::copy(ret.begin() + 32, ret.begin() + 64, BytePtr(entropy.data()));
|
std::copy(ret.begin() + 32, ret.begin() + 64, MakeWritableByteSpan(entropy).begin());
|
||||||
});
|
});
|
||||||
|
|
||||||
ECC_Stop();
|
ECC_Stop();
|
||||||
|
@ -26,10 +26,10 @@
|
|||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
#include <util/translation.h>
|
#include <util/translation.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <stacktraces.h>
|
#include <stacktraces.h>
|
||||||
|
|
||||||
@ -220,6 +220,16 @@ static void MutateTxLocktime(CMutableTransaction& tx, const std::string& cmdVal)
|
|||||||
tx.nLockTime = (unsigned int) newLocktime;
|
tx.nLockTime = (unsigned int) newLocktime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
static T TrimAndParse(const std::string& int_str, const std::string& err)
|
||||||
|
{
|
||||||
|
const auto parsed{ToIntegral<T>(TrimString(int_str))};
|
||||||
|
if (!parsed.has_value()) {
|
||||||
|
throw std::runtime_error(err + " '" + int_str + "'");
|
||||||
|
}
|
||||||
|
return parsed.value();
|
||||||
|
}
|
||||||
|
|
||||||
static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInput)
|
static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInput)
|
||||||
{
|
{
|
||||||
std::vector<std::string> vStrInputParts = SplitString(strInput, ':');
|
std::vector<std::string> vStrInputParts = SplitString(strInput, ':');
|
||||||
@ -245,8 +255,9 @@ static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInpu
|
|||||||
|
|
||||||
// extract the optional sequence number
|
// extract the optional sequence number
|
||||||
uint32_t nSequenceIn = CTxIn::SEQUENCE_FINAL;
|
uint32_t nSequenceIn = CTxIn::SEQUENCE_FINAL;
|
||||||
if (vStrInputParts.size() > 2)
|
if (vStrInputParts.size() > 2) {
|
||||||
nSequenceIn = std::stoul(vStrInputParts[2]);
|
nSequenceIn = TrimAndParse<uint32_t>(vStrInputParts.at(2), "invalid TX sequence id");
|
||||||
|
}
|
||||||
|
|
||||||
// append to transaction input list
|
// append to transaction input list
|
||||||
CTxIn txin(txid, vout, CScript(), nSequenceIn);
|
CTxIn txin(txid, vout, CScript(), nSequenceIn);
|
||||||
@ -324,10 +335,10 @@ static void MutateTxAddOutMultiSig(CMutableTransaction& tx, const std::string& s
|
|||||||
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
|
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
|
||||||
|
|
||||||
// Extract REQUIRED
|
// Extract REQUIRED
|
||||||
uint32_t required = stoul(vStrInputParts[1]);
|
const uint32_t required{TrimAndParse<uint32_t>(vStrInputParts.at(1), "invalid multisig required number")};
|
||||||
|
|
||||||
// Extract NUMKEYS
|
// Extract NUMKEYS
|
||||||
uint32_t numkeys = stoul(vStrInputParts[2]);
|
const uint32_t numkeys{TrimAndParse<uint32_t>(vStrInputParts.at(2), "invalid multisig total number")};
|
||||||
|
|
||||||
// Validate there are the correct number of pubkeys
|
// Validate there are the correct number of pubkeys
|
||||||
if (vStrInputParts.size() < numkeys + 3)
|
if (vStrInputParts.size() < numkeys + 3)
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
#include <stacktraces.h>
|
#include <stacktraces.h>
|
||||||
#include <util/url.h>
|
#include <util/url.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||||
UrlDecodeFn* const URL_DECODE = urlDecode;
|
UrlDecodeFn* const URL_DECODE = urlDecode;
|
||||||
|
@ -314,8 +314,8 @@ void CRollingBloomFilter::insert(Span<const unsigned char> vKey)
|
|||||||
/* FastMod works with the upper bits of h, so it is safe to ignore that the lower bits of h are already used for bit. */
|
/* FastMod works with the upper bits of h, so it is safe to ignore that the lower bits of h are already used for bit. */
|
||||||
uint32_t pos = FastRange32(h, data.size());
|
uint32_t pos = FastRange32(h, data.size());
|
||||||
/* The lowest bit of pos is ignored, and set to zero for the first bit, and to one for the second. */
|
/* The lowest bit of pos is ignored, and set to zero for the first bit, and to one for the second. */
|
||||||
data[pos & ~1] = (data[pos & ~1] & ~(((uint64_t)1) << bit)) | ((uint64_t)(nGeneration & 1)) << bit;
|
data[pos & ~1U] = (data[pos & ~1U] & ~(uint64_t{1} << bit)) | (uint64_t(nGeneration & 1)) << bit;
|
||||||
data[pos | 1] = (data[pos | 1] & ~(((uint64_t)1) << bit)) | ((uint64_t)(nGeneration >> 1)) << bit;
|
data[pos | 1] = (data[pos | 1] & ~(uint64_t{1} << bit)) | (uint64_t(nGeneration >> 1)) << bit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ bool CRollingBloomFilter::contains(Span<const unsigned char> vKey) const
|
|||||||
int bit = h & 0x3F;
|
int bit = h & 0x3F;
|
||||||
uint32_t pos = FastRange32(h, data.size());
|
uint32_t pos = FastRange32(h, data.size());
|
||||||
/* If the relevant bit is not set in either data[pos & ~1] or data[pos | 1], the filter does not contain vKey */
|
/* If the relevant bit is not set in either data[pos & ~1] or data[pos | 1], the filter does not contain vKey */
|
||||||
if (!(((data[pos & ~1] | data[pos | 1]) >> bit) & 1)) {
|
if (!(((data[pos & ~1U] | data[pos | 1]) >> bit) & 1)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,44 +5,66 @@
|
|||||||
#ifndef BITCOIN_COMPAT_BYTESWAP_H
|
#ifndef BITCOIN_COMPAT_BYTESWAP_H
|
||||||
#define BITCOIN_COMPAT_BYTESWAP_H
|
#define BITCOIN_COMPAT_BYTESWAP_H
|
||||||
|
|
||||||
#if defined(HAVE_CONFIG_H)
|
#include <cstdint>
|
||||||
#include <config/bitcoin-config.h>
|
#ifdef _MSC_VER
|
||||||
|
#include <cstdlib>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#if defined(HAVE_BYTESWAP_H)
|
// All internal_bswap_* functions can be replaced with std::byteswap once we
|
||||||
#include <byteswap.h>
|
// require c++23. Both libstdc++ and libc++ implement std::byteswap via these
|
||||||
|
// builtins.
|
||||||
|
|
||||||
|
#ifndef DISABLE_BUILTIN_BSWAPS
|
||||||
|
# if defined __has_builtin
|
||||||
|
# if __has_builtin(__builtin_bswap16)
|
||||||
|
# define bitcoin_builtin_bswap16(x) __builtin_bswap16(x)
|
||||||
|
# endif
|
||||||
|
# if __has_builtin(__builtin_bswap32)
|
||||||
|
# define bitcoin_builtin_bswap32(x) __builtin_bswap32(x)
|
||||||
|
# endif
|
||||||
|
# if __has_builtin(__builtin_bswap64)
|
||||||
|
# define bitcoin_builtin_bswap64(x) __builtin_bswap64(x)
|
||||||
|
# endif
|
||||||
|
# elif defined(_MSC_VER)
|
||||||
|
# define bitcoin_builtin_bswap16(x) _byteswap_ushort(x)
|
||||||
|
# define bitcoin_builtin_bswap32(x) _byteswap_ulong(x)
|
||||||
|
# define bitcoin_builtin_bswap64(x) _byteswap_uint64(x)
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MAC_OSX)
|
// MSVC's _byteswap_* functions are not constexpr
|
||||||
|
|
||||||
#include <libkern/OSByteOrder.h>
|
|
||||||
#define bswap_16(x) OSSwapInt16(x)
|
|
||||||
#define bswap_32(x) OSSwapInt32(x)
|
|
||||||
#define bswap_64(x) OSSwapInt64(x)
|
|
||||||
|
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
#define BSWAP_CONSTEXPR constexpr
|
||||||
#else
|
#else
|
||||||
// Non-MacOS / non-Darwin
|
#define BSWAP_CONSTEXPR
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAVE_DECL_BSWAP_16 == 0
|
inline BSWAP_CONSTEXPR uint16_t internal_bswap_16(uint16_t x)
|
||||||
inline uint16_t bswap_16(uint16_t x)
|
|
||||||
{
|
{
|
||||||
|
#ifdef bitcoin_builtin_bswap16
|
||||||
|
return bitcoin_builtin_bswap16(x);
|
||||||
|
#else
|
||||||
return (x >> 8) | (x << 8);
|
return (x >> 8) | (x << 8);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_BSWAP16 == 0
|
|
||||||
|
|
||||||
#if HAVE_DECL_BSWAP_32 == 0
|
inline BSWAP_CONSTEXPR uint32_t internal_bswap_32(uint32_t x)
|
||||||
inline uint32_t bswap_32(uint32_t x)
|
|
||||||
{
|
{
|
||||||
|
#ifdef bitcoin_builtin_bswap32
|
||||||
|
return bitcoin_builtin_bswap32(x);
|
||||||
|
#else
|
||||||
return (((x & 0xff000000U) >> 24) | ((x & 0x00ff0000U) >> 8) |
|
return (((x & 0xff000000U) >> 24) | ((x & 0x00ff0000U) >> 8) |
|
||||||
((x & 0x0000ff00U) << 8) | ((x & 0x000000ffU) << 24));
|
((x & 0x0000ff00U) << 8) | ((x & 0x000000ffU) << 24));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_BSWAP32 == 0
|
|
||||||
|
|
||||||
#if HAVE_DECL_BSWAP_64 == 0
|
inline BSWAP_CONSTEXPR uint64_t internal_bswap_64(uint64_t x)
|
||||||
inline uint64_t bswap_64(uint64_t x)
|
|
||||||
{
|
{
|
||||||
|
#ifdef bitcoin_builtin_bswap64
|
||||||
|
return bitcoin_builtin_bswap64(x);
|
||||||
|
#else
|
||||||
return (((x & 0xff00000000000000ull) >> 56)
|
return (((x & 0xff00000000000000ull) >> 56)
|
||||||
| ((x & 0x00ff000000000000ull) >> 40)
|
| ((x & 0x00ff000000000000ull) >> 40)
|
||||||
| ((x & 0x0000ff0000000000ull) >> 24)
|
| ((x & 0x0000ff0000000000ull) >> 24)
|
||||||
@ -51,9 +73,7 @@ inline uint64_t bswap_64(uint64_t x)
|
|||||||
| ((x & 0x0000000000ff0000ull) << 24)
|
| ((x & 0x0000000000ff0000ull) << 24)
|
||||||
| ((x & 0x000000000000ff00ull) << 40)
|
| ((x & 0x000000000000ff00ull) << 40)
|
||||||
| ((x & 0x00000000000000ffull) << 56));
|
| ((x & 0x00000000000000ffull) << 56));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_BSWAP64 == 0
|
|
||||||
|
|
||||||
#endif // defined(MAC_OSX)
|
|
||||||
|
|
||||||
#endif // BITCOIN_COMPAT_BYTESWAP_H
|
#endif // BITCOIN_COMPAT_BYTESWAP_H
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include <cpuid.h>
|
#include <cpuid.h>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
// We can't use cpuid.h's __get_cpuid as it does not support subleafs.
|
// We can't use cpuid.h's __get_cpuid as it does not support subleafs.
|
||||||
void static inline GetCPUID(uint32_t leaf, uint32_t subleaf, uint32_t& a, uint32_t& b, uint32_t& c, uint32_t& d)
|
void static inline GetCPUID(uint32_t leaf, uint32_t subleaf, uint32_t& a, uint32_t& b, uint32_t& c, uint32_t& d)
|
||||||
{
|
{
|
||||||
|
@ -5,237 +5,70 @@
|
|||||||
#ifndef BITCOIN_COMPAT_ENDIAN_H
|
#ifndef BITCOIN_COMPAT_ENDIAN_H
|
||||||
#define BITCOIN_COMPAT_ENDIAN_H
|
#define BITCOIN_COMPAT_ENDIAN_H
|
||||||
|
|
||||||
#if defined(HAVE_CONFIG_H)
|
|
||||||
#include <config/bitcoin-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <compat/byteswap.h>
|
#include <compat/byteswap.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <bit>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#if defined(HAVE_ENDIAN_H)
|
inline BSWAP_CONSTEXPR uint16_t htobe16_internal(uint16_t host_16bits)
|
||||||
#include <endian.h>
|
|
||||||
#elif defined(HAVE_SYS_ENDIAN_H)
|
|
||||||
#include <sys/endian.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_CONFIG_H
|
|
||||||
// While not technically a supported configuration, defaulting to defining these
|
|
||||||
// DECLs when we were compiled without autotools makes it easier for other build
|
|
||||||
// systems to build things like libdashconsensus for strange targets.
|
|
||||||
#ifdef htobe16
|
|
||||||
#define HAVE_DECL_HTOBE16 1
|
|
||||||
#endif
|
|
||||||
#ifdef htole16
|
|
||||||
#define HAVE_DECL_HTOLE16 1
|
|
||||||
#endif
|
|
||||||
#ifdef be16toh
|
|
||||||
#define HAVE_DECL_BE16TOH 1
|
|
||||||
#endif
|
|
||||||
#ifdef le16toh
|
|
||||||
#define HAVE_DECL_LE16TOH 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef htobe32
|
|
||||||
#define HAVE_DECL_HTOBE32 1
|
|
||||||
#endif
|
|
||||||
#ifdef htole32
|
|
||||||
#define HAVE_DECL_HTOLE32 1
|
|
||||||
#endif
|
|
||||||
#ifdef be32toh
|
|
||||||
#define HAVE_DECL_BE32TOH 1
|
|
||||||
#endif
|
|
||||||
#ifdef le32toh
|
|
||||||
#define HAVE_DECL_LE32TOH 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef htobe64
|
|
||||||
#define HAVE_DECL_HTOBE64 1
|
|
||||||
#endif
|
|
||||||
#ifdef htole64
|
|
||||||
#define HAVE_DECL_HTOLE64 1
|
|
||||||
#endif
|
|
||||||
#ifdef be64toh
|
|
||||||
#define HAVE_DECL_BE64TOH 1
|
|
||||||
#endif
|
|
||||||
#ifdef le64toh
|
|
||||||
#define HAVE_DECL_LE64TOH 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // HAVE_CONFIG_H
|
|
||||||
|
|
||||||
#if defined(WORDS_BIGENDIAN)
|
|
||||||
|
|
||||||
#if HAVE_DECL_HTOBE16 == 0
|
|
||||||
inline uint16_t htobe16(uint16_t host_16bits)
|
|
||||||
{
|
{
|
||||||
return host_16bits;
|
if constexpr (std::endian::native == std::endian::little) return internal_bswap_16(host_16bits);
|
||||||
|
else return host_16bits;
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_HTOBE16
|
inline BSWAP_CONSTEXPR uint16_t htole16_internal(uint16_t host_16bits)
|
||||||
|
|
||||||
#if HAVE_DECL_HTOLE16 == 0
|
|
||||||
inline uint16_t htole16(uint16_t host_16bits)
|
|
||||||
{
|
{
|
||||||
return bswap_16(host_16bits);
|
if constexpr (std::endian::native == std::endian::big) return internal_bswap_16(host_16bits);
|
||||||
|
else return host_16bits;
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_HTOLE16
|
inline BSWAP_CONSTEXPR uint16_t be16toh_internal(uint16_t big_endian_16bits)
|
||||||
|
|
||||||
#if HAVE_DECL_BE16TOH == 0
|
|
||||||
inline uint16_t be16toh(uint16_t big_endian_16bits)
|
|
||||||
{
|
{
|
||||||
return big_endian_16bits;
|
if constexpr (std::endian::native == std::endian::little) return internal_bswap_16(big_endian_16bits);
|
||||||
|
else return big_endian_16bits;
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_BE16TOH
|
inline BSWAP_CONSTEXPR uint16_t le16toh_internal(uint16_t little_endian_16bits)
|
||||||
|
|
||||||
#if HAVE_DECL_LE16TOH == 0
|
|
||||||
inline uint16_t le16toh(uint16_t little_endian_16bits)
|
|
||||||
{
|
{
|
||||||
return bswap_16(little_endian_16bits);
|
if constexpr (std::endian::native == std::endian::big) return internal_bswap_16(little_endian_16bits);
|
||||||
|
else return little_endian_16bits;
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_LE16TOH
|
inline BSWAP_CONSTEXPR uint32_t htobe32_internal(uint32_t host_32bits)
|
||||||
|
|
||||||
#if HAVE_DECL_HTOBE32 == 0
|
|
||||||
inline uint32_t htobe32(uint32_t host_32bits)
|
|
||||||
{
|
{
|
||||||
return host_32bits;
|
if constexpr (std::endian::native == std::endian::little) return internal_bswap_32(host_32bits);
|
||||||
|
else return host_32bits;
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_HTOBE32
|
inline BSWAP_CONSTEXPR uint32_t htole32_internal(uint32_t host_32bits)
|
||||||
|
|
||||||
#if HAVE_DECL_HTOLE32 == 0
|
|
||||||
inline uint32_t htole32(uint32_t host_32bits)
|
|
||||||
{
|
{
|
||||||
return bswap_32(host_32bits);
|
if constexpr (std::endian::native == std::endian::big) return internal_bswap_32(host_32bits);
|
||||||
|
else return host_32bits;
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_HTOLE32
|
inline BSWAP_CONSTEXPR uint32_t be32toh_internal(uint32_t big_endian_32bits)
|
||||||
|
|
||||||
#if HAVE_DECL_BE32TOH == 0
|
|
||||||
inline uint32_t be32toh(uint32_t big_endian_32bits)
|
|
||||||
{
|
{
|
||||||
return big_endian_32bits;
|
if constexpr (std::endian::native == std::endian::little) return internal_bswap_32(big_endian_32bits);
|
||||||
|
else return big_endian_32bits;
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_BE32TOH
|
inline BSWAP_CONSTEXPR uint32_t le32toh_internal(uint32_t little_endian_32bits)
|
||||||
|
|
||||||
#if HAVE_DECL_LE32TOH == 0
|
|
||||||
inline uint32_t le32toh(uint32_t little_endian_32bits)
|
|
||||||
{
|
{
|
||||||
return bswap_32(little_endian_32bits);
|
if constexpr (std::endian::native == std::endian::big) return internal_bswap_32(little_endian_32bits);
|
||||||
|
else return little_endian_32bits;
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_LE32TOH
|
inline BSWAP_CONSTEXPR uint64_t htobe64_internal(uint64_t host_64bits)
|
||||||
|
|
||||||
#if HAVE_DECL_HTOBE64 == 0
|
|
||||||
inline uint64_t htobe64(uint64_t host_64bits)
|
|
||||||
{
|
{
|
||||||
return host_64bits;
|
if constexpr (std::endian::native == std::endian::little) return internal_bswap_64(host_64bits);
|
||||||
|
else return host_64bits;
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_HTOBE64
|
inline BSWAP_CONSTEXPR uint64_t htole64_internal(uint64_t host_64bits)
|
||||||
|
|
||||||
#if HAVE_DECL_HTOLE64 == 0
|
|
||||||
inline uint64_t htole64(uint64_t host_64bits)
|
|
||||||
{
|
{
|
||||||
return bswap_64(host_64bits);
|
if constexpr (std::endian::native == std::endian::big) return internal_bswap_64(host_64bits);
|
||||||
|
else return host_64bits;
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_HTOLE64
|
inline BSWAP_CONSTEXPR uint64_t be64toh_internal(uint64_t big_endian_64bits)
|
||||||
|
|
||||||
#if HAVE_DECL_BE64TOH == 0
|
|
||||||
inline uint64_t be64toh(uint64_t big_endian_64bits)
|
|
||||||
{
|
{
|
||||||
return big_endian_64bits;
|
if constexpr (std::endian::native == std::endian::little) return internal_bswap_64(big_endian_64bits);
|
||||||
|
else return big_endian_64bits;
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_BE64TOH
|
inline BSWAP_CONSTEXPR uint64_t le64toh_internal(uint64_t little_endian_64bits)
|
||||||
|
|
||||||
#if HAVE_DECL_LE64TOH == 0
|
|
||||||
inline uint64_t le64toh(uint64_t little_endian_64bits)
|
|
||||||
{
|
{
|
||||||
return bswap_64(little_endian_64bits);
|
if constexpr (std::endian::native == std::endian::big) return internal_bswap_64(little_endian_64bits);
|
||||||
|
else return little_endian_64bits;
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_LE64TOH
|
|
||||||
|
|
||||||
#else // WORDS_BIGENDIAN
|
|
||||||
|
|
||||||
#if HAVE_DECL_HTOBE16 == 0
|
|
||||||
inline uint16_t htobe16(uint16_t host_16bits)
|
|
||||||
{
|
|
||||||
return bswap_16(host_16bits);
|
|
||||||
}
|
|
||||||
#endif // HAVE_DECL_HTOBE16
|
|
||||||
|
|
||||||
#if HAVE_DECL_HTOLE16 == 0
|
|
||||||
inline uint16_t htole16(uint16_t host_16bits)
|
|
||||||
{
|
|
||||||
return host_16bits;
|
|
||||||
}
|
|
||||||
#endif // HAVE_DECL_HTOLE16
|
|
||||||
|
|
||||||
#if HAVE_DECL_BE16TOH == 0
|
|
||||||
inline uint16_t be16toh(uint16_t big_endian_16bits)
|
|
||||||
{
|
|
||||||
return bswap_16(big_endian_16bits);
|
|
||||||
}
|
|
||||||
#endif // HAVE_DECL_BE16TOH
|
|
||||||
|
|
||||||
#if HAVE_DECL_LE16TOH == 0
|
|
||||||
inline uint16_t le16toh(uint16_t little_endian_16bits)
|
|
||||||
{
|
|
||||||
return little_endian_16bits;
|
|
||||||
}
|
|
||||||
#endif // HAVE_DECL_LE16TOH
|
|
||||||
|
|
||||||
#if HAVE_DECL_HTOBE32 == 0
|
|
||||||
inline uint32_t htobe32(uint32_t host_32bits)
|
|
||||||
{
|
|
||||||
return bswap_32(host_32bits);
|
|
||||||
}
|
|
||||||
#endif // HAVE_DECL_HTOBE32
|
|
||||||
|
|
||||||
#if HAVE_DECL_HTOLE32 == 0
|
|
||||||
inline uint32_t htole32(uint32_t host_32bits)
|
|
||||||
{
|
|
||||||
return host_32bits;
|
|
||||||
}
|
|
||||||
#endif // HAVE_DECL_HTOLE32
|
|
||||||
|
|
||||||
#if HAVE_DECL_BE32TOH == 0
|
|
||||||
inline uint32_t be32toh(uint32_t big_endian_32bits)
|
|
||||||
{
|
|
||||||
return bswap_32(big_endian_32bits);
|
|
||||||
}
|
|
||||||
#endif // HAVE_DECL_BE32TOH
|
|
||||||
|
|
||||||
#if HAVE_DECL_LE32TOH == 0
|
|
||||||
inline uint32_t le32toh(uint32_t little_endian_32bits)
|
|
||||||
{
|
|
||||||
return little_endian_32bits;
|
|
||||||
}
|
|
||||||
#endif // HAVE_DECL_LE32TOH
|
|
||||||
|
|
||||||
#if HAVE_DECL_HTOBE64 == 0
|
|
||||||
inline uint64_t htobe64(uint64_t host_64bits)
|
|
||||||
{
|
|
||||||
return bswap_64(host_64bits);
|
|
||||||
}
|
|
||||||
#endif // HAVE_DECL_HTOBE64
|
|
||||||
|
|
||||||
#if HAVE_DECL_HTOLE64 == 0
|
|
||||||
inline uint64_t htole64(uint64_t host_64bits)
|
|
||||||
{
|
|
||||||
return host_64bits;
|
|
||||||
}
|
|
||||||
#endif // HAVE_DECL_HTOLE64
|
|
||||||
|
|
||||||
#if HAVE_DECL_BE64TOH == 0
|
|
||||||
inline uint64_t be64toh(uint64_t big_endian_64bits)
|
|
||||||
{
|
|
||||||
return bswap_64(big_endian_64bits);
|
|
||||||
}
|
|
||||||
#endif // HAVE_DECL_BE64TOH
|
|
||||||
|
|
||||||
#if HAVE_DECL_LE64TOH == 0
|
|
||||||
inline uint64_t le64toh(uint64_t little_endian_64bits)
|
|
||||||
{
|
|
||||||
return little_endian_64bits;
|
|
||||||
}
|
|
||||||
#endif // HAVE_DECL_LE64TOH
|
|
||||||
|
|
||||||
#endif // WORDS_BIGENDIAN
|
|
||||||
|
|
||||||
#endif // BITCOIN_COMPAT_ENDIAN_H
|
#endif // BITCOIN_COMPAT_ENDIAN_H
|
||||||
|
@ -2,23 +2,19 @@
|
|||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#if defined(HAVE_CONFIG_H)
|
#include <compat/stdin.h>
|
||||||
#include <config/bitcoin-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cstdio> // for fileno(), stdin
|
#include <cstdio>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <windows.h> // for SetStdinEcho()
|
#include <windows.h>
|
||||||
#include <io.h> // for isatty()
|
#include <io.h>
|
||||||
#else
|
#else
|
||||||
#include <termios.h> // for SetStdinEcho()
|
#include <termios.h>
|
||||||
#include <unistd.h> // for SetStdinEcho(), isatty()
|
#include <unistd.h>
|
||||||
#include <poll.h> // for StdinReady()
|
#include <poll.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <compat/stdin.h>
|
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/1413445/reading-a-password-from-stdcin
|
// https://stackoverflow.com/questions/1413445/reading-a-password-from-stdcin
|
||||||
void SetStdinEcho(bool enable)
|
void SetStdinEcho(bool enable)
|
||||||
{
|
{
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <cstdlib>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
// classes for ChaCha20 256-bit stream cipher developed by Daniel J. Bernstein
|
// classes for ChaCha20 256-bit stream cipher developed by Daniel J. Bernstein
|
||||||
|
@ -5,106 +5,81 @@
|
|||||||
#ifndef BITCOIN_CRYPTO_COMMON_H
|
#ifndef BITCOIN_CRYPTO_COMMON_H
|
||||||
#define BITCOIN_CRYPTO_COMMON_H
|
#define BITCOIN_CRYPTO_COMMON_H
|
||||||
|
|
||||||
#if defined(HAVE_CONFIG_H)
|
|
||||||
#include <config/bitcoin-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <compat/endian.h>
|
#include <compat/endian.h>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
uint16_t static inline ReadLE16(const unsigned char* ptr)
|
uint16_t static inline ReadLE16(const unsigned char* ptr)
|
||||||
{
|
{
|
||||||
uint16_t x;
|
uint16_t x;
|
||||||
memcpy((char*)&x, ptr, 2);
|
memcpy(&x, ptr, 2);
|
||||||
return le16toh(x);
|
return le16toh_internal(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t static inline ReadLE32(const unsigned char* ptr)
|
uint32_t static inline ReadLE32(const unsigned char* ptr)
|
||||||
{
|
{
|
||||||
uint32_t x;
|
uint32_t x;
|
||||||
memcpy((char*)&x, ptr, 4);
|
memcpy(&x, ptr, 4);
|
||||||
return le32toh(x);
|
return le32toh_internal(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t static inline ReadLE64(const unsigned char* ptr)
|
uint64_t static inline ReadLE64(const unsigned char* ptr)
|
||||||
{
|
{
|
||||||
uint64_t x;
|
uint64_t x;
|
||||||
memcpy((char*)&x, ptr, 8);
|
memcpy(&x, ptr, 8);
|
||||||
return le64toh(x);
|
return le64toh_internal(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void static inline WriteLE16(unsigned char* ptr, uint16_t x)
|
void static inline WriteLE16(unsigned char* ptr, uint16_t x)
|
||||||
{
|
{
|
||||||
uint16_t v = htole16(x);
|
uint16_t v = htole16_internal(x);
|
||||||
memcpy(ptr, (char*)&v, 2);
|
memcpy(ptr, &v, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void static inline WriteLE32(unsigned char* ptr, uint32_t x)
|
void static inline WriteLE32(unsigned char* ptr, uint32_t x)
|
||||||
{
|
{
|
||||||
uint32_t v = htole32(x);
|
uint32_t v = htole32_internal(x);
|
||||||
memcpy(ptr, (char*)&v, 4);
|
memcpy(ptr, &v, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void static inline WriteLE64(unsigned char* ptr, uint64_t x)
|
void static inline WriteLE64(unsigned char* ptr, uint64_t x)
|
||||||
{
|
{
|
||||||
uint64_t v = htole64(x);
|
uint64_t v = htole64_internal(x);
|
||||||
memcpy(ptr, (char*)&v, 8);
|
memcpy(ptr, &v, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t static inline ReadBE16(const unsigned char* ptr)
|
uint16_t static inline ReadBE16(const unsigned char* ptr)
|
||||||
{
|
{
|
||||||
uint16_t x;
|
uint16_t x;
|
||||||
memcpy((char*)&x, ptr, 2);
|
memcpy(&x, ptr, 2);
|
||||||
return be16toh(x);
|
return be16toh_internal(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t static inline ReadBE32(const unsigned char* ptr)
|
uint32_t static inline ReadBE32(const unsigned char* ptr)
|
||||||
{
|
{
|
||||||
uint32_t x;
|
uint32_t x;
|
||||||
memcpy((char*)&x, ptr, 4);
|
memcpy(&x, ptr, 4);
|
||||||
return be32toh(x);
|
return be32toh_internal(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t static inline ReadBE64(const unsigned char* ptr)
|
uint64_t static inline ReadBE64(const unsigned char* ptr)
|
||||||
{
|
{
|
||||||
uint64_t x;
|
uint64_t x;
|
||||||
memcpy((char*)&x, ptr, 8);
|
memcpy(&x, ptr, 8);
|
||||||
return be64toh(x);
|
return be64toh_internal(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void static inline WriteBE32(unsigned char* ptr, uint32_t x)
|
void static inline WriteBE32(unsigned char* ptr, uint32_t x)
|
||||||
{
|
{
|
||||||
uint32_t v = htobe32(x);
|
uint32_t v = htobe32_internal(x);
|
||||||
memcpy(ptr, (char*)&v, 4);
|
memcpy(ptr, &v, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void static inline WriteBE64(unsigned char* ptr, uint64_t x)
|
void static inline WriteBE64(unsigned char* ptr, uint64_t x)
|
||||||
{
|
{
|
||||||
uint64_t v = htobe64(x);
|
uint64_t v = htobe64_internal(x);
|
||||||
memcpy(ptr, (char*)&v, 8);
|
memcpy(ptr, &v, 8);
|
||||||
}
|
|
||||||
|
|
||||||
/** Return the smallest number n such that (x >> n) == 0 (or 64 if the highest bit in x is set. */
|
|
||||||
uint64_t static inline CountBits(uint64_t x)
|
|
||||||
{
|
|
||||||
#if HAVE_BUILTIN_CLZL
|
|
||||||
if (sizeof(unsigned long) >= sizeof(uint64_t)) {
|
|
||||||
return x ? 8 * sizeof(unsigned long) - __builtin_clzl(x) : 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if HAVE_BUILTIN_CLZLL
|
|
||||||
if (sizeof(unsigned long long) >= sizeof(uint64_t)) {
|
|
||||||
return x ? 8 * sizeof(unsigned long long) - __builtin_clzll(x) : 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
int ret = 0;
|
|
||||||
while (x) {
|
|
||||||
x >>= 1;
|
|
||||||
++ret;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BITCOIN_CRYPTO_COMMON_H
|
#endif // BITCOIN_CRYPTO_COMMON_H
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include <crypto/hmac_sha256.h>
|
#include <crypto/hmac_sha256.h>
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/** A rfc5869 HKDF implementation with HMAC_SHA256 and fixed key output length of 32 bytes (L=32) */
|
/** A rfc5869 HKDF implementation with HMAC_SHA256 and fixed key output length of 32 bytes (L=32) */
|
||||||
class CHKDF_HMAC_SHA256_L32
|
class CHKDF_HMAC_SHA256_L32
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include <crypto/sha256.h>
|
#include <crypto/sha256.h>
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/** A hasher class for HMAC-SHA-256. */
|
/** A hasher class for HMAC-SHA-256. */
|
||||||
class CHMAC_SHA256
|
class CHMAC_SHA256
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include <crypto/sha512.h>
|
#include <crypto/sha512.h>
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/** A hasher class for HMAC-SHA-512. */
|
/** A hasher class for HMAC-SHA-512. */
|
||||||
class CHMAC_SHA512
|
class CHMAC_SHA512
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#ifndef BITCOIN_CRYPTO_PKCS5_PBKDF2_HMAC_SHA512_H
|
#ifndef BITCOIN_CRYPTO_PKCS5_PBKDF2_HMAC_SHA512_H
|
||||||
#define BITCOIN_CRYPTO_PKCS5_PBKDF2_HMAC_SHA512_H
|
#define BITCOIN_CRYPTO_PKCS5_PBKDF2_HMAC_SHA512_H
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/** A rfc2898 implementation of PKCS#5 v2.0 password based encryption key
|
/** A rfc2898 implementation of PKCS#5 v2.0 password based encryption key
|
||||||
* derivation function PBKDF2 with HMAC_SHA512. This implementation is
|
* derivation function PBKDF2 with HMAC_SHA512. This implementation is
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
#include <span.h>
|
#include <span.h>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cstdlib>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#define POLY1305_BLOCK_SIZE 16
|
#define POLY1305_BLOCK_SIZE 16
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#ifndef BITCOIN_CRYPTO_RIPEMD160_H
|
#ifndef BITCOIN_CRYPTO_RIPEMD160_H
|
||||||
#define BITCOIN_CRYPTO_RIPEMD160_H
|
#define BITCOIN_CRYPTO_RIPEMD160_H
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/** A hasher class for RIPEMD-160. */
|
/** A hasher class for RIPEMD-160. */
|
||||||
class CRIPEMD160
|
class CRIPEMD160
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#ifndef BITCOIN_CRYPTO_SHA1_H
|
#ifndef BITCOIN_CRYPTO_SHA1_H
|
||||||
#define BITCOIN_CRYPTO_SHA1_H
|
#define BITCOIN_CRYPTO_SHA1_H
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/** A hasher class for SHA1. */
|
/** A hasher class for SHA1. */
|
||||||
class CSHA1
|
class CSHA1
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#ifndef BITCOIN_CRYPTO_SHA256_H
|
#ifndef BITCOIN_CRYPTO_SHA256_H
|
||||||
#define BITCOIN_CRYPTO_SHA256_H
|
#define BITCOIN_CRYPTO_SHA256_H
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/** A hasher class for SHA-256. */
|
/** A hasher class for SHA-256. */
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
// This is a translation to GCC extended asm syntax from YASM code by Intel
|
// This is a translation to GCC extended asm syntax from YASM code by Intel
|
||||||
// (available at the bottom of this file).
|
// (available at the bottom of this file).
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__amd64__)
|
#if defined(__x86_64__) || defined(__amd64__)
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include <span.h>
|
#include <span.h>
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
//! The Keccak-f[1600] transform.
|
//! The Keccak-f[1600] transform.
|
||||||
void KeccakF(uint64_t (&st)[25]);
|
void KeccakF(uint64_t (&st)[25]);
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#ifndef BITCOIN_CRYPTO_SHA512_H
|
#ifndef BITCOIN_CRYPTO_SHA512_H
|
||||||
#define BITCOIN_CRYPTO_SHA512_H
|
#define BITCOIN_CRYPTO_SHA512_H
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/** A hasher class for SHA-512. */
|
/** A hasher class for SHA-512. */
|
||||||
class CSHA512
|
class CSHA512
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
static const size_t DBWRAPPER_PREALLOC_KEY_SIZE = 64;
|
static const size_t DBWRAPPER_PREALLOC_KEY_SIZE = 64;
|
||||||
static const size_t DBWRAPPER_PREALLOC_VALUE_SIZE = 1024;
|
static const size_t DBWRAPPER_PREALLOC_VALUE_SIZE = 1024;
|
||||||
|
|
||||||
|
inline auto CharCast(const std::byte* data) { return reinterpret_cast<const char*>(data); }
|
||||||
|
|
||||||
class dbwrapper_error : public std::runtime_error
|
class dbwrapper_error : public std::runtime_error
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -83,12 +85,12 @@ public:
|
|||||||
template <typename V>
|
template <typename V>
|
||||||
void Write(const CDataStream& _ssKey, const V& value)
|
void Write(const CDataStream& _ssKey, const V& value)
|
||||||
{
|
{
|
||||||
leveldb::Slice slKey((const char*)_ssKey.data(), _ssKey.size());
|
leveldb::Slice slKey(CharCast(_ssKey.data()), _ssKey.size());
|
||||||
|
|
||||||
ssValue.reserve(DBWRAPPER_PREALLOC_VALUE_SIZE);
|
ssValue.reserve(DBWRAPPER_PREALLOC_VALUE_SIZE);
|
||||||
ssValue << value;
|
ssValue << value;
|
||||||
ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent));
|
ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent));
|
||||||
leveldb::Slice slValue((const char*)ssValue.data(), ssValue.size());
|
leveldb::Slice slValue(CharCast(ssValue.data()), ssValue.size());
|
||||||
|
|
||||||
batch.Put(slKey, slValue);
|
batch.Put(slKey, slValue);
|
||||||
// - varint: key length (1 byte up to 127B, 2 bytes up to 16383B, ...)
|
// - varint: key length (1 byte up to 127B, 2 bytes up to 16383B, ...)
|
||||||
@ -110,7 +112,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Erase(const CDataStream& _ssKey) {
|
void Erase(const CDataStream& _ssKey) {
|
||||||
leveldb::Slice slKey((const char*)_ssKey.data(), _ssKey.size());
|
leveldb::Slice slKey(CharCast(_ssKey.data()), _ssKey.size());
|
||||||
|
|
||||||
batch.Delete(slKey);
|
batch.Delete(slKey);
|
||||||
// - byte: header
|
// - byte: header
|
||||||
@ -151,7 +153,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Seek(const CDataStream& ssKey) {
|
void Seek(const CDataStream& ssKey) {
|
||||||
leveldb::Slice slKey((const char*)ssKey.data(), ssKey.size());
|
leveldb::Slice slKey(CharCast(ssKey.data()), ssKey.size());
|
||||||
piter->Seek(slKey);
|
piter->Seek(slKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +261,7 @@ public:
|
|||||||
|
|
||||||
bool ReadDataStream(const CDataStream& ssKey, CDataStream& ssValue) const
|
bool ReadDataStream(const CDataStream& ssKey, CDataStream& ssValue) const
|
||||||
{
|
{
|
||||||
leveldb::Slice slKey((const char*)ssKey.data(), ssKey.size());
|
leveldb::Slice slKey(CharCast(ssKey.data()), ssKey.size());
|
||||||
|
|
||||||
std::string strValue;
|
std::string strValue;
|
||||||
leveldb::Status status = pdb->Get(readoptions, slKey, &strValue);
|
leveldb::Status status = pdb->Get(readoptions, slKey, &strValue);
|
||||||
@ -319,7 +321,7 @@ public:
|
|||||||
|
|
||||||
bool Exists(const CDataStream& key) const
|
bool Exists(const CDataStream& key) const
|
||||||
{
|
{
|
||||||
leveldb::Slice slKey((const char*)key.data(), key.size());
|
leveldb::Slice slKey(CharCast(key.data()), key.size());
|
||||||
|
|
||||||
std::string strValue;
|
std::string strValue;
|
||||||
leveldb::Status status = pdb->Get(readoptions, slKey, &strValue);
|
leveldb::Status status = pdb->Get(readoptions, slKey, &strValue);
|
||||||
@ -363,8 +365,8 @@ public:
|
|||||||
ssKey2.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
|
ssKey2.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
|
||||||
ssKey1 << key_begin;
|
ssKey1 << key_begin;
|
||||||
ssKey2 << key_end;
|
ssKey2 << key_end;
|
||||||
leveldb::Slice slKey1((const char*)ssKey1.data(), ssKey1.size());
|
leveldb::Slice slKey1(CharCast(ssKey1.data()), ssKey1.size());
|
||||||
leveldb::Slice slKey2((const char*)ssKey2.data(), ssKey2.size());
|
leveldb::Slice slKey2(CharCast(ssKey2.data()), ssKey2.size());
|
||||||
uint64_t size = 0;
|
uint64_t size = 0;
|
||||||
leveldb::Range range(slKey1, slKey2);
|
leveldb::Range range(slKey1, slKey2);
|
||||||
pdb->GetApproximateSizes(&range, 1, &size);
|
pdb->GetApproximateSizes(&range, 1, &size);
|
||||||
@ -382,8 +384,8 @@ public:
|
|||||||
ssKey2.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
|
ssKey2.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
|
||||||
ssKey1 << key_begin;
|
ssKey1 << key_begin;
|
||||||
ssKey2 << key_end;
|
ssKey2 << key_end;
|
||||||
leveldb::Slice slKey1((const char*)ssKey1.data(), ssKey1.size());
|
leveldb::Slice slKey1(CharCast(ssKey1.data()), ssKey1.size());
|
||||||
leveldb::Slice slKey2((const char*)ssKey2.data(), ssKey2.size());
|
leveldb::Slice slKey2(CharCast(ssKey2.data()), ssKey2.size());
|
||||||
pdb->CompactRange(&slKey1, &slKey2);
|
pdb->CompactRange(&slKey1, &slKey2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
#include <util/threadnames.h>
|
#include <util/threadnames.h>
|
||||||
#include <util/translation.h>
|
#include <util/translation.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -355,7 +355,7 @@ Binary Session::MyDestination() const
|
|||||||
|
|
||||||
uint16_t cert_len;
|
uint16_t cert_len;
|
||||||
memcpy(&cert_len, &m_private_key.at(CERT_LEN_POS), sizeof(cert_len));
|
memcpy(&cert_len, &m_private_key.at(CERT_LEN_POS), sizeof(cert_len));
|
||||||
cert_len = be16toh(cert_len);
|
cert_len = be16toh_internal(cert_len);
|
||||||
|
|
||||||
const size_t dest_len = DEST_LEN_BASE + cert_len;
|
const size_t dest_len = DEST_LEN_BASE + cert_len;
|
||||||
|
|
||||||
|
@ -12,11 +12,11 @@
|
|||||||
#include <tinyformat.h>
|
#include <tinyformat.h>
|
||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
#include <util/strencodings.h>
|
#include <util/strencodings.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <cstdlib>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -9,9 +9,8 @@
|
|||||||
#include <prevector.h>
|
#include <prevector.h>
|
||||||
#include <support/allocators/pool.h>
|
#include <support/allocators/pool.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cstdlib>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
#define BITCOIN_PREVECTOR_H
|
#define BITCOIN_PREVECTOR_H
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <cstdlib>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@ -47,26 +47,28 @@ public:
|
|||||||
typedef const value_type* const_pointer;
|
typedef const value_type* const_pointer;
|
||||||
|
|
||||||
class iterator {
|
class iterator {
|
||||||
T* ptr;
|
T* ptr{};
|
||||||
public:
|
public:
|
||||||
typedef Diff difference_type;
|
typedef Diff difference_type;
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
typedef T* pointer;
|
typedef T* pointer;
|
||||||
typedef T& reference;
|
typedef T& reference;
|
||||||
typedef std::random_access_iterator_tag iterator_category;
|
using element_type = T;
|
||||||
|
using iterator_category = std::contiguous_iterator_tag;
|
||||||
|
iterator() = default;
|
||||||
iterator(T* ptr_) : ptr(ptr_) {}
|
iterator(T* ptr_) : ptr(ptr_) {}
|
||||||
T& operator*() const { return *ptr; }
|
T& operator*() const { return *ptr; }
|
||||||
T* operator->() const { return ptr; }
|
T* operator->() const { return ptr; }
|
||||||
T& operator[](size_type pos) { return ptr[pos]; }
|
T& operator[](size_type pos) const { return ptr[pos]; }
|
||||||
const T& operator[](size_type pos) const { return ptr[pos]; }
|
|
||||||
iterator& operator++() { ptr++; return *this; }
|
iterator& operator++() { ptr++; return *this; }
|
||||||
iterator& operator--() { ptr--; return *this; }
|
iterator& operator--() { ptr--; return *this; }
|
||||||
iterator operator++(int) { iterator copy(*this); ++(*this); return copy; }
|
iterator operator++(int) { iterator copy(*this); ++(*this); return copy; }
|
||||||
iterator operator--(int) { iterator copy(*this); --(*this); return copy; }
|
iterator operator--(int) { iterator copy(*this); --(*this); return copy; }
|
||||||
difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
|
difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
|
||||||
iterator operator+(size_type n) { return iterator(ptr + n); }
|
iterator operator+(size_type n) const { return iterator(ptr + n); }
|
||||||
|
iterator friend operator+(size_type n, iterator x) { return x + n; }
|
||||||
iterator& operator+=(size_type n) { ptr += n; return *this; }
|
iterator& operator+=(size_type n) { ptr += n; return *this; }
|
||||||
iterator operator-(size_type n) { return iterator(ptr - n); }
|
iterator operator-(size_type n) const { return iterator(ptr - n); }
|
||||||
iterator& operator-=(size_type n) { ptr -= n; return *this; }
|
iterator& operator-=(size_type n) { ptr -= n; return *this; }
|
||||||
bool operator==(iterator x) const { return ptr == x.ptr; }
|
bool operator==(iterator x) const { return ptr == x.ptr; }
|
||||||
bool operator!=(iterator x) const { return ptr != x.ptr; }
|
bool operator!=(iterator x) const { return ptr != x.ptr; }
|
||||||
@ -77,18 +79,17 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class reverse_iterator {
|
class reverse_iterator {
|
||||||
T* ptr;
|
T* ptr{};
|
||||||
public:
|
public:
|
||||||
typedef Diff difference_type;
|
typedef Diff difference_type;
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
typedef T* pointer;
|
typedef T* pointer;
|
||||||
typedef T& reference;
|
typedef T& reference;
|
||||||
typedef std::bidirectional_iterator_tag iterator_category;
|
typedef std::bidirectional_iterator_tag iterator_category;
|
||||||
|
reverse_iterator() = default;
|
||||||
reverse_iterator(T* ptr_) : ptr(ptr_) {}
|
reverse_iterator(T* ptr_) : ptr(ptr_) {}
|
||||||
T& operator*() { return *ptr; }
|
T& operator*() const { return *ptr; }
|
||||||
const T& operator*() const { return *ptr; }
|
T* operator->() const { return ptr; }
|
||||||
T* operator->() { return ptr; }
|
|
||||||
const T* operator->() const { return ptr; }
|
|
||||||
reverse_iterator& operator--() { ptr++; return *this; }
|
reverse_iterator& operator--() { ptr++; return *this; }
|
||||||
reverse_iterator& operator++() { ptr--; return *this; }
|
reverse_iterator& operator++() { ptr--; return *this; }
|
||||||
reverse_iterator operator++(int) { reverse_iterator copy(*this); ++(*this); return copy; }
|
reverse_iterator operator++(int) { reverse_iterator copy(*this); ++(*this); return copy; }
|
||||||
@ -98,13 +99,15 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class const_iterator {
|
class const_iterator {
|
||||||
const T* ptr;
|
const T* ptr{};
|
||||||
public:
|
public:
|
||||||
typedef Diff difference_type;
|
typedef Diff difference_type;
|
||||||
typedef const T value_type;
|
typedef const T value_type;
|
||||||
typedef const T* pointer;
|
typedef const T* pointer;
|
||||||
typedef const T& reference;
|
typedef const T& reference;
|
||||||
typedef std::random_access_iterator_tag iterator_category;
|
using element_type = const T;
|
||||||
|
using iterator_category = std::contiguous_iterator_tag;
|
||||||
|
const_iterator() = default;
|
||||||
const_iterator(const T* ptr_) : ptr(ptr_) {}
|
const_iterator(const T* ptr_) : ptr(ptr_) {}
|
||||||
const_iterator(iterator x) : ptr(&(*x)) {}
|
const_iterator(iterator x) : ptr(&(*x)) {}
|
||||||
const T& operator*() const { return *ptr; }
|
const T& operator*() const { return *ptr; }
|
||||||
@ -115,9 +118,10 @@ public:
|
|||||||
const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; }
|
const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; }
|
||||||
const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; }
|
const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; }
|
||||||
difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }
|
difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }
|
||||||
const_iterator operator+(size_type n) { return const_iterator(ptr + n); }
|
const_iterator operator+(size_type n) const { return const_iterator(ptr + n); }
|
||||||
|
const_iterator friend operator+(size_type n, const_iterator x) { return x + n; }
|
||||||
const_iterator& operator+=(size_type n) { ptr += n; return *this; }
|
const_iterator& operator+=(size_type n) { ptr += n; return *this; }
|
||||||
const_iterator operator-(size_type n) { return const_iterator(ptr - n); }
|
const_iterator operator-(size_type n) const { return const_iterator(ptr - n); }
|
||||||
const_iterator& operator-=(size_type n) { ptr -= n; return *this; }
|
const_iterator& operator-=(size_type n) { ptr -= n; return *this; }
|
||||||
bool operator==(const_iterator x) const { return ptr == x.ptr; }
|
bool operator==(const_iterator x) const { return ptr == x.ptr; }
|
||||||
bool operator!=(const_iterator x) const { return ptr != x.ptr; }
|
bool operator!=(const_iterator x) const { return ptr != x.ptr; }
|
||||||
@ -128,13 +132,14 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class const_reverse_iterator {
|
class const_reverse_iterator {
|
||||||
const T* ptr;
|
const T* ptr{};
|
||||||
public:
|
public:
|
||||||
typedef Diff difference_type;
|
typedef Diff difference_type;
|
||||||
typedef const T value_type;
|
typedef const T value_type;
|
||||||
typedef const T* pointer;
|
typedef const T* pointer;
|
||||||
typedef const T& reference;
|
typedef const T& reference;
|
||||||
typedef std::bidirectional_iterator_tag iterator_category;
|
typedef std::bidirectional_iterator_tag iterator_category;
|
||||||
|
const_reverse_iterator() = default;
|
||||||
const_reverse_iterator(const T* ptr_) : ptr(ptr_) {}
|
const_reverse_iterator(const T* ptr_) : ptr(ptr_) {}
|
||||||
const_reverse_iterator(reverse_iterator x) : ptr(&(*x)) {}
|
const_reverse_iterator(reverse_iterator x) : ptr(&(*x)) {}
|
||||||
const T& operator*() const { return *ptr; }
|
const T& operator*() const { return *ptr; }
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#endif // ENABLE_WALLET
|
#endif // ENABLE_WALLET
|
||||||
|
|
||||||
#include <boost/signals2/connection.hpp>
|
#include <boost/signals2/connection.hpp>
|
||||||
|
#include <chrono>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -397,10 +398,10 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead
|
|||||||
connect(paymentServer, &PaymentServer::message, [this](const QString& title, const QString& message, unsigned int style) {
|
connect(paymentServer, &PaymentServer::message, [this](const QString& title, const QString& message, unsigned int style) {
|
||||||
window->message(title, message, style);
|
window->message(title, message, style);
|
||||||
});
|
});
|
||||||
QTimer::singleShot(100, paymentServer, &PaymentServer::uiReady);
|
QTimer::singleShot(100ms, paymentServer, &PaymentServer::uiReady);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
pollShutdownTimer->start(200);
|
pollShutdownTimer->start(SHUTDOWN_POLLING_DELAY);
|
||||||
} else {
|
} else {
|
||||||
Q_EMIT splashFinished(); // Make sure splash screen doesn't stick around during shutdown
|
Q_EMIT splashFinished(); // Make sure splash screen doesn't stick around during shutdown
|
||||||
quit(); // Exit first main loop invocation
|
quit(); // Exit first main loop invocation
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <netbase.h>
|
#include <netbase.h>
|
||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
#include <util/threadnames.h>
|
#include <util/threadnames.h>
|
||||||
|
#include <util/time.h>
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -323,7 +324,7 @@ static void BlockTipChanged(ClientModel* clientmodel, SynchronizationState sync_
|
|||||||
const bool throttle = (sync_state != SynchronizationState::POST_INIT && !fHeader) || sync_state == SynchronizationState::INIT_REINDEX;
|
const bool throttle = (sync_state != SynchronizationState::POST_INIT && !fHeader) || sync_state == SynchronizationState::INIT_REINDEX;
|
||||||
const int64_t now = throttle ? GetTimeMillis() : 0;
|
const int64_t now = throttle ? GetTimeMillis() : 0;
|
||||||
int64_t& nLastUpdateNotification = fHeader ? nLastHeaderTipUpdateNotification : nLastBlockTipUpdateNotification;
|
int64_t& nLastUpdateNotification = fHeader ? nLastHeaderTipUpdateNotification : nLastBlockTipUpdateNotification;
|
||||||
if (throttle && now < nLastUpdateNotification + MODEL_UPDATE_DELAY) {
|
if (throttle && now < nLastUpdateNotification + count_milliseconds(MODEL_UPDATE_DELAY)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,10 +6,16 @@
|
|||||||
#ifndef BITCOIN_QT_GUICONSTANTS_H
|
#ifndef BITCOIN_QT_GUICONSTANTS_H
|
||||||
#define BITCOIN_QT_GUICONSTANTS_H
|
#define BITCOIN_QT_GUICONSTANTS_H
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
/* Milliseconds between model updates */
|
using namespace std::chrono_literals;
|
||||||
static const int MODEL_UPDATE_DELAY = 250;
|
|
||||||
|
/* A delay between model updates */
|
||||||
|
static constexpr auto MODEL_UPDATE_DELAY{250ms};
|
||||||
|
|
||||||
|
/* A delay between shutdown pollings */
|
||||||
|
static constexpr auto SHUTDOWN_POLLING_DELAY{200ms};
|
||||||
|
|
||||||
/* AskPassphraseDialog -- Maximum passphrase length */
|
/* AskPassphraseDialog -- Maximum passphrase length */
|
||||||
static const int MAX_PASSPHRASE_SIZE = 1024;
|
static const int MAX_PASSPHRASE_SIZE = 1024;
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include <util/underlying.h>
|
#include <util/underlying.h>
|
||||||
|
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#include <QDataWidgetMapper>
|
#include <QDataWidgetMapper>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QIntValidator>
|
#include <QIntValidator>
|
||||||
@ -457,7 +459,7 @@ void OptionsDialog::showRestartWarning(bool fPersistent)
|
|||||||
ui->statusLabel->setText(tr("This change would require a client restart."));
|
ui->statusLabel->setText(tr("This change would require a client restart."));
|
||||||
// clear non-persistent status label after 10 seconds
|
// clear non-persistent status label after 10 seconds
|
||||||
// Todo: should perhaps be a class attribute, if we extend the use of statusLabel
|
// Todo: should perhaps be a class attribute, if we extend the use of statusLabel
|
||||||
QTimer::singleShot(10000, this, &OptionsDialog::clearStatusLabel);
|
QTimer::singleShot(10s, this, &OptionsDialog::clearStatusLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,10 +24,11 @@
|
|||||||
#include <node/interface_ui.h>
|
#include <node/interface_ui.h>
|
||||||
#include <policy/fees.h>
|
#include <policy/fees.h>
|
||||||
#include <txmempool.h>
|
#include <txmempool.h>
|
||||||
|
#include <validation.h>
|
||||||
#include <wallet/coincontrol.h>
|
#include <wallet/coincontrol.h>
|
||||||
#include <wallet/fees.h>
|
#include <wallet/fees.h>
|
||||||
#include <wallet/wallet.h>
|
#include <wallet/wallet.h>
|
||||||
#include <validation.h>
|
#include <chrono>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -1080,7 +1081,7 @@ SendConfirmationDialog::SendConfirmationDialog(const QString& title, const QStri
|
|||||||
int SendConfirmationDialog::exec()
|
int SendConfirmationDialog::exec()
|
||||||
{
|
{
|
||||||
updateYesButton();
|
updateYesButton();
|
||||||
countDownTimer.start(1000);
|
countDownTimer.start(1s);
|
||||||
return QMessageBox::exec();
|
return QMessageBox::exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#include <wallet/wallet.h>
|
#include <wallet/wallet.h>
|
||||||
#include <walletinitinterface.h>
|
#include <walletinitinterface.h>
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
@ -39,7 +41,7 @@ void EditAddressAndSubmit(
|
|||||||
dialog->findChild<QLineEdit*>("labelEdit")->setText(label);
|
dialog->findChild<QLineEdit*>("labelEdit")->setText(label);
|
||||||
dialog->findChild<QValidatedLineEdit*>("addressEdit")->setText(address);
|
dialog->findChild<QValidatedLineEdit*>("addressEdit")->setText(address);
|
||||||
|
|
||||||
ConfirmMessage(&warning_text, 5);
|
ConfirmMessage(&warning_text, 5ms);
|
||||||
dialog->accept();
|
dialog->accept();
|
||||||
QCOMPARE(warning_text, expected_msg);
|
QCOMPARE(warning_text, expected_msg);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
@ -9,7 +11,7 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
void ConfirmMessage(QString* text, int msec)
|
void ConfirmMessage(QString* text, std::chrono::milliseconds msec)
|
||||||
{
|
{
|
||||||
QTimer::singleShot(msec, [text]() {
|
QTimer::singleShot(msec, [text]() {
|
||||||
for (QWidget* widget : QApplication::topLevelWidgets()) {
|
for (QWidget* widget : QApplication::topLevelWidgets()) {
|
||||||
|
@ -5,7 +5,11 @@
|
|||||||
#ifndef BITCOIN_QT_TEST_UTIL_H
|
#ifndef BITCOIN_QT_TEST_UTIL_H
|
||||||
#define BITCOIN_QT_TEST_UTIL_H
|
#define BITCOIN_QT_TEST_UTIL_H
|
||||||
|
|
||||||
#include <QString>
|
#include <chrono>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QString;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Press "Ok" button in message box dialog.
|
* Press "Ok" button in message box dialog.
|
||||||
@ -13,6 +17,6 @@
|
|||||||
* @param text - Optionally store dialog text.
|
* @param text - Optionally store dialog text.
|
||||||
* @param msec - Number of milliseconds to pause before triggering the callback.
|
* @param msec - Number of milliseconds to pause before triggering the callback.
|
||||||
*/
|
*/
|
||||||
void ConfirmMessage(QString* text = nullptr, int msec = 0);
|
void ConfirmMessage(QString* text, std::chrono::milliseconds msec);
|
||||||
|
|
||||||
#endif // BITCOIN_QT_TEST_UTIL_H
|
#endif // BITCOIN_QT_TEST_UTIL_H
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <qt/recentrequeststablemodel.h>
|
#include <qt/recentrequeststablemodel.h>
|
||||||
#include <qt/receiverequestdialog.h>
|
#include <qt/receiverequestdialog.h>
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QAbstractButton>
|
#include <QAbstractButton>
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
#include <QCalendarWidget>
|
#include <QCalendarWidget>
|
||||||
|
#include <chrono>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDateTimeEdit>
|
#include <QDateTimeEdit>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
@ -114,8 +115,8 @@ TransactionView::TransactionView(QWidget* parent) :
|
|||||||
amountWidget->setObjectName("amountWidget");
|
amountWidget->setObjectName("amountWidget");
|
||||||
hlayout->addWidget(amountWidget);
|
hlayout->addWidget(amountWidget);
|
||||||
|
|
||||||
// Delay before filtering transactions in ms
|
// Delay before filtering transactions
|
||||||
static const int input_filter_delay = 200;
|
static constexpr auto input_filter_delay{200ms};
|
||||||
|
|
||||||
QTimer* amount_typing_delay = new QTimer(this);
|
QTimer* amount_typing_delay = new QTimer(this);
|
||||||
amount_typing_delay->setSingleShot(true);
|
amount_typing_delay->setSingleShot(true);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
#include <util/strencodings.h>
|
#include <util/strencodings.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
|
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <wallet/wallet.h>
|
#include <wallet/wallet.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
@ -271,12 +272,12 @@ void CreateWalletActivity::createWallet()
|
|||||||
flags |= WALLET_FLAG_DESCRIPTORS;
|
flags |= WALLET_FLAG_DESCRIPTORS;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimer::singleShot(500, worker(), [this, name, flags] {
|
QTimer::singleShot(500ms, worker(), [this, name, flags] {
|
||||||
std::unique_ptr<interfaces::Wallet> wallet = node().walletLoader().createWallet(name, m_passphrase, flags, m_error_message, m_warning_message);
|
std::unique_ptr<interfaces::Wallet> wallet = node().walletLoader().createWallet(name, m_passphrase, flags, m_error_message, m_warning_message);
|
||||||
|
|
||||||
if (wallet) m_wallet_model = m_wallet_controller->getOrCreateWallet(std::move(wallet));
|
if (wallet) m_wallet_model = m_wallet_controller->getOrCreateWallet(std::move(wallet));
|
||||||
|
|
||||||
QTimer::singleShot(500, this, &CreateWalletActivity::finish);
|
QTimer::singleShot(500ms, this, &CreateWalletActivity::finish);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <span.h>
|
#include <span.h>
|
||||||
#include <uint256.h>
|
#include <uint256.h>
|
||||||
|
|
||||||
|
#include <bit>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <chrono> // For std::chrono::microseconds
|
#include <chrono> // For std::chrono::microseconds
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -196,7 +197,7 @@ public:
|
|||||||
{
|
{
|
||||||
assert(range);
|
assert(range);
|
||||||
--range;
|
--range;
|
||||||
int bits = CountBits(range);
|
int bits = std::bit_width(range);
|
||||||
while (true) {
|
while (true) {
|
||||||
uint64_t ret = randbits(bits);
|
uint64_t ret = randbits(bits);
|
||||||
if (ret <= range) return ret;
|
if (ret <= range) return ret;
|
||||||
|
@ -874,29 +874,30 @@ static RPCHelpMan decoderawtransaction()
|
|||||||
|
|
||||||
static RPCHelpMan decodescript()
|
static RPCHelpMan decodescript()
|
||||||
{
|
{
|
||||||
return RPCHelpMan{"decodescript",
|
return RPCHelpMan{
|
||||||
"\nDecode a hex-encoded script.\n",
|
"decodescript",
|
||||||
{
|
"\nDecode a hex-encoded script.\n",
|
||||||
{"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hex-encoded script"},
|
{
|
||||||
},
|
{"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hex-encoded script"},
|
||||||
RPCResult{
|
},
|
||||||
RPCResult::Type::OBJ, "", "",
|
RPCResult{
|
||||||
|
RPCResult::Type::OBJ, "", "",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::STR, "asm", "Script public key"},
|
||||||
|
{RPCResult::Type::STR, "type", "The output type (e.g. " + GetAllOutputTypes() + ")"},
|
||||||
|
{RPCResult::Type::STR, "address", /* optional */ true, "Dash address (only if a well-defined address exists)"},
|
||||||
|
{RPCResult::Type::NUM, "reqSigs", /* optional */ true, "(DEPRECATED, returned only if config option -deprecatedrpc=addresses is passed) Number of required signatures"},
|
||||||
|
{RPCResult::Type::ARR, "addresses", /* optional */ true, "(DEPRECATED, returned only if config option -deprecatedrpc=addresses is passed) Array of Dash addresses",
|
||||||
{
|
{
|
||||||
{RPCResult::Type::STR, "asm", "Script public key"},
|
{RPCResult::Type::STR, "address", "Dash address"},
|
||||||
{RPCResult::Type::STR, "type", "The output type (e.g. "+GetAllOutputTypes()+")"},
|
}},
|
||||||
{RPCResult::Type::STR, "address", /* optional */ true, "Dash address (only if a well-defined address exists)"},
|
{RPCResult::Type::STR, "p2sh", "address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH)"},
|
||||||
{RPCResult::Type::NUM, "reqSigs", /* optional */ true, "(DEPRECATED, returned only if config option -deprecatedrpc=addresses is passed) Number of required signatures"},
|
},
|
||||||
{RPCResult::Type::ARR, "addresses", /* optional */ true, "(DEPRECATED, returned only if config option -deprecatedrpc=addresses is passed) Array of Dash addresses",
|
},
|
||||||
{
|
RPCExamples{
|
||||||
{RPCResult::Type::STR, "address", "Dash address"},
|
HelpExampleCli("decodescript", "\"hexstring\"")
|
||||||
}},
|
+ HelpExampleRpc("decodescript", "\"hexstring\"")
|
||||||
{RPCResult::Type::STR, "p2sh", "address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH)"},
|
},
|
||||||
}
|
|
||||||
},
|
|
||||||
RPCExamples{
|
|
||||||
HelpExampleCli("decodescript", "\"hexstring\"")
|
|
||||||
+ HelpExampleRpc("decodescript", "\"hexstring\"")
|
|
||||||
},
|
|
||||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||||
{
|
{
|
||||||
RPCTypeCheck(request.params, {UniValue::VSTR});
|
RPCTypeCheck(request.params, {UniValue::VSTR});
|
||||||
@ -911,11 +912,10 @@ static RPCHelpMan decodescript()
|
|||||||
}
|
}
|
||||||
ScriptPubKeyToUniv(script, r, /* fIncludeHex */ false);
|
ScriptPubKeyToUniv(script, r, /* fIncludeHex */ false);
|
||||||
|
|
||||||
UniValue type;
|
std::vector<std::vector<unsigned char>> solutions_data;
|
||||||
|
const TxoutType which_type{Solver(script, solutions_data)};
|
||||||
|
|
||||||
type = find_value(r, "type");
|
if (which_type != TxoutType::SCRIPTHASH) {
|
||||||
|
|
||||||
if (type.isStr() && type.get_str() != "scripthash") {
|
|
||||||
// P2SH cannot be wrapped in a P2SH. If this script is already a P2SH,
|
// P2SH cannot be wrapped in a P2SH. If this script is already a P2SH,
|
||||||
// don't return the address for a P2SH of the P2SH.
|
// don't return the address for a P2SH of the P2SH.
|
||||||
r.pushKV("p2sh", EncodeDestination(ScriptHash(script)));
|
r.pushKV("p2sh", EncodeDestination(ScriptHash(script)));
|
||||||
|
@ -60,27 +60,27 @@ template<typename Stream> inline void ser_writedata8(Stream &s, uint8_t obj)
|
|||||||
}
|
}
|
||||||
template<typename Stream> inline void ser_writedata16(Stream &s, uint16_t obj)
|
template<typename Stream> inline void ser_writedata16(Stream &s, uint16_t obj)
|
||||||
{
|
{
|
||||||
obj = htole16(obj);
|
obj = htole16_internal(obj);
|
||||||
s.write(AsBytes(Span{&obj, 1}));
|
s.write(AsBytes(Span{&obj, 1}));
|
||||||
}
|
}
|
||||||
template<typename Stream> inline void ser_writedata16be(Stream &s, uint16_t obj)
|
template<typename Stream> inline void ser_writedata16be(Stream &s, uint16_t obj)
|
||||||
{
|
{
|
||||||
obj = htobe16(obj);
|
obj = htobe16_internal(obj);
|
||||||
s.write(AsBytes(Span{&obj, 1}));
|
s.write(AsBytes(Span{&obj, 1}));
|
||||||
}
|
}
|
||||||
template<typename Stream> inline void ser_writedata32(Stream &s, uint32_t obj)
|
template<typename Stream> inline void ser_writedata32(Stream &s, uint32_t obj)
|
||||||
{
|
{
|
||||||
obj = htole32(obj);
|
obj = htole32_internal(obj);
|
||||||
s.write(AsBytes(Span{&obj, 1}));
|
s.write(AsBytes(Span{&obj, 1}));
|
||||||
}
|
}
|
||||||
template<typename Stream> inline void ser_writedata32be(Stream &s, uint32_t obj)
|
template<typename Stream> inline void ser_writedata32be(Stream &s, uint32_t obj)
|
||||||
{
|
{
|
||||||
obj = htobe32(obj);
|
obj = htobe32_internal(obj);
|
||||||
s.write(AsBytes(Span{&obj, 1}));
|
s.write(AsBytes(Span{&obj, 1}));
|
||||||
}
|
}
|
||||||
template<typename Stream> inline void ser_writedata64(Stream &s, uint64_t obj)
|
template<typename Stream> inline void ser_writedata64(Stream &s, uint64_t obj)
|
||||||
{
|
{
|
||||||
obj = htole64(obj);
|
obj = htole64_internal(obj);
|
||||||
s.write(AsBytes(Span{&obj, 1}));
|
s.write(AsBytes(Span{&obj, 1}));
|
||||||
}
|
}
|
||||||
template<typename Stream> inline uint8_t ser_readdata8(Stream &s)
|
template<typename Stream> inline uint8_t ser_readdata8(Stream &s)
|
||||||
@ -93,31 +93,31 @@ template<typename Stream> inline uint16_t ser_readdata16(Stream &s)
|
|||||||
{
|
{
|
||||||
uint16_t obj;
|
uint16_t obj;
|
||||||
s.read(AsWritableBytes(Span{&obj, 1}));
|
s.read(AsWritableBytes(Span{&obj, 1}));
|
||||||
return le16toh(obj);
|
return le16toh_internal(obj);
|
||||||
}
|
}
|
||||||
template<typename Stream> inline uint16_t ser_readdata16be(Stream &s)
|
template<typename Stream> inline uint16_t ser_readdata16be(Stream &s)
|
||||||
{
|
{
|
||||||
uint16_t obj;
|
uint16_t obj;
|
||||||
s.read(AsWritableBytes(Span{&obj, 1}));
|
s.read(AsWritableBytes(Span{&obj, 1}));
|
||||||
return be16toh(obj);
|
return be16toh_internal(obj);
|
||||||
}
|
}
|
||||||
template<typename Stream> inline uint32_t ser_readdata32(Stream &s)
|
template<typename Stream> inline uint32_t ser_readdata32(Stream &s)
|
||||||
{
|
{
|
||||||
uint32_t obj;
|
uint32_t obj;
|
||||||
s.read(AsWritableBytes(Span{&obj, 1}));
|
s.read(AsWritableBytes(Span{&obj, 1}));
|
||||||
return le32toh(obj);
|
return le32toh_internal(obj);
|
||||||
}
|
}
|
||||||
template<typename Stream> inline uint32_t ser_readdata32be(Stream &s)
|
template<typename Stream> inline uint32_t ser_readdata32be(Stream &s)
|
||||||
{
|
{
|
||||||
uint32_t obj;
|
uint32_t obj;
|
||||||
s.read(AsWritableBytes(Span{&obj, 1}));
|
s.read(AsWritableBytes(Span{&obj, 1}));
|
||||||
return be32toh(obj);
|
return be32toh_internal(obj);
|
||||||
}
|
}
|
||||||
template<typename Stream> inline uint64_t ser_readdata64(Stream &s)
|
template<typename Stream> inline uint64_t ser_readdata64(Stream &s)
|
||||||
{
|
{
|
||||||
uint64_t obj;
|
uint64_t obj;
|
||||||
s.read(AsWritableBytes(Span{&obj, 1}));
|
s.read(AsWritableBytes(Span{&obj, 1}));
|
||||||
return le64toh(obj);
|
return le64toh_internal(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -655,11 +655,11 @@ struct CustomUintFormatter
|
|||||||
{
|
{
|
||||||
if (v < 0 || v > MAX) throw std::ios_base::failure("CustomUintFormatter value out of range");
|
if (v < 0 || v > MAX) throw std::ios_base::failure("CustomUintFormatter value out of range");
|
||||||
if (BigEndian) {
|
if (BigEndian) {
|
||||||
uint64_t raw = htobe64(v);
|
uint64_t raw = htobe64_internal(v);
|
||||||
s.write({BytePtr(&raw) + 8 - Bytes, Bytes});
|
s.write(AsBytes(Span{&raw, 1}).last(Bytes));
|
||||||
} else {
|
} else {
|
||||||
uint64_t raw = htole64(v);
|
uint64_t raw = htole64_internal(v);
|
||||||
s.write({BytePtr(&raw), Bytes});
|
s.write(AsBytes(Span{&raw, 1}).first(Bytes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -669,11 +669,11 @@ struct CustomUintFormatter
|
|||||||
static_assert(std::numeric_limits<U>::max() >= MAX && std::numeric_limits<U>::min() <= 0, "Assigned type too small");
|
static_assert(std::numeric_limits<U>::max() >= MAX && std::numeric_limits<U>::min() <= 0, "Assigned type too small");
|
||||||
uint64_t raw = 0;
|
uint64_t raw = 0;
|
||||||
if (BigEndian) {
|
if (BigEndian) {
|
||||||
s.read({BytePtr(&raw) + 8 - Bytes, Bytes});
|
s.read(AsWritableBytes(Span{&raw, 1}).last(Bytes));
|
||||||
v = static_cast<I>(be64toh(raw));
|
v = static_cast<I>(be64toh_internal(raw));
|
||||||
} else {
|
} else {
|
||||||
s.read({BytePtr(&raw), Bytes});
|
s.read(AsWritableBytes(Span{&raw, 1}).first(Bytes));
|
||||||
v = static_cast<I>(le64toh(raw));
|
v = static_cast<I>(le64toh_internal(raw));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
21
src/span.h
21
src/span.h
@ -5,10 +5,10 @@
|
|||||||
#ifndef BITCOIN_SPAN_H
|
#ifndef BITCOIN_SPAN_H
|
||||||
#define BITCOIN_SPAN_H
|
#define BITCOIN_SPAN_H
|
||||||
|
|
||||||
#include <type_traits>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <assert.h>
|
#include <cassert>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
#ifdef DEBUG_CORE
|
#ifdef DEBUG_CORE
|
||||||
#define CONSTEXPR_IF_NOT_DEBUG
|
#define CONSTEXPR_IF_NOT_DEBUG
|
||||||
@ -243,21 +243,16 @@ T& SpanPopBack(Span<T>& span)
|
|||||||
return back;
|
return back;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Convert a data pointer to a std::byte data pointer.
|
|
||||||
//! Where possible, please use the safer AsBytes helpers.
|
|
||||||
inline const std::byte* BytePtr(const void* data) { return reinterpret_cast<const std::byte*>(data); }
|
|
||||||
inline std::byte* BytePtr(void* data) { return reinterpret_cast<std::byte*>(data); }
|
|
||||||
|
|
||||||
// From C++20 as_bytes and as_writeable_bytes
|
// From C++20 as_bytes and as_writeable_bytes
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Span<const std::byte> AsBytes(Span<T> s) noexcept
|
Span<const std::byte> AsBytes(Span<T> s) noexcept
|
||||||
{
|
{
|
||||||
return {BytePtr(s.data()), s.size_bytes()};
|
return {reinterpret_cast<const std::byte*>(s.data()), s.size_bytes()};
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Span<std::byte> AsWritableBytes(Span<T> s) noexcept
|
Span<std::byte> AsWritableBytes(Span<T> s) noexcept
|
||||||
{
|
{
|
||||||
return {BytePtr(s.data()), s.size_bytes()};
|
return {reinterpret_cast<std::byte*>(s.data()), s.size_bytes()};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename V>
|
template <typename V>
|
||||||
@ -272,10 +267,10 @@ Span<std::byte> MakeWritableByteSpan(V&& v) noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Helper functions to safely cast to unsigned char pointers.
|
// Helper functions to safely cast to unsigned char pointers.
|
||||||
inline unsigned char* UCharCast(char* c) { return (unsigned char*)c; }
|
inline unsigned char* UCharCast(char* c) { return reinterpret_cast<unsigned char*>(c); }
|
||||||
inline unsigned char* UCharCast(unsigned char* c) { return c; }
|
inline unsigned char* UCharCast(unsigned char* c) { return c; }
|
||||||
inline unsigned char* UCharCast(std::byte* c) { return (unsigned char*)c; }
|
inline unsigned char* UCharCast(std::byte* c) { return reinterpret_cast<unsigned char*>(c); }
|
||||||
inline const unsigned char* UCharCast(const char* c) { return (unsigned char*)c; }
|
inline const unsigned char* UCharCast(const char* c) { return reinterpret_cast<const unsigned char*>(c); }
|
||||||
inline const unsigned char* UCharCast(const unsigned char* c) { return c; }
|
inline const unsigned char* UCharCast(const unsigned char* c) { return c; }
|
||||||
inline const unsigned char* UCharCast(const std::byte* c) { return reinterpret_cast<const unsigned char*>(c); }
|
inline const unsigned char* UCharCast(const std::byte* c) { return reinterpret_cast<const unsigned char*>(c); }
|
||||||
|
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <cstdio>
|
||||||
#include <ios>
|
#include <ios>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#ifndef BITCOIN_SUPPORT_CLEANSE_H
|
#ifndef BITCOIN_SUPPORT_CLEANSE_H
|
||||||
#define BITCOIN_SUPPORT_CLEANSE_H
|
#define BITCOIN_SUPPORT_CLEANSE_H
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
|
|
||||||
/** Secure overwrite a buffer (possibly containing secret data) with zero-bytes. The write
|
/** Secure overwrite a buffer (possibly containing secret data) with zero-bytes. The write
|
||||||
* operation will not be optimized out by the compiler. */
|
* operation will not be optimized out by the compiler. */
|
||||||
|
1043
src/test/argsman_tests.cpp
Normal file
1043
src/test/argsman_tests.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,13 +4,13 @@
|
|||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <chain.h>
|
#include <chain.h>
|
||||||
#include <rpc/blockchain.h>
|
#include <rpc/blockchain.h>
|
||||||
#include <test/util/setup_common.h>
|
#include <test/util/setup_common.h>
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
/* Equality between doubles is imprecise. Comparison should be done
|
/* Equality between doubles is imprecise. Comparison should be done
|
||||||
* with a small threshold of tolerance, rather than exact equality.
|
* with a small threshold of tolerance, rather than exact equality.
|
||||||
*/
|
*/
|
||||||
|
@ -16,9 +16,9 @@ BOOST_AUTO_TEST_CASE(bswap_tests)
|
|||||||
uint16_t e1 = 0x3412;
|
uint16_t e1 = 0x3412;
|
||||||
uint32_t e2 = 0xbc9a7856;
|
uint32_t e2 = 0xbc9a7856;
|
||||||
uint64_t e3 = 0xbc9a78563412f0de;
|
uint64_t e3 = 0xbc9a78563412f0de;
|
||||||
BOOST_CHECK(bswap_16(u1) == e1);
|
BOOST_CHECK(internal_bswap_16(u1) == e1);
|
||||||
BOOST_CHECK(bswap_32(u2) == e2);
|
BOOST_CHECK(internal_bswap_32(u2) == e2);
|
||||||
BOOST_CHECK(bswap_64(u3) == e3);
|
BOOST_CHECK(internal_bswap_64(u3) == e3);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
@ -1083,28 +1083,6 @@ BOOST_AUTO_TEST_CASE(hkdf_hmac_sha256_l32_tests)
|
|||||||
"8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d");
|
"8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(countbits_tests)
|
|
||||||
{
|
|
||||||
FastRandomContext ctx;
|
|
||||||
for (unsigned int i = 0; i <= 64; ++i) {
|
|
||||||
if (i == 0) {
|
|
||||||
// Check handling of zero.
|
|
||||||
BOOST_CHECK_EQUAL(CountBits(0), 0U);
|
|
||||||
} else if (i < 10) {
|
|
||||||
for (uint64_t j = (uint64_t)1 << (i - 1); (j >> i) == 0; ++j) {
|
|
||||||
// Exhaustively test up to 10 bits
|
|
||||||
BOOST_CHECK_EQUAL(CountBits(j), i);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int k = 0; k < 1000; k++) {
|
|
||||||
// Randomly test 1000 samples of each length above 10 bits.
|
|
||||||
uint64_t j = ((uint64_t)1) << (i - 1) | ctx.randbits(i - 1);
|
|
||||||
BOOST_CHECK_EQUAL(CountBits(j), i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(sha256d64)
|
BOOST_AUTO_TEST_CASE(sha256d64)
|
||||||
{
|
{
|
||||||
for (int i = 0; i <= 32; ++i) {
|
for (int i = 0; i <= 32; ++i) {
|
||||||
|
@ -75,7 +75,6 @@ FUZZ_TARGET_INIT(integer, initialize_integer)
|
|||||||
static const uint256 u256_max(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
|
static const uint256 u256_max(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
|
||||||
const std::vector<uint256> v256{u256, u256_min, u256_max};
|
const std::vector<uint256> v256{u256, u256_min, u256_max};
|
||||||
(void)ComputeMerkleRoot(v256);
|
(void)ComputeMerkleRoot(v256);
|
||||||
(void)CountBits(u64);
|
|
||||||
(void)DecompressAmount(u64);
|
(void)DecompressAmount(u64);
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ ssize_t FuzzedFileProvider::write(void* cookie, const char* buf, size_t size)
|
|||||||
SetFuzzedErrNo(fuzzed_file->m_fuzzed_data_provider);
|
SetFuzzedErrNo(fuzzed_file->m_fuzzed_data_provider);
|
||||||
const ssize_t n = fuzzed_file->m_fuzzed_data_provider.ConsumeIntegralInRange<ssize_t>(0, size);
|
const ssize_t n = fuzzed_file->m_fuzzed_data_provider.ConsumeIntegralInRange<ssize_t>(0, size);
|
||||||
if (AdditionOverflow(fuzzed_file->m_offset, (int64_t)n)) {
|
if (AdditionOverflow(fuzzed_file->m_offset, (int64_t)n)) {
|
||||||
return fuzzed_file->m_fuzzed_data_provider.ConsumeBool() ? 0 : -1;
|
return 0;
|
||||||
}
|
}
|
||||||
fuzzed_file->m_offset += n;
|
fuzzed_file->m_offset += n;
|
||||||
return n;
|
return n;
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
#include <event2/event.h>
|
#include <event2/event.h>
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <support/events.h>
|
#include <support/events.h>
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -5,11 +5,11 @@
|
|||||||
#include <util/asmap.h>
|
#include <util/asmap.h>
|
||||||
|
|
||||||
#include <clientversion.h>
|
#include <clientversion.h>
|
||||||
#include <crypto/common.h>
|
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
#include <logging.h>
|
#include <logging.h>
|
||||||
#include <streams.h>
|
#include <streams.h>
|
||||||
|
|
||||||
|
#include <bit>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -108,7 +108,7 @@ uint32_t Interpret(const std::vector<bool> &asmap, const std::vector<bool> &ip)
|
|||||||
} else if (opcode == Instruction::MATCH) {
|
} else if (opcode == Instruction::MATCH) {
|
||||||
match = DecodeMatch(pos, endpos);
|
match = DecodeMatch(pos, endpos);
|
||||||
if (match == INVALID) break; // Match bits straddle EOF
|
if (match == INVALID) break; // Match bits straddle EOF
|
||||||
matchlen = CountBits(match) - 1;
|
matchlen = std::bit_width(match) - 1;
|
||||||
if (bits < matchlen) break; // Not enough input bits
|
if (bits < matchlen) break; // Not enough input bits
|
||||||
for (uint32_t bit = 0; bit < matchlen; bit++) {
|
for (uint32_t bit = 0; bit < matchlen; bit++) {
|
||||||
if ((ip[ip.size() - bits]) != ((match >> (matchlen - 1 - bit)) & 1)) {
|
if ((ip[ip.size() - bits]) != ((match >> (matchlen - 1 - bit)) & 1)) {
|
||||||
@ -172,7 +172,7 @@ bool SanityCheckASMap(const std::vector<bool>& asmap, int bits)
|
|||||||
} else if (opcode == Instruction::MATCH) {
|
} else if (opcode == Instruction::MATCH) {
|
||||||
uint32_t match = DecodeMatch(pos, endpos);
|
uint32_t match = DecodeMatch(pos, endpos);
|
||||||
if (match == INVALID) return false; // Match bits straddle EOF
|
if (match == INVALID) return false; // Match bits straddle EOF
|
||||||
int matchlen = CountBits(match) - 1;
|
int matchlen = std::bit_width(match) - 1;
|
||||||
if (prevopcode != Instruction::MATCH) had_incomplete_match = false;
|
if (prevopcode != Instruction::MATCH) had_incomplete_match = false;
|
||||||
if (matchlen < 8 && had_incomplete_match) return false; // Within a sequence of matches only at most one should be incomplete
|
if (matchlen < 8 && had_incomplete_match) return false; // Within a sequence of matches only at most one should be incomplete
|
||||||
had_incomplete_match = (matchlen < 8);
|
had_incomplete_match = (matchlen < 8);
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdio.h>
|
|
||||||
#include <tinyformat.h>
|
#include <tinyformat.h>
|
||||||
#include <util/bip32.h>
|
#include <util/bip32.h>
|
||||||
#include <util/strencodings.h>
|
#include <util/strencodings.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
bool ParseHDKeypath(const std::string& keypath_str, std::vector<uint32_t>& keypath)
|
bool ParseHDKeypath(const std::string& keypath_str, std::vector<uint32_t>& keypath)
|
||||||
{
|
{
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
#include <util/url.h>
|
#include <util/url.h>
|
||||||
|
|
||||||
#include <event2/http.h>
|
#include <event2/http.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
std::string urlDecode(const std::string &urlEncoded) {
|
std::string urlDecode(const std::string &urlEncoded) {
|
||||||
|
@ -25,6 +25,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
Span<const std::byte> SpanFromDbt(const BerkeleyBatch::SafeDbt& dbt)
|
||||||
|
{
|
||||||
|
return {reinterpret_cast<const std::byte*>(dbt.get_data()), dbt.get_size()};
|
||||||
|
}
|
||||||
|
|
||||||
//! Make sure database has a unique fileid within the environment. If it
|
//! Make sure database has a unique fileid within the environment. If it
|
||||||
//! doesn't, throw an error. BDB caches do not work properly when more than one
|
//! doesn't, throw an error. BDB caches do not work properly when more than one
|
||||||
@ -689,10 +693,10 @@ bool BerkeleyBatch::ReadAtCursor(CDataStream& ssKey, CDataStream& ssValue, bool&
|
|||||||
// Convert to streams
|
// Convert to streams
|
||||||
ssKey.SetType(SER_DISK);
|
ssKey.SetType(SER_DISK);
|
||||||
ssKey.clear();
|
ssKey.clear();
|
||||||
ssKey.write({BytePtr(datKey.get_data()), datKey.get_size()});
|
ssKey.write(SpanFromDbt(datKey));
|
||||||
ssValue.SetType(SER_DISK);
|
ssValue.SetType(SER_DISK);
|
||||||
ssValue.clear();
|
ssValue.clear();
|
||||||
ssValue.write({BytePtr(datValue.get_data()), datValue.get_size()});
|
ssValue.write(SpanFromDbt(datValue));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,7 +768,8 @@ bool BerkeleyBatch::ReadKey(CDataStream&& key, CDataStream& value)
|
|||||||
SafeDbt datValue;
|
SafeDbt datValue;
|
||||||
int ret = pdb->get(activeTxn, datKey, datValue, 0);
|
int ret = pdb->get(activeTxn, datKey, datValue, 0);
|
||||||
if (ret == 0 && datValue.get_data() != nullptr) {
|
if (ret == 0 && datValue.get_data() != nullptr) {
|
||||||
value.write({BytePtr(datValue.get_data()), datValue.get_size()});
|
value.clear();
|
||||||
|
value.write(SpanFromDbt(datValue));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -168,6 +168,7 @@ public:
|
|||||||
/** RAII class that provides access to a Berkeley database */
|
/** RAII class that provides access to a Berkeley database */
|
||||||
class BerkeleyBatch : public DatabaseBatch
|
class BerkeleyBatch : public DatabaseBatch
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
/** RAII class that automatically cleanses its data on destruction */
|
/** RAII class that automatically cleanses its data on destruction */
|
||||||
class SafeDbt final
|
class SafeDbt final
|
||||||
{
|
{
|
||||||
|
@ -111,7 +111,7 @@ bool EncryptSecret(const CKeyingMaterial& vMasterKey, const CKeyingMaterial &vch
|
|||||||
memcpy(chIV.data(), &nIV, WALLET_CRYPTO_IV_SIZE);
|
memcpy(chIV.data(), &nIV, WALLET_CRYPTO_IV_SIZE);
|
||||||
if(!cKeyCrypter.SetKey(vMasterKey, chIV))
|
if(!cKeyCrypter.SetKey(vMasterKey, chIV))
|
||||||
return false;
|
return false;
|
||||||
return cKeyCrypter.Encrypt(*((const CKeyingMaterial*)&vchPlaintext), vchCiphertext);
|
return cKeyCrypter.Encrypt(vchPlaintext, vchCiphertext);
|
||||||
}
|
}
|
||||||
|
|
||||||
// General secure AES 256 CBC encryption routine
|
// General secure AES 256 CBC encryption routine
|
||||||
|
@ -25,6 +25,12 @@ static constexpr int32_t WALLET_SCHEMA_VERSION = 0;
|
|||||||
static Mutex g_sqlite_mutex;
|
static Mutex g_sqlite_mutex;
|
||||||
static int g_sqlite_count GUARDED_BY(g_sqlite_mutex) = 0;
|
static int g_sqlite_count GUARDED_BY(g_sqlite_mutex) = 0;
|
||||||
|
|
||||||
|
static Span<const std::byte> SpanFromBlob(sqlite3_stmt* stmt, int col)
|
||||||
|
{
|
||||||
|
return {reinterpret_cast<const std::byte*>(sqlite3_column_blob(stmt, col)),
|
||||||
|
static_cast<size_t>(sqlite3_column_bytes(stmt, col))};
|
||||||
|
}
|
||||||
|
|
||||||
static void ErrorLogCallback(void* arg, int code, const char* msg)
|
static void ErrorLogCallback(void* arg, int code, const char* msg)
|
||||||
{
|
{
|
||||||
// From sqlite3_config() documentation for the SQLITE_CONFIG_LOG option:
|
// From sqlite3_config() documentation for the SQLITE_CONFIG_LOG option:
|
||||||
@ -404,9 +410,8 @@ bool SQLiteBatch::ReadKey(CDataStream&& key, CDataStream& value)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Leftmost column in result is index 0
|
// Leftmost column in result is index 0
|
||||||
const std::byte* data{BytePtr(sqlite3_column_blob(m_read_stmt, 0))};
|
value.clear();
|
||||||
size_t data_size(sqlite3_column_bytes(m_read_stmt, 0));
|
value.write(SpanFromBlob(m_read_stmt, 0));
|
||||||
value.write({data, data_size});
|
|
||||||
|
|
||||||
sqlite3_clear_bindings(m_read_stmt);
|
sqlite3_clear_bindings(m_read_stmt);
|
||||||
sqlite3_reset(m_read_stmt);
|
sqlite3_reset(m_read_stmt);
|
||||||
@ -495,13 +500,12 @@ bool SQLiteBatch::ReadAtCursor(CDataStream& key, CDataStream& value, bool& compl
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
key.clear();
|
||||||
|
value.clear();
|
||||||
|
|
||||||
// Leftmost column in result is index 0
|
// Leftmost column in result is index 0
|
||||||
const std::byte* key_data{BytePtr(sqlite3_column_blob(m_cursor_stmt, 0))};
|
key.write(SpanFromBlob(m_cursor_stmt, 0));
|
||||||
size_t key_data_size(sqlite3_column_bytes(m_cursor_stmt, 0));
|
value.write(SpanFromBlob(m_cursor_stmt, 1));
|
||||||
key.write({key_data, key_data_size});
|
|
||||||
const std::byte* value_data{BytePtr(sqlite3_column_blob(m_cursor_stmt, 1))};
|
|
||||||
size_t value_data_size(sqlite3_column_bytes(m_cursor_stmt, 1));
|
|
||||||
value.write({value_data, value_data_size});
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,11 @@
|
|||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
from test_framework.blocktools import COINBASE_MATURITY
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import assert_equal, assert_greater_than, assert_raises_rpc_error, create_confirmed_utxos, create_lots_of_big_transactions, gen_return_txouts
|
from test_framework.util import assert_equal, assert_greater_than, assert_raises_rpc_error, gen_return_txouts
|
||||||
|
from test_framework.wallet import MiniWallet
|
||||||
|
|
||||||
|
|
||||||
class MempoolLimitTest(BitcoinTestFramework):
|
class MempoolLimitTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
@ -20,55 +23,59 @@ class MempoolLimitTest(BitcoinTestFramework):
|
|||||||
]]
|
]]
|
||||||
self.supports_cli = False
|
self.supports_cli = False
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def send_large_txs(self, node, miniwallet, txouts, fee_rate, tx_batch_size):
|
||||||
self.skip_if_no_wallet()
|
for _ in range(tx_batch_size):
|
||||||
|
tx = miniwallet.create_self_transfer(from_node=node, fee_rate=fee_rate)['tx']
|
||||||
|
for txout in txouts:
|
||||||
|
tx.vout.append(txout)
|
||||||
|
miniwallet.sendrawtransaction(from_node=node, tx_hex=tx.serialize().hex())
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
txouts = gen_return_txouts()
|
txouts = gen_return_txouts()
|
||||||
relayfee = self.nodes[0].getnetworkinfo()['relayfee']
|
node=self.nodes[0]
|
||||||
|
miniwallet = MiniWallet(node)
|
||||||
|
relayfee = node.getnetworkinfo()['relayfee']
|
||||||
|
|
||||||
self.log.info('Check that mempoolminfee is minrelytxfee')
|
self.log.info('Check that mempoolminfee is minrelaytxfee')
|
||||||
assert_equal(self.nodes[0].getmempoolinfo()['minrelaytxfee'], Decimal('0.00001000'))
|
assert_equal(node.getmempoolinfo()['minrelaytxfee'], Decimal('0.00001000'))
|
||||||
assert_equal(self.nodes[0].getmempoolinfo()['mempoolminfee'], Decimal('0.00001000'))
|
assert_equal(node.getmempoolinfo()['mempoolminfee'], Decimal('0.00001000'))
|
||||||
|
|
||||||
txids = []
|
tx_batch_size = 25
|
||||||
utxos = create_confirmed_utxos(self, relayfee, self.nodes[0], 491)
|
num_of_batches = 3
|
||||||
|
# Generate UTXOs to flood the mempool
|
||||||
|
# 1 to create a tx initially that will be evicted from the mempool later
|
||||||
|
# 3 batches of multiple transactions with a fee rate much higher than the previous UTXO
|
||||||
|
# And 1 more to verify that this tx does not get added to the mempool with a fee rate less than the mempoolminfee
|
||||||
|
self.generate(miniwallet, 1 + (num_of_batches * tx_batch_size) + 1)
|
||||||
|
|
||||||
|
# Mine 99 blocks so that the UTXOs are allowed to be spent
|
||||||
|
self.generate(node, COINBASE_MATURITY - 1)
|
||||||
|
|
||||||
self.log.info('Create a mempool tx that will be evicted')
|
self.log.info('Create a mempool tx that will be evicted')
|
||||||
us0 = utxos.pop()
|
tx_to_be_evicted_id = miniwallet.send_self_transfer(from_node=node, fee_rate=relayfee)["txid"]
|
||||||
inputs = [{ "txid" : us0["txid"], "vout" : us0["vout"]}]
|
|
||||||
outputs = {self.nodes[0].getnewaddress() : 0.0001}
|
|
||||||
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
|
||||||
self.nodes[0].settxfee(relayfee) # specifically fund this tx with low fee
|
|
||||||
txF = self.nodes[0].fundrawtransaction(tx)
|
|
||||||
self.nodes[0].settxfee(0) # return to automatic fee selection
|
|
||||||
txFS = self.nodes[0].signrawtransactionwithwallet(txF['hex'])
|
|
||||||
txid = self.nodes[0].sendrawtransaction(txFS['hex'])
|
|
||||||
|
|
||||||
relayfee = self.nodes[0].getnetworkinfo()['relayfee']
|
# Increase the tx fee rate massively to give the subsequent transactions a higher priority in the mempool
|
||||||
base_fee = relayfee*100
|
base_fee = relayfee * 1000
|
||||||
for i in range (3):
|
|
||||||
txids.append([])
|
self.log.info("Fill up the mempool with txs with higher fee rate")
|
||||||
txids[i] = create_lots_of_big_transactions(self.nodes[0], txouts, utxos[30*i:30*i+30], 30, (i+1)*base_fee)
|
for batch_of_txid in range(num_of_batches):
|
||||||
|
fee_rate=(batch_of_txid + 1) * base_fee
|
||||||
|
self.send_large_txs(node, miniwallet, txouts, fee_rate, tx_batch_size)
|
||||||
|
|
||||||
self.log.info('The tx should be evicted by now')
|
self.log.info('The tx should be evicted by now')
|
||||||
assert txid not in self.nodes[0].getrawmempool()
|
# The number of transactions created should be greater than the ones present in the mempool
|
||||||
txdata = self.nodes[0].gettransaction(txid)
|
assert_greater_than(tx_batch_size * num_of_batches, len(node.getrawmempool()))
|
||||||
assert txdata['confirmations'] == 0 #confirmation should still be 0
|
# Initial tx created should not be present in the mempool anymore as it had a lower fee rate
|
||||||
|
assert tx_to_be_evicted_id not in node.getrawmempool()
|
||||||
|
|
||||||
self.log.info('Check that mempoolminfee is larger than minrelytxfee')
|
self.log.info('Check that mempoolminfee is larger than minrelaytxfee')
|
||||||
assert_equal(self.nodes[0].getmempoolinfo()['minrelaytxfee'], Decimal('0.00001000'))
|
assert_equal(node.getmempoolinfo()['minrelaytxfee'], Decimal('0.00001000'))
|
||||||
assert_greater_than(self.nodes[0].getmempoolinfo()['mempoolminfee'], Decimal('0.00001000'))
|
assert_greater_than(node.getmempoolinfo()['mempoolminfee'], Decimal('0.00001000'))
|
||||||
|
|
||||||
|
# Deliberately try to create a tx with a fee less than the minimum mempool fee to assert that it does not get added to the mempool
|
||||||
self.log.info('Create a mempool tx that will not pass mempoolminfee')
|
self.log.info('Create a mempool tx that will not pass mempoolminfee')
|
||||||
us0 = utxos.pop()
|
assert_raises_rpc_error(-26, "mempool min fee not met", miniwallet.send_self_transfer, from_node=node, fee_rate=relayfee, mempool_valid=False)
|
||||||
inputs = [{ "txid" : us0["txid"], "vout" : us0["vout"]}]
|
|
||||||
outputs = {self.nodes[0].getnewaddress() : 0.0001}
|
|
||||||
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
|
||||||
# specifically fund this tx with a fee < mempoolminfee, >= than minrelaytxfee
|
|
||||||
txF = self.nodes[0].fundrawtransaction(tx, {'feeRate': relayfee})
|
|
||||||
txFS = self.nodes[0].signrawtransactionwithwallet(txF['hex'])
|
|
||||||
assert_raises_rpc_error(-26, "mempool min fee not met", self.nodes[0].sendrawtransaction, txFS['hex'])
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
MempoolLimitTest().main()
|
MempoolLimitTest().main()
|
||||||
|
@ -3,14 +3,26 @@
|
|||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
import random
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import assert_equal
|
from test_framework.messages import (
|
||||||
|
COIN,
|
||||||
|
MAX_MONEY,
|
||||||
|
uint256_to_string,
|
||||||
|
)
|
||||||
|
from test_framework.util import (
|
||||||
|
assert_equal,
|
||||||
|
assert_is_hex_string,
|
||||||
|
assert_raises_rpc_error,
|
||||||
|
)
|
||||||
|
|
||||||
'''
|
# See coinjoin/options.h
|
||||||
rpc_coinjoin.py
|
COINJOIN_ROUNDS_DEFAULT = 4
|
||||||
|
COINJOIN_ROUNDS_MAX = 16
|
||||||
Tests CoinJoin basic RPC
|
COINJOIN_ROUNDS_MIN = 2
|
||||||
'''
|
COINJOIN_TARGET_MAX = int(MAX_MONEY / COIN)
|
||||||
|
COINJOIN_TARGET_MIN = 2
|
||||||
|
|
||||||
class CoinJoinTest(BitcoinTestFramework):
|
class CoinJoinTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
@ -19,45 +31,128 @@ class CoinJoinTest(BitcoinTestFramework):
|
|||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
|
||||||
def run_test(self):
|
def setup_nodes(self):
|
||||||
self.test_coinjoin_start_stop()
|
self.add_nodes(self.num_nodes)
|
||||||
self.test_coinjoin_setamount()
|
self.start_nodes()
|
||||||
self.test_coinjoin_setrounds()
|
|
||||||
|
|
||||||
def test_coinjoin_start_stop(self):
|
def run_test(self):
|
||||||
# Start Mixing
|
node = self.nodes[0]
|
||||||
self.nodes[0].coinjoin("start")
|
|
||||||
# Get CoinJoin info
|
node.createwallet(wallet_name='w1', blank=True, disable_private_keys=False)
|
||||||
cj_info = self.nodes[0].getcoinjoininfo()
|
w1 = node.get_wallet_rpc('w1')
|
||||||
# Ensure that it started properly
|
self.test_salt_presence(w1)
|
||||||
|
self.test_coinjoin_start_stop(w1)
|
||||||
|
self.test_setcoinjoinamount(w1)
|
||||||
|
self.test_setcoinjoinrounds(w1)
|
||||||
|
self.test_coinjoinsalt(w1)
|
||||||
|
w1.unloadwallet()
|
||||||
|
|
||||||
|
node.createwallet(wallet_name='w2', blank=True, disable_private_keys=True)
|
||||||
|
w2 = node.get_wallet_rpc('w2')
|
||||||
|
self.test_coinjoinsalt_disabled(w2)
|
||||||
|
w2.unloadwallet()
|
||||||
|
|
||||||
|
def test_salt_presence(self, node):
|
||||||
|
self.log.info('Salt should be automatically generated in new wallet')
|
||||||
|
# Will raise exception if no salt generated
|
||||||
|
assert_is_hex_string(node.coinjoinsalt('get'))
|
||||||
|
|
||||||
|
def test_coinjoin_start_stop(self, node):
|
||||||
|
self.log.info('"coinjoin" subcommands should update mixing status')
|
||||||
|
# Start mix session and ensure it's reported
|
||||||
|
node.coinjoin('start')
|
||||||
|
cj_info = node.getcoinjoininfo()
|
||||||
assert_equal(cj_info['enabled'], True)
|
assert_equal(cj_info['enabled'], True)
|
||||||
assert_equal(cj_info['running'], True)
|
assert_equal(cj_info['running'], True)
|
||||||
|
# Repeated start should yield error
|
||||||
|
assert_raises_rpc_error(-32603, 'Mixing has been started already.', node.coinjoin, 'start')
|
||||||
|
|
||||||
# Stop mixing
|
# Stop mix session and ensure it's reported
|
||||||
self.nodes[0].coinjoin("stop")
|
node.coinjoin('stop')
|
||||||
# Get CoinJoin info
|
cj_info = node.getcoinjoininfo()
|
||||||
cj_info = self.nodes[0].getcoinjoininfo()
|
|
||||||
# Ensure that it stopped properly
|
|
||||||
assert_equal(cj_info['enabled'], True)
|
assert_equal(cj_info['enabled'], True)
|
||||||
assert_equal(cj_info['running'], False)
|
assert_equal(cj_info['running'], False)
|
||||||
|
# Repeated stop should yield error
|
||||||
|
assert_raises_rpc_error(-32603, 'No mix session to stop', node.coinjoin, 'stop')
|
||||||
|
|
||||||
def test_coinjoin_setamount(self):
|
# Reset mix session
|
||||||
# Try normal values
|
assert_equal(node.coinjoin('reset'), "Mixing was reset")
|
||||||
self.nodes[0].setcoinjoinamount(50)
|
|
||||||
cj_info = self.nodes[0].getcoinjoininfo()
|
|
||||||
assert_equal(cj_info['max_amount'], 50)
|
|
||||||
|
|
||||||
# Try large values
|
def test_setcoinjoinamount(self, node):
|
||||||
self.nodes[0].setcoinjoinamount(1200000)
|
self.log.info('"setcoinjoinamount" should update mixing target')
|
||||||
cj_info = self.nodes[0].getcoinjoininfo()
|
# Test normal and large values
|
||||||
assert_equal(cj_info['max_amount'], 1200000)
|
for value in [COINJOIN_TARGET_MIN, 50, 1200000, COINJOIN_TARGET_MAX]:
|
||||||
|
node.setcoinjoinamount(value)
|
||||||
|
assert_equal(node.getcoinjoininfo()['max_amount'], value)
|
||||||
|
# Test values below minimum and above maximum
|
||||||
|
for value in [COINJOIN_TARGET_MIN - 1, COINJOIN_TARGET_MAX + 1]:
|
||||||
|
assert_raises_rpc_error(-8, "Invalid amount of DASH as mixing goal amount", node.setcoinjoinamount, value)
|
||||||
|
|
||||||
def test_coinjoin_setrounds(self):
|
def test_setcoinjoinrounds(self, node):
|
||||||
# Try normal values
|
self.log.info('"setcoinjoinrounds" should update mixing rounds')
|
||||||
self.nodes[0].setcoinjoinrounds(5)
|
# Test acceptable values
|
||||||
cj_info = self.nodes[0].getcoinjoininfo()
|
for value in [COINJOIN_ROUNDS_MIN, COINJOIN_ROUNDS_DEFAULT, COINJOIN_ROUNDS_MAX]:
|
||||||
assert_equal(cj_info['max_rounds'], 5)
|
node.setcoinjoinrounds(value)
|
||||||
|
assert_equal(node.getcoinjoininfo()['max_rounds'], value)
|
||||||
|
# Test values below minimum and above maximum
|
||||||
|
for value in [COINJOIN_ROUNDS_MIN - 1, COINJOIN_ROUNDS_MAX + 1]:
|
||||||
|
assert_raises_rpc_error(-8, "Invalid number of rounds", node.setcoinjoinrounds, value)
|
||||||
|
|
||||||
|
def test_coinjoinsalt(self, node):
|
||||||
|
self.log.info('"coinjoinsalt generate" should fail if salt already present')
|
||||||
|
assert_raises_rpc_error(-32600, 'Wallet "w1" already has set CoinJoin salt!', node.coinjoinsalt, 'generate')
|
||||||
|
|
||||||
|
self.log.info('"coinjoinsalt" subcommands should succeed if no balance and not mixing')
|
||||||
|
# 'coinjoinsalt generate' should return a new salt if overwrite enabled
|
||||||
|
s1 = node.coinjoinsalt('get')
|
||||||
|
assert_equal(node.coinjoinsalt('generate', True), True)
|
||||||
|
s2 = node.coinjoinsalt('get')
|
||||||
|
assert s1 != s2
|
||||||
|
|
||||||
|
# 'coinjoinsalt get' should fetch newly generated value (i.e. new salt should persist)
|
||||||
|
node.unloadwallet('w1')
|
||||||
|
node.loadwallet('w1')
|
||||||
|
node = self.nodes[0].get_wallet_rpc('w1')
|
||||||
|
assert_equal(s2, node.coinjoinsalt('get'))
|
||||||
|
|
||||||
|
# 'coinjoinsalt set' should work with random hashes
|
||||||
|
s1 = uint256_to_string(random.getrandbits(256))
|
||||||
|
node.coinjoinsalt('set', s1)
|
||||||
|
assert_equal(s1, node.coinjoinsalt('get'))
|
||||||
|
assert s1 != s2
|
||||||
|
|
||||||
|
# 'coinjoinsalt set' shouldn't work with nonsense values
|
||||||
|
s2 = format(0, '064x')
|
||||||
|
assert_raises_rpc_error(-8, "Invalid CoinJoin salt value", node.coinjoinsalt, 'set', s2, True)
|
||||||
|
s2 = s2[0:63] + 'h'
|
||||||
|
assert_raises_rpc_error(-8, "salt must be hexadecimal string (not '%s')" % s2, node.coinjoinsalt, 'set', s2, True)
|
||||||
|
|
||||||
|
self.log.info('"coinjoinsalt generate" and "coinjoinsalt set" should fail if mixing')
|
||||||
|
# Start mix session
|
||||||
|
node.coinjoin('start')
|
||||||
|
assert_equal(node.getcoinjoininfo()['running'], True)
|
||||||
|
|
||||||
|
# 'coinjoinsalt generate' and 'coinjoinsalt set' should fail when mixing
|
||||||
|
assert_raises_rpc_error(-4, 'Wallet "w1" is currently mixing, cannot change salt!', node.coinjoinsalt, 'generate', True)
|
||||||
|
assert_raises_rpc_error(-4, 'Wallet "w1" is currently mixing, cannot change salt!', node.coinjoinsalt, 'set', s1, True)
|
||||||
|
|
||||||
|
# 'coinjoinsalt get' should still work
|
||||||
|
assert_equal(node.coinjoinsalt('get'), s1)
|
||||||
|
|
||||||
|
# Stop mix session
|
||||||
|
node.coinjoin('stop')
|
||||||
|
assert_equal(node.getcoinjoininfo()['running'], False)
|
||||||
|
|
||||||
|
# 'coinjoinsalt generate' and 'coinjoinsalt set' should start working again
|
||||||
|
assert_equal(node.coinjoinsalt('generate', True), True)
|
||||||
|
assert_equal(node.coinjoinsalt('set', s1, True), True)
|
||||||
|
|
||||||
|
def test_coinjoinsalt_disabled(self, node):
|
||||||
|
self.log.info('"coinjoinsalt" subcommands should fail if private keys disabled')
|
||||||
|
for subcommand in ['generate', 'get']:
|
||||||
|
assert_raises_rpc_error(-32600, 'Wallet "w2" has private keys disabled, cannot perform CoinJoin!', node.coinjoinsalt, subcommand)
|
||||||
|
s1 = uint256_to_string(random.getrandbits(256))
|
||||||
|
assert_raises_rpc_error(-32600, 'Wallet "w2" has private keys disabled, cannot perform CoinJoin!', node.coinjoinsalt, 'set', s1)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
CoinJoinTest().main()
|
CoinJoinTest().main()
|
||||||
|
@ -22,9 +22,6 @@ class InvalidAddressErrorMessageTest(BitcoinTestFramework):
|
|||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
|
||||||
self.skip_if_no_wallet()
|
|
||||||
|
|
||||||
def test_validateaddress(self):
|
def test_validateaddress(self):
|
||||||
node = self.nodes[0]
|
node = self.nodes[0]
|
||||||
|
|
||||||
@ -50,7 +47,10 @@ class InvalidAddressErrorMessageTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self.test_validateaddress()
|
self.test_validateaddress()
|
||||||
self.test_getaddressinfo()
|
|
||||||
|
if self.is_wallet_compiled():
|
||||||
|
self.init_wallet(node=0)
|
||||||
|
self.test_getaddressinfo()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -473,12 +473,12 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||||||
|
|
||||||
def import_deterministic_coinbase_privkeys(self):
|
def import_deterministic_coinbase_privkeys(self):
|
||||||
for i in range(len(self.nodes)):
|
for i in range(len(self.nodes)):
|
||||||
self.init_wallet(i)
|
self.init_wallet(node=i)
|
||||||
|
|
||||||
def init_wallet(self, i):
|
def init_wallet(self, *, node):
|
||||||
wallet_name = self.default_wallet_name if self.wallet_names is None else self.wallet_names[i] if i < len(self.wallet_names) else False
|
wallet_name = self.default_wallet_name if self.wallet_names is None else self.wallet_names[node] if node < len(self.wallet_names) else False
|
||||||
if wallet_name is not False:
|
if wallet_name is not False:
|
||||||
n = self.nodes[i]
|
n = self.nodes[node]
|
||||||
if wallet_name is not None:
|
if wallet_name is not None:
|
||||||
n.createwallet(wallet_name=wallet_name, descriptors=self.options.descriptors, load_on_startup=True)
|
n.createwallet(wallet_name=wallet_name, descriptors=self.options.descriptors, load_on_startup=True)
|
||||||
n.importprivkey(privkey=n.get_deterministic_priv_key().key, label='coinbase', rescan=True)
|
n.importprivkey(privkey=n.get_deterministic_priv_key().key, label='coinbase', rescan=True)
|
||||||
|
@ -892,8 +892,6 @@ class RPCCoverage():
|
|||||||
# Consider RPC generate covered, because it is overloaded in
|
# Consider RPC generate covered, because it is overloaded in
|
||||||
# test_framework/test_node.py and not seen by the coverage check.
|
# test_framework/test_node.py and not seen by the coverage check.
|
||||||
covered_cmds = set({'generate'})
|
covered_cmds = set({'generate'})
|
||||||
# TODO: implement functional tests for coinjoinsalt
|
|
||||||
covered_cmds.add('coinjoinsalt')
|
|
||||||
# TODO: implement functional tests for voteraw
|
# TODO: implement functional tests for voteraw
|
||||||
covered_cmds.add('voteraw')
|
covered_cmds.add('voteraw')
|
||||||
# TODO: implement functional tests for getmerkleblocks
|
# TODO: implement functional tests for getmerkleblocks
|
||||||
|
@ -135,9 +135,9 @@ class WalletBackupTest(BitcoinTestFramework):
|
|||||||
assert os.path.exists(wallet_file)
|
assert os.path.exists(wallet_file)
|
||||||
|
|
||||||
def init_three(self):
|
def init_three(self):
|
||||||
self.init_wallet(0)
|
self.init_wallet(node=0)
|
||||||
self.init_wallet(1)
|
self.init_wallet(node=1)
|
||||||
self.init_wallet(2)
|
self.init_wallet(node=2)
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self.log.info("Generating initial blockchain")
|
self.log.info("Generating initial blockchain")
|
||||||
|
@ -23,7 +23,7 @@ class ListDescriptorsTest(BitcoinTestFramework):
|
|||||||
self.skip_if_no_sqlite()
|
self.skip_if_no_sqlite()
|
||||||
|
|
||||||
# do not create any wallet by default
|
# do not create any wallet by default
|
||||||
def init_wallet(self, i):
|
def init_wallet(self, *, node):
|
||||||
return
|
return
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
@ -239,5 +239,16 @@ class UpgradeWalletTest(BitcoinTestFramework):
|
|||||||
desc_wallet = self.nodes[0].get_wallet_rpc("desc_upgrade")
|
desc_wallet = self.nodes[0].get_wallet_rpc("desc_upgrade")
|
||||||
self.test_upgradewallet(desc_wallet, previous_version=120200, expected_version=120200)
|
self.test_upgradewallet(desc_wallet, previous_version=120200, expected_version=120200)
|
||||||
|
|
||||||
|
self.log.info("Checking that descriptor wallets without privkeys do nothing, successfully")
|
||||||
|
self.nodes[0].createwallet(wallet_name="desc_upgrade_nopriv", descriptors=True, disable_private_keys=True)
|
||||||
|
desc_wallet = self.nodes[0].get_wallet_rpc("desc_upgrade_nopriv")
|
||||||
|
self.test_upgradewallet(desc_wallet, previous_version=120200, expected_version=120200)
|
||||||
|
|
||||||
|
if self.is_bdb_compiled():
|
||||||
|
self.log.info("Upgrading a wallet with private keys disabled")
|
||||||
|
self.nodes[0].createwallet(wallet_name="privkeys_disabled_upgrade", disable_private_keys=True, descriptors=False)
|
||||||
|
disabled_wallet = self.nodes[0].get_wallet_rpc("privkeys_disabled_upgrade")
|
||||||
|
self.test_upgradewallet(disabled_wallet, previous_version=120200, expected_version=120200)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
UpgradeWalletTest().main()
|
UpgradeWalletTest().main()
|
||||||
|
@ -48,7 +48,6 @@ implicit-integer-sign-change:*/include/c++/
|
|||||||
implicit-integer-sign-change:*/new_allocator.h
|
implicit-integer-sign-change:*/new_allocator.h
|
||||||
implicit-integer-sign-change:addrman.h
|
implicit-integer-sign-change:addrman.h
|
||||||
implicit-integer-sign-change:bech32.cpp
|
implicit-integer-sign-change:bech32.cpp
|
||||||
implicit-integer-sign-change:common/bloom.cpp
|
|
||||||
implicit-integer-sign-change:chain.cpp
|
implicit-integer-sign-change:chain.cpp
|
||||||
implicit-integer-sign-change:chain.h
|
implicit-integer-sign-change:chain.h
|
||||||
implicit-integer-sign-change:compat/stdin.cpp
|
implicit-integer-sign-change:compat/stdin.cpp
|
||||||
|
@ -425,6 +425,30 @@
|
|||||||
"output_cmp": "txcreatedata2.json",
|
"output_cmp": "txcreatedata2.json",
|
||||||
"description": "Creates a new transaction with one input, one address output and one data (zero value) output (output in json)"
|
"description": "Creates a new transaction with one input, one address output and one data (zero value) output (output in json)"
|
||||||
},
|
},
|
||||||
|
{ "exec": "./dash-tx",
|
||||||
|
"args":
|
||||||
|
["-create",
|
||||||
|
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:11aa"],
|
||||||
|
"return_code": 1,
|
||||||
|
"error_txt": "error: invalid TX sequence id '11aa'",
|
||||||
|
"description": "Try to parse a sequence number outside the allowed range"
|
||||||
|
},
|
||||||
|
{ "exec": "./dash-tx",
|
||||||
|
"args":
|
||||||
|
["-create",
|
||||||
|
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:-1"],
|
||||||
|
"return_code": 1,
|
||||||
|
"error_txt": "error: invalid TX sequence id '-1'",
|
||||||
|
"description": "Try to parse a sequence number outside the allowed range"
|
||||||
|
},
|
||||||
|
{ "exec": "./dash-tx",
|
||||||
|
"args":
|
||||||
|
["-create",
|
||||||
|
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:4294967296"],
|
||||||
|
"return_code": 1,
|
||||||
|
"error_txt": "error: invalid TX sequence id '4294967296'",
|
||||||
|
"description": "Try to parse a sequence number outside the allowed range"
|
||||||
|
},
|
||||||
{ "exec": "./dash-tx",
|
{ "exec": "./dash-tx",
|
||||||
"args":
|
"args":
|
||||||
["-create",
|
["-create",
|
||||||
@ -433,6 +457,14 @@
|
|||||||
"output_cmp": "txcreatedata_seq0.hex",
|
"output_cmp": "txcreatedata_seq0.hex",
|
||||||
"description": "Creates a new transaction with one input with sequence number and one address output"
|
"description": "Creates a new transaction with one input with sequence number and one address output"
|
||||||
},
|
},
|
||||||
|
{ "exec": "./dash-tx",
|
||||||
|
"args":
|
||||||
|
["-create",
|
||||||
|
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0: 4294967293 ",
|
||||||
|
"outaddr=0.18:XijDvbYpPmznwgpWD3DkdYNfGmRP2KoVSk"],
|
||||||
|
"output_cmp": "txcreatedata_seq0.hex",
|
||||||
|
"description": "Creates a new transaction with one input with sequence number (+whitespace) and one address output"
|
||||||
|
},
|
||||||
{ "exec": "./dash-tx",
|
{ "exec": "./dash-tx",
|
||||||
"args":
|
"args":
|
||||||
["-json",
|
["-json",
|
||||||
@ -457,15 +489,27 @@
|
|||||||
"output_cmp": "txcreatedata_seq1.json",
|
"output_cmp": "txcreatedata_seq1.json",
|
||||||
"description": "Adds a new input with sequence number to a transaction (output in json)"
|
"description": "Adds a new input with sequence number to a transaction (output in json)"
|
||||||
},
|
},
|
||||||
|
{ "exec": "./dash-tx",
|
||||||
|
"args": ["-create", "outmultisig=1:-2:3:02a5:021:02df", "nversion=1"],
|
||||||
|
"return_code": 1,
|
||||||
|
"error_txt": "error: invalid multisig required number '-2'",
|
||||||
|
"description": "Try to parse a multisig number outside the allowed range"
|
||||||
|
},
|
||||||
|
{ "exec": "./dash-tx",
|
||||||
|
"args": ["-create", "outmultisig=1:2:3a:02a5:021:02df", "nversion=1"],
|
||||||
|
"return_code": 1,
|
||||||
|
"error_txt": "error: invalid multisig total number '3a'",
|
||||||
|
"description": "Try to parse a multisig number outside the allowed range"
|
||||||
|
},
|
||||||
{ "exec": "./dash-tx",
|
{ "exec": "./dash-tx",
|
||||||
"args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485", "nversion=1"],
|
"args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485", "nversion=1"],
|
||||||
"output_cmp": "txcreatemultisig1.hex",
|
"output_cmp": "txcreatemultisig1.hex",
|
||||||
"description": "Creates a new transaction with a single 2-of-3 multisig output"
|
"description": "Creates a new transaction with a single 2-of-3 multisig output"
|
||||||
},
|
},
|
||||||
{ "exec": "./dash-tx",
|
{ "exec": "./dash-tx",
|
||||||
"args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485", "nversion=1"],
|
"args": ["-json", "-create", "outmultisig=1: 2: 3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485", "nversion=1"],
|
||||||
"output_cmp": "txcreatemultisig1.json",
|
"output_cmp": "txcreatemultisig1.json",
|
||||||
"description": "Creates a new transaction with a single 2-of-3 multisig output (output in json)"
|
"description": "Creates a new transaction with a single 2-of-3 multisig output (with whitespace, output in json)"
|
||||||
},
|
},
|
||||||
{ "exec": "./dash-tx",
|
{ "exec": "./dash-tx",
|
||||||
"args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:S", "nversion=1"],
|
"args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:S", "nversion=1"],
|
||||||
|
Loading…
Reference in New Issue
Block a user