Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a60584e9ec | |||
| 00b6dabc78 | |||
| 0d33214557 | |||
| d68afc1868 | |||
| e95cc65c43 | |||
| 8cc49350f8 | |||
| 5bd55a5ec6 | |||
| dd2812f1e5 | |||
| 92dfde8a3e | |||
| 6dcdbe0f15 | |||
| dd7e2a477f | |||
| a4459d6207 | |||
| 2581b4c2da | |||
| 28ee73b9e4 | |||
| 4b18bb6ea4 | |||
| 921611ff4d | |||
| fb8e2a71e0 | |||
| ecdaa83669 | |||
| cf325e0e76 | |||
| 94da2e8dff | |||
| 8071ff985f | |||
| a365cfca31 | |||
| d7cd9d24fc | |||
| 7b1b526988 | |||
| 86962eb7aa | |||
| 1029faa02f | |||
| 4a9ccaa62d | |||
| fd0a7ea0c7 | |||
| c0d1070395 | |||
| 180b7edd77 | |||
| 09f5a89a12 | |||
| b1d59a6def | |||
| 3be1d87462 | |||
| 8fa00efa7b |
@@ -43,7 +43,7 @@ jobs:
|
||||
shell: alpine.sh {0}
|
||||
run: |
|
||||
cd external/src/curl
|
||||
cmake . -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF
|
||||
cmake . -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -193,7 +193,7 @@ jobs:
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
cmake . -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF
|
||||
cmake . -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -272,7 +272,7 @@ jobs:
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF
|
||||
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -361,7 +361,7 @@ jobs:
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
cmake . -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_C_FLAGS="-Os ${{ matrix.config.flags }}" -DCURL_TARGET_WINDOWS_VERSION=0x0600 -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF
|
||||
cmake . -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_C_FLAGS="-Os ${{ matrix.config.flags }}" -DCURL_TARGET_WINDOWS_VERSION=0x0600 -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -502,7 +502,7 @@ jobs:
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
cmake . -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF
|
||||
cmake . -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF
|
||||
make -j4
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -570,7 +570,7 @@ jobs:
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
cmake . -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-Os -target arm64-apple-macos-11" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF
|
||||
cmake . -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-Os -target arm64-apple-macos-11" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF
|
||||
make -j3
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -660,7 +660,7 @@ jobs:
|
||||
run: |
|
||||
sudo pkg install -y cmake
|
||||
cd external/src/curl
|
||||
cmake . -DCMAKE_C_FLAGS="-Os -flto" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF
|
||||
cmake . -DCMAKE_C_FLAGS="-Os -flto" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF
|
||||
make -j4
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
cd ../../libuv
|
||||
|
||||
@@ -15,7 +15,7 @@ on:
|
||||
jobs:
|
||||
cppcheck-ubuntu:
|
||||
|
||||
timeout-minutes: 120
|
||||
timeout-minutes: 180
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
@@ -48,12 +48,14 @@ jobs:
|
||||
./run.sh
|
||||
|
||||
- name: Archive full error list
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: errors_full-linux
|
||||
path: cppcheck/errors_full.txt
|
||||
|
||||
- name: Archive checkers report
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: checkers_report-linux
|
||||
@@ -96,12 +98,14 @@ jobs:
|
||||
./run.cmd
|
||||
|
||||
- name: Archive full error list
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: errors_full-windows
|
||||
path: cppcheck/errors_full.txt
|
||||
|
||||
- name: Archive checkers report
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: checkers_report-windows
|
||||
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
cmake . -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF
|
||||
cmake . -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
python ../tests/src/stratum_dummy.py 2 &
|
||||
python ../tests/src/stratum_dummy.py 3 &
|
||||
sudo sysctl vm.mmap_rnd_bits=28
|
||||
TSAN_OPTIONS="suppressions=../tests/src/tsan_sup.txt halt_on_error=1" ./p2pool --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||
TSAN_OPTIONS="suppressions=../tests/src/tsan_sup.txt halt_on_error=1 history_size=4" ./p2pool --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||
|
||||
- name: Check p2pool.log
|
||||
run: |
|
||||
@@ -119,7 +119,7 @@ jobs:
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
cmake . -DCMAKE_C_COMPILER=clang-19 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g' -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF
|
||||
cmake . -DCMAKE_C_COMPILER=clang-19 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g' -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -280,15 +280,10 @@ jobs:
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install pyenv
|
||||
pyenv install 3:latest
|
||||
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
cmake . -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF
|
||||
cmake . -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF
|
||||
make -j4
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
|
||||
+11
-1
@@ -1,9 +1,19 @@
|
||||
@echo off
|
||||
"..\cppcheck-main\bin\cppcheck.exe" ../src/*.cpp -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN -D_WIN32=1 -D_WIN64=1 -DWIN32=1 -D_WINDOWS=1 -DNDEBUG=1 -DWITH_GRPC=1 -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0 -DWITH_RANDOMX=1 -DWITH_UPNP=1 -DCURL_STATICLIB=1 -DWIN32_LEAN_AND_MEAN=1 -D_WIN32_WINNT=0x0600 -D_DISABLE_VECTOR_ANNOTATION=1 -D_DISABLE_STRING_ANNOTATION=1 -DZMQ_STATIC=1 -DHAVE_BITSCANREVERSE64=1 -DRAPIDJSON_PARSE_DEFAULT_FLAGS=kParseTrailingCommasFlag -DMINIUPNP_STATICLIB=1 -DCARES_STATICLIB=1 -DCMAKE_INTDIR="Release" -D__SSE2__=1 -D_MSC_VER=1929 -D__COVERITY__ --platform=win64 --std=c++17 --enable=all --inconclusive --inline-suppr --template="{file}:{line}:{id}{inconclusive: INCONCLUSIVE} {message}" --includes-file=includes.txt --suppressions-list=suppressions.txt --output-file=errors_full.txt --max-ctu-depth=3 --check-level=exhaustive --checkers-report=checkers_report.txt
|
||||
"..\cppcheck-main\bin\cppcheck.exe" ../src/*.cpp -D__cppcheck__ -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN -D_WIN32=1 -D_WIN64=1 -DWIN32=1 -D_WINDOWS=1 -DNDEBUG=1 -DWITH_GRPC=1 -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0 -DWITH_RANDOMX=1 -DWITH_UPNP=1 -DCURL_STATICLIB=1 -DWIN32_LEAN_AND_MEAN=1 -D_WIN32_WINNT=0x0600 -D_DISABLE_VECTOR_ANNOTATION=1 -D_DISABLE_STRING_ANNOTATION=1 -DZMQ_STATIC=1 -DHAVE_BITSCANREVERSE64=1 -DRAPIDJSON_PARSE_DEFAULT_FLAGS=kParseTrailingCommasFlag -DMINIUPNP_STATICLIB=1 -DCARES_STATICLIB=1 -DCMAKE_INTDIR="Release" -D__SSE2__=1 -D_MSC_VER=1929 --platform=win64 --std=c++17 --enable=all --inconclusive --inline-suppr --template="{file}:{line}:{id}{inconclusive: INCONCLUSIVE} {message}" --includes-file=includes.txt --suppressions-list=suppressions.txt --output-file=errors_full.txt --max-ctu-depth=3 --check-level=exhaustive --checkers-report=checkers_report.txt
|
||||
|
||||
findstr /V /C:"external\src" errors_full.txt > errors_filtered0.txt
|
||||
findstr /V /C:":checkersReport" errors_filtered0.txt > errors_filtered.txt
|
||||
|
||||
findstr /C:"There were critical errors" checkers_report.txt > checkers_report_filtered.txt
|
||||
|
||||
for /f %%i in ("errors_filtered.txt") do set size=%%~zi
|
||||
if %size% gtr 0 (
|
||||
type errors_filtered.txt
|
||||
exit 1
|
||||
)
|
||||
|
||||
for /f %%i in ("checkers_report_filtered.txt") do set size2=%%~zi
|
||||
if %size2% gtr 0 (
|
||||
type checkers_report_filtered.txt
|
||||
exit 1
|
||||
)
|
||||
|
||||
+10
-1
@@ -1,8 +1,17 @@
|
||||
#!/bin/bash
|
||||
../cppcheck-main/cppcheck --project=../build/compile_commands.json -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN -D__SSE2__=1 -D__BYTE_ORDER__=1 -D__ORDER_LITTLE_ENDIAN__=1 -D__linux__=1 --platform=unix64 --std=c++17 --enable=all --inconclusive --inline-suppr --template="{file}:{line}:{id}{inconclusive: INCONCLUSIVE} {message}" --suppressions-list=suppressions.txt --output-file=errors_full.txt --max-ctu-depth=3 --check-level=exhaustive --checkers-report=checkers_report.txt
|
||||
../cppcheck-main/cppcheck --project=../build/compile_commands.json -D__cppcheck__ -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN -DRAPIDJSON_64BIT=1 -D__SSE2__=1 -D__BYTE_ORDER__=1 -D__ORDER_LITTLE_ENDIAN__=1 -D__linux__=1 -D__x86_64 -D_M_AMD64 -D_M_X64 --platform=unix64 --std=c++17 --enable=all --inconclusive --inline-suppr --template="{file}:{line}:{id}{inconclusive: INCONCLUSIVE} {message}" --suppressions-list=suppressions.txt --output-file=errors_full.txt --max-ctu-depth=3 --check-level=exhaustive --checkers-report=checkers_report.txt
|
||||
|
||||
grep -v 'external' errors_full.txt > errors_filtered0.txt
|
||||
grep -v ':checkersReport' errors_filtered0.txt > errors_filtered.txt
|
||||
|
||||
grep 'There were critical errors' checkers_report.txt > checkers_report_filtered.txt
|
||||
|
||||
if [ -s errors_filtered.txt ]; then
|
||||
cat errors_filtered.txt
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -s checkers_report_filtered.txt ]; then
|
||||
cat checkers_report_filtered.txt
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
npyscreen==4.10.5
|
||||
MarkupSafe==2.0.1
|
||||
jinja2==3.1.4
|
||||
jinja2==3.1.5
|
||||
|
||||
@@ -5,4 +5,6 @@ COPY app /app
|
||||
WORKDIR /app
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
STOPSIGNAL SIGINT
|
||||
|
||||
CMD ["/app/p2pool_statistics.py"]
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
--addpeers Comma-separated list of IP:port of other p2pool nodes to connect to
|
||||
--light-mode Don't allocate RandomX dataset, saves 2GB of RAM
|
||||
--loglevel Verbosity of the log, integer number between 0 and 6
|
||||
--config Name of p2pool sidechain's config file (don't use it unless you want to mine to a different p2pool chain)
|
||||
--data-api Path to the p2pool JSON data (use it in tandem with an external web-server)
|
||||
--data-dir Path to store general p2pool files (log, cache, peer data, etc.), default is current directory
|
||||
--config Deprecated, will be removed in the next version. Use --sidechain-config instead
|
||||
--sidechain-config Name of the p2pool sidechain parameters file (only use it if you run your own sidechain)
|
||||
--data-api Path to the p2pool JSON data (use it in tandem with an external web-server). Not affected by --data-dir setting!
|
||||
--local-api Enable /local/ path in api path for Stratum Server and built-in miner statistics
|
||||
--stratum-api An alias for --local-api
|
||||
--no-cache Disable p2pool.cache
|
||||
@@ -33,6 +35,7 @@
|
||||
--version Print p2pool's version and build details
|
||||
--tls-cert file Load TLS certificate chain from "file" in the PEM format
|
||||
--tls-cert-key file Load TLS certificate private key from "file" in the PEM format
|
||||
--no-stratum-http Disable HTTP on Stratum ports
|
||||
```
|
||||
|
||||
### Example command line
|
||||
|
||||
@@ -281,7 +281,7 @@ It's highly recommended to create a new wallet for mining because wallet address
|
||||
<details><summary>Help and support</summary>
|
||||
P2Pool is a decentralized community, there is no dedicated support. You can reach and get help from other miners on:
|
||||
<ul>
|
||||
<li>IRC channels: <span>#monero-pools</span> and <span>#p2pool-log</span> (<span>#p2pool-mini</span> for P2Pool mini) on <a href="https://libera.chat/" target="_blank">Libera.Chat</a>
|
||||
<li>IRC channels: <span>#p2pool-log</span> (<span>#p2pool-mini</span> for P2Pool mini) on <a href="https://libera.chat/" target="_blank">Libera.Chat</a>
|
||||
<li>Reddit: <a href="https://reddit.com/r/MoneroMining/" target="_blank">r/MoneroMining</a>
|
||||
</ul></details>
|
||||
</td></tr></table>
|
||||
@@ -310,7 +310,7 @@ P2Pool is a decentralized community, there is no dedicated support. You can reac
|
||||
<br><br>
|
||||
<div style="position:fixed;width:100%;bottom:0;background-color:#383838;font-size:1rem;text-align:center;color:#b0b0b0;">
|
||||
<a href="api/" target="_blank">Pool API</a> | <a href="https://github.com/SChernykh/p2pool" target="_blank">Source</a> | <a href="http://yucmgsbw7nknw7oi3bkuwudvc657g2xcqahhbjyewazusyytapqo4xid.onion/" target="_blank">Onion URL</a><br>
|
||||
Donate to support the project:<br><a href="monero:44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg?tx_description=Donation%20to%20P2Pool" style="font-size:0.9rem;color:#b0b0b0;">44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg</a><br>
|
||||
Donate to support the project:<br><span style="font-size:0.9rem;color:#b0b0b0;">44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg</span><br>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -281,7 +281,7 @@ It's highly recommended to create a new wallet for mining because wallet address
|
||||
<details><summary>Help and support</summary>
|
||||
P2Pool is a decentralized community, there is no dedicated support. You can reach and get help from other miners on:
|
||||
<ul>
|
||||
<li>IRC channels: <span>#monero-pools</span> and <span>#p2pool-log</span> (<span>#p2pool-mini</span> for P2Pool mini) on <a href="https://libera.chat/" target="_blank">Libera.Chat</a>
|
||||
<li>IRC channels: <span>#p2pool-log</span> (<span>#p2pool-mini</span> for P2Pool mini) on <a href="https://libera.chat/" target="_blank">Libera.Chat</a>
|
||||
<li>Reddit: <a href="https://reddit.com/r/MoneroMining/" target="_blank">r/MoneroMining</a>
|
||||
</ul></details>
|
||||
</td></tr></table>
|
||||
@@ -310,7 +310,7 @@ P2Pool is a decentralized community, there is no dedicated support. You can reac
|
||||
<br><br>
|
||||
<div style="position:fixed;width:100%;bottom:0;background-color:#383838;font-size:1rem;text-align:center;color:#b0b0b0;">
|
||||
<a href="api/" target="_blank">Pool API</a> | <a href="https://github.com/SChernykh/p2pool" target="_blank">Source</a> | <a href="http://yucmgsbw7nknw7oi3bkuwudvc657g2xcqahhbjyewazusyytapqo4xid.onion/mini/" target="_blank">Onion URL</a><br>
|
||||
Donate to support the project:<br><a href="monero:44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg?tx_description=Donation%20to%20P2Pool" style="font-size:0.9rem;color:#b0b0b0;">44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg</a><br>
|
||||
Donate to support the project:<br><span style="font-size:0.9rem;color:#b0b0b0;">44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg</span><br>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
+1
-1
Submodule external/src/curl updated: 7eb8c04847...75a2079d5c
Vendored
+1
-1
Submodule external/src/grpc updated: 70cfb88491...cad26a7244
Vendored
+1
-1
Submodule external/src/miniupnp updated: a2eda5c4db...a047c4cdc6
Vendored
+1
-1
Submodule external/src/rapidjson updated: 5eb4b2335a...a6f1188841
+9
-4
@@ -19,6 +19,7 @@
|
||||
#include "block_cache.h"
|
||||
#include "pool_block.h"
|
||||
#include "p2p_server.h"
|
||||
#include "side_chain.h"
|
||||
|
||||
LOG_CATEGORY(BlockCache)
|
||||
|
||||
@@ -35,9 +36,11 @@ struct BlockCache::Impl : public nocopy_nomove
|
||||
|
||||
Impl()
|
||||
{
|
||||
m_fd = open(cache_name, O_RDWR | O_CREAT, static_cast<mode_t>(0600));
|
||||
const std::string cache_path = DATA_DIR + cache_name;
|
||||
|
||||
m_fd = open(cache_path.c_str(), O_RDWR | O_CREAT, static_cast<mode_t>(0600));
|
||||
if (m_fd == -1) {
|
||||
LOGERR(1, "couldn't open/create " << cache_name);
|
||||
LOGERR(1, "couldn't open/create " << cache_path << ": error " << errno);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -86,11 +89,12 @@ struct BlockCache::Impl : public nocopy_nomove
|
||||
#elif defined(_WIN32)
|
||||
|
||||
Impl()
|
||||
: m_file(CreateFile(cache_name, GENERIC_ALL, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL))
|
||||
: m_cachePath(DATA_DIR + cache_name)
|
||||
, m_file(CreateFile(m_cachePath.c_str(), GENERIC_ALL, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL))
|
||||
, m_map(0)
|
||||
{
|
||||
if (m_file == INVALID_HANDLE_VALUE) {
|
||||
LOGERR(1, "couldn't open " << cache_name << ", error " << static_cast<uint32_t>(GetLastError()));
|
||||
LOGERR(1, "couldn't open " << m_cachePath << ": error " << static_cast<uint32_t>(GetLastError()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -141,6 +145,7 @@ struct BlockCache::Impl : public nocopy_nomove
|
||||
}
|
||||
}
|
||||
|
||||
std::string m_cachePath;
|
||||
HANDLE m_file;
|
||||
HANDLE m_map;
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ static void do_status(p2pool *m_pool, const char * /* args */)
|
||||
|
||||
m_pool->print_merge_mining_status();
|
||||
|
||||
bkg_jobs_tracker.print_status();
|
||||
bkg_jobs_tracker->print_status();
|
||||
|
||||
if (p2p) {
|
||||
p2p->check_for_updates(true);
|
||||
@@ -313,7 +313,7 @@ static void do_stop_mining(p2pool* m_pool, const char* /*args*/)
|
||||
|
||||
static void do_exit(p2pool *m_pool, const char * /* args */)
|
||||
{
|
||||
bkg_jobs_tracker.wait();
|
||||
bkg_jobs_tracker->wait();
|
||||
m_pool->stop();
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ void ConsoleCommands::stdinReadCallback(uv_stream_t* stream, ssize_t nread, cons
|
||||
}
|
||||
|
||||
|
||||
void ConsoleCommands::process_input(std::string& command, char* data, uint32_t size)
|
||||
void ConsoleCommands::process_input(std::string& command, const char* data, uint32_t size)
|
||||
{
|
||||
command.append(data, size);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
size_t size() const override { return sizeof(ConsoleClient); }
|
||||
|
||||
bool on_connect() override { return true; };
|
||||
bool on_read(char* data, uint32_t size) override { static_cast<ConsoleCommands*>(m_owner)->process_input(m_command, data, size); return true; };
|
||||
bool on_read(const char* data, uint32_t size) override { static_cast<ConsoleCommands*>(m_owner)->process_input(m_command, data, size); return true; };
|
||||
|
||||
char m_consoleReadBuf[1024] = {};
|
||||
|
||||
@@ -66,7 +66,7 @@ private:
|
||||
static void allocCallback(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf);
|
||||
static void stdinReadCallback(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf);
|
||||
|
||||
void process_input(std::string& command, char* data, uint32_t size);
|
||||
void process_input(std::string& command, const char* data, uint32_t size);
|
||||
};
|
||||
|
||||
} // namespace p2pool
|
||||
|
||||
+15
-7
@@ -37,9 +37,7 @@ class RandomBytes
|
||||
public:
|
||||
RandomBytes() : rng(RandomDeviceSeed::instance), dist(0, 255)
|
||||
{
|
||||
if (uv_mutex_init(&m) != 0) {
|
||||
abort();
|
||||
}
|
||||
uv_mutex_init_checked(&m);
|
||||
|
||||
// Diffuse the initial state in case it has low quality
|
||||
rng.discard(10000);
|
||||
@@ -66,7 +64,7 @@ private:
|
||||
std::uniform_int_distribution<> dist;
|
||||
};
|
||||
|
||||
static RandomBytes randomBytes;
|
||||
static RandomBytes* randomBytes = nullptr;
|
||||
|
||||
}
|
||||
|
||||
@@ -86,7 +84,7 @@ static FORCEINLINE bool less32(const uint8_t* k0, const uint8_t* k1)
|
||||
void generate_keys(hash& pub, hash& sec)
|
||||
{
|
||||
do {
|
||||
do { randomBytes(sec.h); } while (!less32(sec.h, limit));
|
||||
do { (*randomBytes)(sec.h); } while (!less32(sec.h, limit));
|
||||
sc_reduce32(sec.h);
|
||||
} while (!sc_isnonzero(sec.h));
|
||||
|
||||
@@ -472,6 +470,10 @@ void derive_view_tag(const hash& derivation, size_t output_index, uint8_t& view_
|
||||
|
||||
void init_crypto_cache()
|
||||
{
|
||||
if (!randomBytes) {
|
||||
randomBytes = new RandomBytes();
|
||||
}
|
||||
|
||||
if (!cache) {
|
||||
cache = new Cache();
|
||||
}
|
||||
@@ -479,9 +481,15 @@ void init_crypto_cache()
|
||||
|
||||
void destroy_crypto_cache()
|
||||
{
|
||||
if (cache) {
|
||||
delete cache;
|
||||
{
|
||||
auto p = randomBytes;
|
||||
randomBytes = nullptr;
|
||||
delete p;
|
||||
}
|
||||
{
|
||||
auto p = cache;
|
||||
cache = nullptr;
|
||||
delete p;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-8
@@ -116,17 +116,14 @@ NOINLINE void keccakf_plain(std::array<uint64_t, 25>& st)
|
||||
}
|
||||
}
|
||||
|
||||
void (*keccakf)(std::array<uint64_t, 25>&) = keccakf_plain;
|
||||
|
||||
keccakf_func keccakf = []() {
|
||||
#if defined(__x86_64__) || defined(_M_AMD64)
|
||||
static struct KeccakBMI_Check {
|
||||
KeccakBMI_Check() {
|
||||
if (randomx::Cpu().hasBmi()) {
|
||||
keccakf = keccakf_bmi;
|
||||
}
|
||||
if (randomx::Cpu().hasBmi()) {
|
||||
return keccakf_bmi;
|
||||
}
|
||||
} keccak_bmi_check;
|
||||
#endif
|
||||
return keccakf_plain;
|
||||
}();
|
||||
|
||||
NOINLINE void keccak_step(const uint8_t* &in, int &inlen, std::array<uint64_t, 25>& st)
|
||||
{
|
||||
|
||||
+3
-1
@@ -25,7 +25,9 @@ enum KeccakParams {
|
||||
};
|
||||
|
||||
extern const uint64_t keccakf_rndc[24];
|
||||
extern void (*keccakf)(std::array<uint64_t, 25>& st);
|
||||
|
||||
typedef void (*keccakf_func)(std::array<uint64_t, 25>&);
|
||||
extern keccakf_func keccakf;
|
||||
|
||||
void keccakf_plain(std::array<uint64_t, 25>& st);
|
||||
void keccakf_bmi(std::array<uint64_t, 25>& st);
|
||||
|
||||
+35
-42
@@ -117,38 +117,28 @@ public:
|
||||
FORCEINLINE Worker()
|
||||
: m_writePos(0)
|
||||
, m_readPos(0)
|
||||
, m_started{ false }
|
||||
, m_stopped(false)
|
||||
{
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && !defined(NDEBUG)
|
||||
SetUnhandledExceptionFilter(UnhandledExceptionFilter);
|
||||
SymInitialize(GetCurrentProcess(), NULL, TRUE);
|
||||
#endif
|
||||
|
||||
set_main_thread();
|
||||
|
||||
std::setlocale(LC_ALL, "en_001");
|
||||
|
||||
m_logFile.open(log_file_name, std::ios::app | std::ios::binary);
|
||||
m_logFilePath = DATA_DIR + log_file_name;
|
||||
m_logFile.open(m_logFilePath, std::ios::app | std::ios::binary);
|
||||
|
||||
if (!m_logFile.is_open()) {
|
||||
fprintf(stderr, "failed to open %s: error %d\n", m_logFilePath.c_str(), errno);
|
||||
}
|
||||
|
||||
m_buf.resize(BUF_SIZE);
|
||||
|
||||
// Create default loop here
|
||||
uv_default_loop();
|
||||
|
||||
uv_cond_init(&m_cond);
|
||||
uv_mutex_init(&m_mutex);
|
||||
|
||||
const int err = uv_thread_create(&m_worker, run_wrapper, this);
|
||||
if (err) {
|
||||
fprintf(stderr, "failed to start logger thread (%s), aborting\n", uv_err_name(err));
|
||||
abort();
|
||||
}
|
||||
|
||||
while (m_started.load() == false) {
|
||||
std::this_thread::yield();
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
SetConsoleMode(hStdIn, ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_EXTENDED_FLAGS);
|
||||
|
||||
@@ -163,13 +153,13 @@ public:
|
||||
CONSOLE_COLORS = false;
|
||||
}
|
||||
|
||||
LOGINFO(0, "started");
|
||||
|
||||
if (!m_logFile.is_open()) {
|
||||
LOGERR(0, "failed to open " << log_file_name);
|
||||
}
|
||||
|
||||
init_uv_threadpool();
|
||||
|
||||
const int err = uv_thread_create(&m_worker, run_wrapper, this);
|
||||
if (err) {
|
||||
fprintf(stderr, "failed to start logger thread (%s), aborting\n", uv_err_name(err));
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
~Worker()
|
||||
@@ -196,17 +186,8 @@ public:
|
||||
uv_thread_join(&m_worker);
|
||||
uv_cond_destroy(&m_cond);
|
||||
uv_mutex_destroy(&m_mutex);
|
||||
uv_loop_close(uv_default_loop());
|
||||
|
||||
#if ((UV_VERSION_MAJOR > 1) || ((UV_VERSION_MAJOR == 1) && (UV_VERSION_MINOR >= 38)))
|
||||
uv_library_shutdown();
|
||||
#endif
|
||||
|
||||
m_logFile.close();
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && !defined(NDEBUG)
|
||||
SymCleanup(GetCurrentProcess());
|
||||
#endif
|
||||
}
|
||||
|
||||
FORCEINLINE void write(const char* buf, uint32_t size)
|
||||
@@ -236,6 +217,8 @@ public:
|
||||
uv_cond_signal(&m_cond);
|
||||
}
|
||||
|
||||
const std::string& log_file_path() const { return m_logFilePath; }
|
||||
|
||||
private:
|
||||
static void init_uv_threadpool()
|
||||
{
|
||||
@@ -252,13 +235,13 @@ private:
|
||||
int err = putenv(buf);
|
||||
if (err != 0) {
|
||||
err = errno;
|
||||
LOGWARN(0, "Couldn't set UV thread pool size to " << N << " threads, putenv returned error " << err);
|
||||
fprintf(stderr, "Couldn't set UV thread pool size to %u threads, putenv returned error %d\n", N, err);
|
||||
}
|
||||
|
||||
static uv_work_t dummy;
|
||||
err = uv_queue_work(uv_default_loop_checked(), &dummy, [](uv_work_t*) {}, nullptr);
|
||||
if (err) {
|
||||
LOGERR(0, "init_uv_threadpool: uv_queue_work failed, error " << uv_err_name(err));
|
||||
fprintf(stderr, "init_uv_threadpool: uv_queue_work failed, error %s\n", uv_err_name(err));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,8 +250,6 @@ private:
|
||||
|
||||
NOINLINE void run()
|
||||
{
|
||||
m_started.exchange(true);
|
||||
|
||||
do {
|
||||
uv_mutex_lock(&m_mutex);
|
||||
if (m_readPos == m_writePos.load()) {
|
||||
@@ -346,9 +327,9 @@ private:
|
||||
|
||||
// Reopen the log file if it's been moved (logrotate support)
|
||||
struct stat buf;
|
||||
if (stat(log_file_name, &buf) != 0) {
|
||||
if (stat(m_logFilePath.c_str(), &buf) != 0) {
|
||||
m_logFile.close();
|
||||
m_logFile.open(log_file_name, std::ios::app | std::ios::binary);
|
||||
m_logFile.open(m_logFilePath, std::ios::app | std::ios::binary);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,13 +373,13 @@ private:
|
||||
uv_mutex_t m_mutex;
|
||||
uv_thread_t m_worker;
|
||||
|
||||
std::atomic<bool> m_started;
|
||||
bool m_stopped;
|
||||
|
||||
std::ofstream m_logFile;
|
||||
std::string m_logFilePath;
|
||||
};
|
||||
|
||||
static Worker worker;
|
||||
static Worker* worker = nullptr;
|
||||
|
||||
#endif // P2POOL_LOG_DISABLE
|
||||
|
||||
@@ -445,20 +426,32 @@ NOINLINE Writer::~Writer()
|
||||
m_buf[2] = static_cast<uint8_t>(size >> 8);
|
||||
m_buf[m_pos] = '\n';
|
||||
#ifndef P2POOL_LOG_DISABLE
|
||||
worker.write(m_buf, size);
|
||||
worker->write(m_buf, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
void start()
|
||||
{
|
||||
#ifndef P2POOL_LOG_DISABLE
|
||||
worker = new Worker();
|
||||
|
||||
LOGINFO(0, "started");
|
||||
#endif
|
||||
}
|
||||
|
||||
void reopen()
|
||||
{
|
||||
// This will trigger the worker thread which will then reopen log file if it's been moved
|
||||
LOGINFO(0, "reopening " << log_file_name);
|
||||
#ifndef P2POOL_LOG_DISABLE
|
||||
LOGINFO(0, "reopening " << worker->log_file_path());
|
||||
#endif
|
||||
}
|
||||
|
||||
void stop()
|
||||
{
|
||||
#ifndef P2POOL_LOG_DISABLE
|
||||
worker.stop();
|
||||
delete worker;
|
||||
worker = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -506,8 +506,8 @@ struct DummyStream
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef __COVERITY__
|
||||
// Coverity doesn't like this macro - CID 393138: Big parameter passed by value (PASS_BY_VALUE)
|
||||
#if defined(__COVERITY__) || defined(__cppcheck__)
|
||||
// Coverity and cppcheck don't like this macro - CID 393138: Big parameter passed by value (PASS_BY_VALUE)
|
||||
#define SIDE_EFFECT_CHECK(level, ...)
|
||||
#else
|
||||
#define SIDE_EFFECT_CHECK(level, ...) \
|
||||
@@ -547,6 +547,7 @@ struct DummyStream
|
||||
|
||||
#endif
|
||||
|
||||
void start();
|
||||
void reopen();
|
||||
void stop();
|
||||
|
||||
|
||||
+55
-2
@@ -21,11 +21,20 @@
|
||||
#include "stratum_server.h"
|
||||
#include "p2p_server.h"
|
||||
#include <curl/curl.h>
|
||||
#include <filesystem>
|
||||
|
||||
#ifdef WITH_RANDOMX
|
||||
#include "randomx.h"
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && !defined(NDEBUG)
|
||||
|
||||
#include <DbgHelp.h>
|
||||
|
||||
#pragma comment(lib, "Dbghelp.lib")
|
||||
|
||||
#endif
|
||||
|
||||
void p2pool_usage()
|
||||
{
|
||||
printf("P2Pool %s\n"
|
||||
@@ -39,8 +48,10 @@ void p2pool_usage()
|
||||
"--addpeers Comma-separated list of IP:port of other p2pool nodes to connect to\n"
|
||||
"--light-mode Don't allocate RandomX dataset, saves 2GB of RAM\n"
|
||||
"--loglevel Verbosity of the log, integer number between 0 and %d\n"
|
||||
"--config Name of the p2pool config file\n"
|
||||
"--data-api Path to the p2pool JSON data (use it in tandem with an external web-server)\n"
|
||||
"--data-dir Path to store general p2pool files (log, cache, peer data, etc.), default is current directory\n"
|
||||
"--config Deprecated, will be removed in the next version. Use --sidechain-config instead\n"
|
||||
"--sidechain-config Name of the p2pool sidechain parameters file (only use it if you run your own sidechain)\n"
|
||||
"--data-api Path to the p2pool JSON data (use it in tandem with an external web-server). Not affected by --data-dir setting!\n"
|
||||
"--local-api Enable /local/ path in api path for Stratum Server and built-in miner statistics\n"
|
||||
"--stratum-api An alias for --local-api\n"
|
||||
"--no-cache Disable p2pool.cache\n"
|
||||
@@ -68,6 +79,7 @@ void p2pool_usage()
|
||||
"--tls-cert file Load TLS certificate chain from \"file\" in the PEM format\n"
|
||||
"--tls-cert-key file Load TLS certificate private key from \"file\" in the PEM format\n"
|
||||
#endif
|
||||
"--no-stratum-http Disable HTTP on Stratum ports\n"
|
||||
"--help Show this help message\n\n"
|
||||
"Example command line:\n\n"
|
||||
"%s --host 127.0.0.1 --rpc-port 18081 --zmq-port 18083 --wallet YOUR_WALLET_ADDRESS --stratum 0.0.0.0:%d --p2p 0.0.0.0:%d\n\n",
|
||||
@@ -186,10 +198,39 @@ int main(int argc, char* argv[])
|
||||
if (!strcmp(argv[i], "--test")) {
|
||||
return p2pool_test();
|
||||
}
|
||||
|
||||
if ((strcmp(argv[i], "--data-dir") == 0) && (i + 1 < argc)) {
|
||||
std::string path = argv[++i];
|
||||
|
||||
if (!path.empty() && (path.back() != '/')
|
||||
#ifdef _WIN32
|
||||
&& (path.back() != '\\')
|
||||
#endif
|
||||
) {
|
||||
path.append(1, '/');
|
||||
}
|
||||
|
||||
p2pool::DATA_DIR = std::move(path);
|
||||
|
||||
// Try to create it if it doesn't exist
|
||||
if (!p2pool::DATA_DIR.empty()) {
|
||||
std::error_code err;
|
||||
std::filesystem::create_directories(p2pool::DATA_DIR, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && !defined(NDEBUG)
|
||||
SymInitialize(GetCurrentProcess(), NULL, TRUE);
|
||||
#endif
|
||||
|
||||
memory_tracking_start();
|
||||
|
||||
// Create default loop here
|
||||
uv_default_loop();
|
||||
|
||||
p2pool::log::start();
|
||||
|
||||
p2pool::init_crypto_cache();
|
||||
|
||||
int result = static_cast<int>(curl_global_init_mem(CURL_GLOBAL_ALL, p2pool::malloc_hook, p2pool::free_hook, p2pool::realloc_hook, p2pool::strdup_hook, p2pool::calloc_hook));
|
||||
@@ -209,9 +250,21 @@ int main(int argc, char* argv[])
|
||||
|
||||
p2pool::destroy_crypto_cache();
|
||||
|
||||
p2pool::log::stop();
|
||||
|
||||
uv_loop_close(uv_default_loop());
|
||||
|
||||
#if ((UV_VERSION_MAJOR > 1) || ((UV_VERSION_MAJOR == 1) && (UV_VERSION_MINOR >= 38)))
|
||||
uv_library_shutdown();
|
||||
#endif
|
||||
|
||||
if (!memory_tracking_stop()) {
|
||||
result = 1;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && !defined(NDEBUG)
|
||||
SymCleanup(GetCurrentProcess());
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <atomic>
|
||||
#include <type_traits>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <mutex>
|
||||
|
||||
#include <DbgHelp.h>
|
||||
|
||||
@@ -79,7 +81,7 @@ struct TrackedAllocation
|
||||
|
||||
static_assert(sizeof(TrackedAllocation) == 256, "");
|
||||
|
||||
uv_mutex_t allocation_lock;
|
||||
std::mutex allocation_lock;
|
||||
std::hash<void*> hasher;
|
||||
uint32_t first[N];
|
||||
uint32_t next[N];
|
||||
@@ -98,7 +100,7 @@ void show_top_10_allocations()
|
||||
const HANDLE h = GetCurrentProcess();
|
||||
|
||||
{
|
||||
p2pool::MutexLock lock(allocation_lock);
|
||||
std::lock_guard<std::mutex> lock(allocation_lock);
|
||||
|
||||
TrackedAllocation* end = buf;
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
@@ -173,7 +175,7 @@ FORCEINLINE static void add_alocation(void* p, size_t size)
|
||||
|
||||
const size_t index = hasher(p) & (N - 1);
|
||||
|
||||
p2pool::MutexLock lock(allocation_lock);
|
||||
std::lock_guard<std::mutex> lock(allocation_lock);
|
||||
|
||||
++num_allocations;
|
||||
if (num_allocations >= N / 2) {
|
||||
@@ -204,7 +206,7 @@ FORCEINLINE static void remove_allocation(void* p)
|
||||
return;
|
||||
}
|
||||
|
||||
p2pool::MutexLock lock(allocation_lock);
|
||||
std::lock_guard<std::mutex> lock(allocation_lock);
|
||||
|
||||
--num_allocations;
|
||||
|
||||
@@ -292,10 +294,14 @@ void memory_tracking_start()
|
||||
// Trigger std::ostream initialization to avoid reporting it as leaks
|
||||
std::cout << "Memory leak detection = " << 1 << std::endl;
|
||||
|
||||
// Trigger std::ofstream initialization to avoid reporting it as leaks
|
||||
{
|
||||
std::ofstream tmp("memory_tracking.tmp");
|
||||
}
|
||||
|
||||
using namespace p2pool;
|
||||
|
||||
uv_replace_allocator(malloc_hook, realloc_hook, calloc_hook, free_hook);
|
||||
uv_mutex_init_checked(&allocation_lock);
|
||||
track_memory = true;
|
||||
}
|
||||
|
||||
@@ -304,7 +310,6 @@ bool memory_tracking_stop()
|
||||
using namespace p2pool;
|
||||
|
||||
track_memory = false;
|
||||
uv_mutex_destroy(&allocation_lock);
|
||||
|
||||
const HANDLE h = GetCurrentProcess();
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "mempool.h"
|
||||
#include "util.h"
|
||||
|
||||
LOG_CATEGORY(Mempool)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "params.h"
|
||||
#include "json_rpc_request.h"
|
||||
#include "json_parsers.h"
|
||||
#include <rapidjson/document.h>
|
||||
#include "rapidjson_wrapper.h"
|
||||
|
||||
LOG_CATEGORY(MergeMiningClientJSON_RPC)
|
||||
|
||||
|
||||
@@ -574,7 +574,7 @@ bool MergeMiningClientTari::TariClient::on_connect()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MergeMiningClientTari::TariClient::on_read(char* data, uint32_t size)
|
||||
bool MergeMiningClientTari::TariClient::on_read(const char* data, uint32_t size)
|
||||
{
|
||||
MergeMiningClientTari::TariServer* server = static_cast<MergeMiningClientTari::TariServer*>(m_owner);
|
||||
if (!server) {
|
||||
|
||||
@@ -98,7 +98,7 @@ private:
|
||||
|
||||
void reset() override;
|
||||
[[nodiscard]] bool on_connect() override;
|
||||
[[nodiscard]] bool on_read(char* data, uint32_t size) override;
|
||||
[[nodiscard]] bool on_read(const char* data, uint32_t size) override;
|
||||
|
||||
char m_buf[BUF_SIZE];
|
||||
std::vector<uint8_t> m_pendingData;
|
||||
|
||||
+12
-10
@@ -28,7 +28,7 @@
|
||||
#include "block_template.h"
|
||||
#include "p2pool_api.h"
|
||||
#include "stratum_server.h"
|
||||
#include <rapidjson/document.h>
|
||||
#include "rapidjson_wrapper.h"
|
||||
#include <fstream>
|
||||
#include <numeric>
|
||||
|
||||
@@ -447,10 +447,12 @@ void P2PServer::save_peer_list_async()
|
||||
|
||||
void P2PServer::save_peer_list()
|
||||
{
|
||||
std::ofstream f(saved_peer_list_file_name, std::ios::binary);
|
||||
const std::string path = DATA_DIR + saved_peer_list_file_name;
|
||||
|
||||
std::ofstream f(path, std::ios::binary);
|
||||
|
||||
if (!f.is_open()) {
|
||||
LOGERR(1, "failed to save peer list " << saved_peer_list_file_name << ", error " << errno);
|
||||
LOGERR(1, "failed to save peer list " << path << ": error " << errno);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -579,7 +581,9 @@ void P2PServer::load_peer_list()
|
||||
}
|
||||
|
||||
// Finally load peers from p2pool_peers.txt
|
||||
std::ifstream f(saved_peer_list_file_name);
|
||||
const std::string path = DATA_DIR + saved_peer_list_file_name;
|
||||
|
||||
std::ifstream f(path);
|
||||
if (f.is_open()) {
|
||||
std::string address;
|
||||
while (f.good()) {
|
||||
@@ -1421,7 +1425,7 @@ void P2PServer::api_update_local_stats()
|
||||
}
|
||||
}
|
||||
|
||||
s << "],\"uptime\":" << cur_time - m_pool->start_time() << '}';
|
||||
s << "],\"uptime\":" << cur_time - m_pool->start_time() << ",\"zmq_last_active\":" << (seconds_since_epoch() - m_pool->zmq_last_active()) << '}';
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1496,7 +1500,7 @@ bool P2PServer::P2PClient::on_connect()
|
||||
return send_handshake_challenge();
|
||||
}
|
||||
|
||||
bool P2PServer::P2PClient::on_read(char* data, uint32_t size)
|
||||
bool P2PServer::P2PClient::on_read(const char* data, uint32_t size)
|
||||
{
|
||||
P2PServer* server = static_cast<P2PServer*>(m_owner);
|
||||
if (!server) {
|
||||
@@ -1940,11 +1944,9 @@ void P2PServer::P2PClient::send_handshake_solution(const uint8_t (&challenge)[CH
|
||||
}
|
||||
}
|
||||
|
||||
bool P2PServer::P2PClient::check_handshake_solution(const hash& solution, const uint8_t (&solution_salt)[CHALLENGE_SIZE])
|
||||
bool P2PServer::P2PClient::check_handshake_solution(const hash& solution, const uint8_t (&solution_salt)[CHALLENGE_SIZE]) const
|
||||
{
|
||||
P2PServer* owner = static_cast<P2PServer*>(m_owner);
|
||||
|
||||
const std::vector<uint8_t>& consensus_id = owner->m_pool->side_chain().consensus_id();
|
||||
const std::vector<uint8_t>& consensus_id = static_cast<const P2PServer*>(m_owner)->m_pool->side_chain().consensus_id();
|
||||
const int consensus_id_size = static_cast<int>(consensus_id.size());
|
||||
|
||||
uint8_t challenge[CHALLENGE_SIZE];
|
||||
|
||||
+3
-3
@@ -79,7 +79,7 @@ public:
|
||||
|
||||
void reset() override;
|
||||
[[nodiscard]] bool on_connect() override;
|
||||
[[nodiscard]] bool on_read(char* data, uint32_t size) override;
|
||||
[[nodiscard]] bool on_read(const char* data, uint32_t size) override;
|
||||
void on_read_failed(int err) override;
|
||||
void on_disconnected() override;
|
||||
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
|
||||
[[nodiscard]] bool send_handshake_challenge();
|
||||
void send_handshake_solution(const uint8_t (&challenge)[CHALLENGE_SIZE]);
|
||||
[[nodiscard]] bool check_handshake_solution(const hash& solution, const uint8_t (&solution_salt)[CHALLENGE_SIZE]);
|
||||
[[nodiscard]] bool check_handshake_solution(const hash& solution, const uint8_t (&solution_salt)[CHALLENGE_SIZE]) const;
|
||||
|
||||
[[nodiscard]] bool on_handshake_challenge(const uint8_t* buf);
|
||||
[[nodiscard]] bool on_handshake_solution(const uint8_t* buf);
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
void on_block_notify(const uint8_t* buf);
|
||||
|
||||
[[nodiscard]] bool handle_incoming_block_async(const PoolBlock* block, uint64_t max_time_delta = 0);
|
||||
void handle_incoming_block(p2pool* pool, PoolBlock& block, std::vector<hash>& missing_blocks, bool& result);
|
||||
static void handle_incoming_block(p2pool* pool, PoolBlock& block, std::vector<hash>& missing_blocks, bool& result);
|
||||
void post_handle_incoming_block(p2pool* pool, const PoolBlock& block, const uint32_t reset_counter, bool is_v6, const raw_ip& addr, std::vector<hash>& missing_blocks, const bool result);
|
||||
|
||||
[[nodiscard]] bool is_good() const { return m_handshakeComplete && !m_handshakeInvalid && (m_listenPort >= 0); }
|
||||
|
||||
+48
-15
@@ -20,7 +20,7 @@
|
||||
#include "zmq_reader.h"
|
||||
#include "mempool.h"
|
||||
#include "json_rpc_request.h"
|
||||
#include "rapidjson/document.h"
|
||||
#include "rapidjson_wrapper.h"
|
||||
#include "json_parsers.h"
|
||||
#include "pow_hash.h"
|
||||
#include "block_template.h"
|
||||
@@ -73,6 +73,8 @@ p2pool::p2pool(int argc, char* argv[])
|
||||
|
||||
m_params = p;
|
||||
|
||||
bkg_jobs_tracker = new BackgroundJobTracker();
|
||||
|
||||
#ifdef WITH_UPNP
|
||||
if (p->m_upnp) {
|
||||
init_upnp();
|
||||
@@ -184,6 +186,8 @@ p2pool::p2pool(int argc, char* argv[])
|
||||
m_hasher = new RandomX_Hasher_RPC(this);
|
||||
#endif
|
||||
|
||||
PoolBlock::s_precalculatedSharesLock = new ReadWriteLock();
|
||||
|
||||
m_blockTemplate = new BlockTemplate(m_sideChain, m_hasher);
|
||||
m_mempool = new Mempool();
|
||||
|
||||
@@ -232,6 +236,17 @@ p2pool::~p2pool()
|
||||
delete m_blockTemplate;
|
||||
delete m_mempool;
|
||||
delete m_params;
|
||||
|
||||
{
|
||||
auto p = bkg_jobs_tracker;
|
||||
bkg_jobs_tracker = nullptr;
|
||||
delete p;
|
||||
}
|
||||
{
|
||||
auto p = PoolBlock::s_precalculatedSharesLock;
|
||||
PoolBlock::s_precalculatedSharesLock = nullptr;
|
||||
delete p;
|
||||
}
|
||||
}
|
||||
|
||||
void p2pool::update_host_ping(const std::string& display_name, double ping)
|
||||
@@ -421,19 +436,36 @@ void p2pool::handle_miner_data(MinerData& data)
|
||||
|
||||
if (m_serversStarted.load()) {
|
||||
std::vector<uint64_t> missing_heights;
|
||||
|
||||
auto check_height = [this, &missing_heights](uint64_t h) {
|
||||
auto it = m_mainchainByHeight.find(h);
|
||||
if ((it == m_mainchainByHeight.end()) || it->second.difficulty.empty()) {
|
||||
missing_heights.push_back(h);
|
||||
}
|
||||
};
|
||||
|
||||
{
|
||||
WriteLock lock(m_mainchainLock);
|
||||
ReadLock lock(m_mainchainLock);
|
||||
|
||||
for (uint64_t h = data.height; h && (h + BLOCK_HEADERS_REQUIRED > data.height); --h) {
|
||||
auto it = m_mainchainByHeight.find(h);
|
||||
if ((it == m_mainchainByHeight.end()) || it->second.difficulty.empty()) {
|
||||
LOGWARN(3, "Mainchain data for height " << h << " is missing, requesting it from monerod again");
|
||||
missing_heights.push_back(h);
|
||||
}
|
||||
check_height(h);
|
||||
}
|
||||
|
||||
const uint64_t seed_height = get_seed_height(data.height);
|
||||
const uint64_t prev_seed_height = (seed_height > SEEDHASH_EPOCH_BLOCKS) ? (seed_height - SEEDHASH_EPOCH_BLOCKS) : 0;
|
||||
|
||||
check_height(seed_height);
|
||||
check_height(prev_seed_height);
|
||||
}
|
||||
|
||||
if (missing_heights.size() > 1) {
|
||||
std::sort(missing_heights.begin(), missing_heights.end(), std::greater<uint64_t>());
|
||||
missing_heights.erase(std::unique(missing_heights.begin(), missing_heights.end()), missing_heights.end());
|
||||
}
|
||||
|
||||
for (uint64_t h : missing_heights) {
|
||||
LOGWARN(3, "Mainchain data for height " << h << " is missing, requesting it from monerod again");
|
||||
|
||||
char buf[log::Stream::BUF_SIZE + 1] = {};
|
||||
log::Stream s(buf);
|
||||
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_header_by_height\",\"params\":{\"height\":" << h << "}}\0";
|
||||
@@ -550,12 +582,12 @@ void p2pool::update_aux_data(const hash& chain_id)
|
||||
|
||||
aux_id.reserve(m_mergeMiningClients.size() + 1);
|
||||
|
||||
IMergeMiningClient::ChainParameters params;
|
||||
IMergeMiningClient::ChainParameters chain_params;
|
||||
|
||||
for (const IMergeMiningClient* c : m_mergeMiningClients) {
|
||||
if (c->get_params(params)) {
|
||||
data.aux_chains.emplace_back(params.aux_id, params.aux_hash, params.aux_diff);
|
||||
aux_id.emplace_back(params.aux_id);
|
||||
if (c->get_params(chain_params)) {
|
||||
data.aux_chains.emplace_back(chain_params.aux_id, chain_params.aux_hash, chain_params.aux_diff);
|
||||
aux_id.emplace_back(chain_params.aux_id);
|
||||
}
|
||||
}
|
||||
aux_id.emplace_back(m_sideChain->consensus_hash());
|
||||
@@ -1156,7 +1188,7 @@ void p2pool::load_found_blocks()
|
||||
return;
|
||||
}
|
||||
|
||||
std::ifstream f(FOUND_BLOCKS_FILE);
|
||||
std::ifstream f(DATA_DIR + FOUND_BLOCKS_FILE);
|
||||
if (!f.is_open()) {
|
||||
return;
|
||||
}
|
||||
@@ -1689,14 +1721,15 @@ void p2pool::api_update_block_found(const ChainMain* data, const PoolBlock* bloc
|
||||
difficulty_type diff;
|
||||
|
||||
if (data && get_difficulty_at_height(data->height, diff)) {
|
||||
std::ofstream f(FOUND_BLOCKS_FILE, std::ios::app);
|
||||
const std::string path = DATA_DIR + FOUND_BLOCKS_FILE;
|
||||
std::ofstream f(path, std::ios::app);
|
||||
if (f.is_open()) {
|
||||
f << cur_time << ' ' << data->height << ' ' << data->id << ' ' << diff << ' ' << total_hashes << '\n';
|
||||
f.flush();
|
||||
f.close();
|
||||
}
|
||||
else {
|
||||
LOGERR(1, "Failed to update " << FOUND_BLOCKS_FILE << ", error " << errno);
|
||||
LOGERR(1, "Failed to update " << path << ": error " << errno);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1938,7 +1971,7 @@ int p2pool::run()
|
||||
|
||||
m_stopped = true;
|
||||
|
||||
bkg_jobs_tracker.wait();
|
||||
bkg_jobs_tracker->wait();
|
||||
|
||||
#ifdef WITH_RANDOMX
|
||||
delete m_miner;
|
||||
|
||||
+18
-1
@@ -95,8 +95,20 @@ Params::Params(int argc, char* const argv[])
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if ((strcmp(argv[i], "--data-dir") == 0) && (i + 1 < argc)) {
|
||||
// Processed in main.cpp
|
||||
++i;
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if ((strcmp(argv[i], "--config") == 0) && (i + 1 < argc)) {
|
||||
m_config = argv[++i];
|
||||
LOGWARN(0, "--config command line parameter is deprecated and will be removed in the next version. Use --sidechain-config instead");
|
||||
m_sidechainConfig = argv[++i];
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if ((strcmp(argv[i], "--sidechain-config") == 0) && (i + 1 < argc)) {
|
||||
m_sidechainConfig = argv[++i];
|
||||
ok = true;
|
||||
}
|
||||
|
||||
@@ -207,6 +219,11 @@ Params::Params(int argc, char* const argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strcmp(argv[i], "--no-stratum-http") == 0) {
|
||||
m_enableStratumHTTP = false;
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
fprintf(stderr, "Unknown command line parameter %s\n\n", argv[i]);
|
||||
p2pool_usage();
|
||||
|
||||
+2
-1
@@ -68,7 +68,7 @@ struct Params
|
||||
std::string m_stratumAddresses;
|
||||
std::string m_p2pAddresses;
|
||||
std::string m_p2pPeerList;
|
||||
std::string m_config;
|
||||
std::string m_sidechainConfig;
|
||||
std::string m_apiPath;
|
||||
bool m_localStats = false;
|
||||
bool m_blockCache = true;
|
||||
@@ -96,6 +96,7 @@ struct Params
|
||||
std::string m_tlsCert;
|
||||
std::string m_tlsCertKey;
|
||||
#endif
|
||||
bool m_enableStratumHTTP = true;
|
||||
};
|
||||
|
||||
} // namespace p2pool
|
||||
|
||||
@@ -29,6 +29,8 @@ LOG_CATEGORY(PoolBlock)
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
ReadWriteLock* PoolBlock::s_precalculatedSharesLock = nullptr;
|
||||
|
||||
PoolBlock::PoolBlock()
|
||||
: m_majorVersion(0)
|
||||
, m_minorVersion(0)
|
||||
@@ -115,6 +117,10 @@ PoolBlock& PoolBlock::operator=(const PoolBlock& b)
|
||||
m_broadcasted = b.m_broadcasted;
|
||||
m_wantBroadcast = b.m_wantBroadcast;
|
||||
m_precalculated = b.m_precalculated;
|
||||
{
|
||||
WriteLock lock(*s_precalculatedSharesLock);
|
||||
m_precalculatedShares = b.m_precalculatedShares;
|
||||
}
|
||||
|
||||
m_localTimestamp = seconds_since_epoch();
|
||||
m_receivedTimestamp = b.m_receivedTimestamp;
|
||||
@@ -302,6 +308,11 @@ void PoolBlock::reset_offchain_data()
|
||||
m_wantBroadcast = false;
|
||||
|
||||
m_precalculated = false;
|
||||
{
|
||||
WriteLock lock(*s_precalculatedSharesLock);
|
||||
m_precalculatedShares.clear();
|
||||
m_precalculatedShares.shrink_to_fit();
|
||||
}
|
||||
|
||||
m_localTimestamp = seconds_since_epoch();
|
||||
m_receivedTimestamp = 0;
|
||||
|
||||
@@ -32,6 +32,7 @@ static FORCEINLINE constexpr int pool_block_debug() { return POOL_BLOCK_DEBUG; }
|
||||
|
||||
class RandomX_Hasher_Base;
|
||||
class SideChain;
|
||||
struct MinerShare;
|
||||
|
||||
/*
|
||||
* --------------------------------------------------
|
||||
@@ -161,6 +162,9 @@ struct PoolBlock
|
||||
|
||||
bool m_precalculated;
|
||||
|
||||
static ReadWriteLock* s_precalculatedSharesLock;
|
||||
std::vector<MinerShare> m_precalculatedShares;
|
||||
|
||||
uint64_t m_localTimestamp;
|
||||
uint64_t m_receivedTimestamp;
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
#endif
|
||||
#include "json_rpc_request.h"
|
||||
#include "json_parsers.h"
|
||||
#include <rapidjson/document.h>
|
||||
#include "rapidjson_wrapper.h"
|
||||
#include <thread>
|
||||
|
||||
LOG_CATEGORY(RandomX_Hasher)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#if defined(_MSC_VER) && defined(__cppcheck__)
|
||||
// cppcheck chokes on rapidjson headers in Windows
|
||||
#else
|
||||
#include <rapidjson/document.h>
|
||||
#endif
|
||||
+35
-27
@@ -34,8 +34,12 @@
|
||||
#include "json_parsers.h"
|
||||
#include "crypto.h"
|
||||
#include "hardforks/hardforks.h"
|
||||
|
||||
#if !defined(_MSC_VER) || !defined(__cppcheck__)
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/istreamwrapper.h>
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <numeric>
|
||||
@@ -80,7 +84,7 @@ SideChain::SideChain(p2pool* pool, NetworkType type, const char* pool_name)
|
||||
|
||||
LOGINFO(1, log::LightCyan() << "network type = " << type);
|
||||
|
||||
if (m_pool && !load_config(m_pool->params().m_config)) {
|
||||
if (m_pool && !load_config(m_pool->params().m_sidechainConfig)) {
|
||||
PANIC_STOP();
|
||||
}
|
||||
|
||||
@@ -507,7 +511,6 @@ void SideChain::cleanup_incoming_blocks()
|
||||
MutexLock lock(m_incomingBlocksLock);
|
||||
|
||||
// Forget seen blocks that were added more than 10 minutes ago
|
||||
hash h;
|
||||
for (auto i = m_incomingBlocks.begin(); i != m_incomingBlocks.end();) {
|
||||
if (cur_time < i->second + 10 * 60) {
|
||||
++i;
|
||||
@@ -1677,7 +1680,13 @@ void SideChain::verify(PoolBlock* block)
|
||||
}
|
||||
|
||||
std::vector<MinerShare> shares;
|
||||
if (!get_shares(block, shares)) {
|
||||
|
||||
if (block->m_precalculated) {
|
||||
WriteLock lock(*PoolBlock::s_precalculatedSharesLock);
|
||||
shares = std::move(block->m_precalculatedShares);
|
||||
}
|
||||
|
||||
if (shares.empty() && !get_shares(block, shares)) {
|
||||
block->m_invalid = true;
|
||||
return;
|
||||
}
|
||||
@@ -2345,10 +2354,13 @@ void SideChain::launch_precalc(const PoolBlock* block)
|
||||
std::vector<MinerShare> shares;
|
||||
if (get_shares(b, shares, nullptr, true)) {
|
||||
b->m_precalculated = true;
|
||||
PrecalcJob* job = new PrecalcJob{ b, std::move(shares) };
|
||||
{
|
||||
WriteLock lock(*PoolBlock::s_precalculatedSharesLock);
|
||||
b->m_precalculatedShares = std::move(shares);
|
||||
}
|
||||
{
|
||||
MutexLock lock2(m_precalcJobsMutex);
|
||||
m_precalcJobs.push_back(job);
|
||||
m_precalcJobs.push_back(b);
|
||||
uv_cond_signal(&m_precalcJobsCond);
|
||||
}
|
||||
}
|
||||
@@ -2358,9 +2370,12 @@ void SideChain::launch_precalc(const PoolBlock* block)
|
||||
|
||||
void SideChain::precalc_worker()
|
||||
{
|
||||
std::vector<std::pair<size_t, const Wallet*>> wallets;
|
||||
wallets.reserve(m_chainWindowSize);
|
||||
|
||||
do {
|
||||
PrecalcJob* job;
|
||||
size_t num_inputs;
|
||||
const PoolBlock* job;
|
||||
|
||||
{
|
||||
MutexLock lock(m_precalcJobsMutex);
|
||||
|
||||
@@ -2381,32 +2396,28 @@ void SideChain::precalc_worker()
|
||||
|
||||
// Filter out duplicate inputs for get_eph_public_key()
|
||||
uint8_t t[HASH_SIZE * 2 + sizeof(size_t)];
|
||||
memcpy(t, job->b->m_txkeySec.h, HASH_SIZE);
|
||||
memcpy(t, job->m_txkeySec.h, HASH_SIZE);
|
||||
|
||||
const size_t n = job->shares.size();
|
||||
num_inputs = n;
|
||||
wallets.clear();
|
||||
|
||||
ReadLock lock2(*PoolBlock::s_precalculatedSharesLock);
|
||||
|
||||
const size_t n = job->m_precalculatedShares.size();
|
||||
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
memcpy(t + HASH_SIZE, job->shares[i].m_wallet->view_public_key().h, HASH_SIZE);
|
||||
memcpy(t + HASH_SIZE, job->m_precalculatedShares[i].m_wallet->view_public_key().h, HASH_SIZE);
|
||||
memcpy(t + HASH_SIZE * 2, &i, sizeof(i));
|
||||
if (!m_uniquePrecalcInputs->insert(robin_hood::hash_bytes(t, array_size(t))).second) {
|
||||
job->shares[i].m_wallet = nullptr;
|
||||
--num_inputs;
|
||||
if (m_uniquePrecalcInputs->insert(robin_hood::hash_bytes(t, array_size(t))).second) {
|
||||
wallets.emplace_back(i, job->m_precalculatedShares[i].m_wallet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (num_inputs) {
|
||||
for (size_t i = 0, n = job->shares.size(); i < n; ++i) {
|
||||
if (job->shares[i].m_wallet) {
|
||||
hash eph_public_key;
|
||||
uint8_t view_tag;
|
||||
job->shares[i].m_wallet->get_eph_public_key(job->b->m_txkeySec, i, eph_public_key, view_tag);
|
||||
}
|
||||
}
|
||||
for (const std::pair<size_t, const Wallet*>& w : wallets) {
|
||||
hash eph_public_key;
|
||||
uint8_t view_tag;
|
||||
w.second->get_eph_public_key(job->m_txkeySec, w.first, eph_public_key, view_tag);
|
||||
}
|
||||
|
||||
delete job;
|
||||
} while (true);
|
||||
}
|
||||
|
||||
@@ -2420,9 +2431,6 @@ void SideChain::finish_precalc()
|
||||
{
|
||||
{
|
||||
MutexLock lock(m_precalcJobsMutex);
|
||||
for (PrecalcJob* job : m_precalcJobs) {
|
||||
delete job;
|
||||
}
|
||||
m_precalcJobs.clear();
|
||||
m_precalcJobs.shrink_to_fit();
|
||||
uv_cond_broadcast(&m_precalcJobsCond);
|
||||
|
||||
+1
-7
@@ -147,16 +147,10 @@ private:
|
||||
ChainMain m_watchBlock;
|
||||
hash m_watchBlockMerkleRoot;
|
||||
|
||||
struct PrecalcJob
|
||||
{
|
||||
const PoolBlock* b;
|
||||
std::vector<MinerShare> shares;
|
||||
};
|
||||
|
||||
uv_cond_t m_precalcJobsCond;
|
||||
uv_mutex_t m_precalcJobsMutex;
|
||||
|
||||
std::vector<PrecalcJob*> m_precalcJobs;
|
||||
std::vector<const PoolBlock*> m_precalcJobs;
|
||||
std::vector<std::thread> m_precalcWorkers;
|
||||
unordered_set<size_t>* m_uniquePrecalcInputs;
|
||||
|
||||
|
||||
+55
-33
@@ -24,6 +24,8 @@
|
||||
#include "p2pool_api.h"
|
||||
#include "p2p_server.h"
|
||||
|
||||
#include "rapidjson_wrapper.h"
|
||||
|
||||
LOG_CATEGORY(StratumServer)
|
||||
|
||||
static constexpr int DEFAULT_BACKLOG = 128;
|
||||
@@ -54,11 +56,13 @@ StratumServer::StratumServer(p2pool* pool)
|
||||
, m_hashrateDataTail_1h(0)
|
||||
, m_hashrateDataTail_24h(0)
|
||||
, m_cumulativeFoundSharesDiff(0.0)
|
||||
, m_totalFoundShares(0)
|
||||
, m_totalFailedShares(0)
|
||||
, m_totalFoundSidechainShares(0)
|
||||
, m_totalFailedSidechainShares(0)
|
||||
, m_totalStratumShares(0)
|
||||
, m_apiLastUpdateTime(0)
|
||||
{
|
||||
m_callbackBuf.resize(STRATUM_BUF_SIZE);
|
||||
// Need a bigger buffer for the TLS handshake
|
||||
m_callbackBuf.resize(STRATUM_CALLBACK_BUF_SIZE);
|
||||
|
||||
// Diffuse the initial state in case it has low quality
|
||||
m_rng.discard(10000);
|
||||
@@ -572,13 +576,13 @@ void StratumServer::show_workers()
|
||||
}
|
||||
|
||||
#ifdef WITH_TLS
|
||||
const bool is_tls = c->m_tls.is_empty();
|
||||
const bool is_tls = !c->m_tls.is_empty();
|
||||
#else
|
||||
constexpr bool is_tls = false;
|
||||
#endif
|
||||
|
||||
LOGINFO(0, log::pad_right(static_cast<const char*>(c->m_addrString), addr_len + 8)
|
||||
<< (is_tls ? "no " : "yes ")
|
||||
<< (is_tls ? "yes " : "no ")
|
||||
<< log::pad_right(log::Duration(cur_time - c->m_connectedTime), 20)
|
||||
<< log::pad_right(diff, 20)
|
||||
<< log::pad_right(log::Hashrate(c->m_autoDiff.lo / AUTO_DIFF_TARGET_TIME, m_autoDiff && (c->m_autoDiff != 0)), 15)
|
||||
@@ -595,8 +599,13 @@ void StratumServer::reset_share_counters()
|
||||
WriteLock lock(m_hashrateDataLock);
|
||||
|
||||
m_cumulativeHashesAtLastShare = m_cumulativeHashes;
|
||||
m_totalFoundShares = 0;
|
||||
m_totalFailedShares = 0;
|
||||
m_totalFoundSidechainShares = 0;
|
||||
m_totalFailedSidechainShares = 0;
|
||||
}
|
||||
|
||||
bool StratumServer::http_enabled() const
|
||||
{
|
||||
return m_pool->params().m_enableStratumHTTP;
|
||||
}
|
||||
|
||||
const char* StratumServer::get_log_category() const
|
||||
@@ -611,7 +620,8 @@ void StratumServer::print_stratum_status() const
|
||||
|
||||
uint64_t hashes_since_last_share;
|
||||
double average_effort;
|
||||
uint32_t shares_found, shares_failed;
|
||||
uint32_t sidechain_shares_found, sidechain_shares_failed;
|
||||
uint64_t total_stratum_shares;
|
||||
|
||||
{
|
||||
ReadLock lock(m_hashrateDataLock);
|
||||
@@ -640,8 +650,9 @@ void StratumServer::print_stratum_status() const
|
||||
average_effort = static_cast<double>(m_cumulativeHashesAtLastShare) * 100.0 / diff;
|
||||
}
|
||||
|
||||
shares_found = m_totalFoundShares;
|
||||
shares_failed = m_totalFailedShares;
|
||||
sidechain_shares_found = m_totalFoundSidechainShares;
|
||||
sidechain_shares_failed = m_totalFailedSidechainShares;
|
||||
total_stratum_shares = m_totalStratumShares;
|
||||
}
|
||||
|
||||
const uint64_t hashrate_15m = (dt_15m > 0) ? (hashes_15m / dt_15m) : 0;
|
||||
@@ -649,20 +660,21 @@ void StratumServer::print_stratum_status() const
|
||||
const uint64_t hashrate_24h = (dt_24h > 0) ? (hashes_24h / dt_24h) : 0;
|
||||
|
||||
char shares_failed_buf[64] = {};
|
||||
if (shares_failed) {
|
||||
if (sidechain_shares_failed) {
|
||||
log::Stream s(shares_failed_buf);
|
||||
s << log::Yellow() << "\nShares failed = " << shares_failed << log::NoColor();
|
||||
s << log::Yellow() << "\nP2Pool shares failed = " << sidechain_shares_failed << log::NoColor();
|
||||
}
|
||||
|
||||
LOGINFO(0, "status" <<
|
||||
"\nHashrate (15m est) = " << log::Hashrate(hashrate_15m) <<
|
||||
"\nHashrate (1h est) = " << log::Hashrate(hashrate_1h) <<
|
||||
"\nHashrate (24h est) = " << log::Hashrate(hashrate_24h) <<
|
||||
"\nTotal hashes = " << total_hashes <<
|
||||
"\nShares found = " << shares_found << static_cast<const char*>(shares_failed_buf) <<
|
||||
"\nAverage effort = " << average_effort << '%' <<
|
||||
"\nCurrent effort = " << static_cast<double>(hashes_since_last_share) * 100.0 / m_pool->side_chain().difficulty().to_double() << '%' <<
|
||||
"\nConnections = " << m_numConnections.load() << " (" << m_numIncomingConnections.load() << " incoming)"
|
||||
"\nHashrate (15m est) = " << log::Hashrate(hashrate_15m) <<
|
||||
"\nHashrate (1h est) = " << log::Hashrate(hashrate_1h) <<
|
||||
"\nHashrate (24h est) = " << log::Hashrate(hashrate_24h) <<
|
||||
"\nStratum hashes = " << total_hashes <<
|
||||
"\nStratum shares = " << total_stratum_shares <<
|
||||
"\nP2Pool shares found = " << sidechain_shares_found << static_cast<const char*>(shares_failed_buf) <<
|
||||
"\nAverage effort = " << average_effort << '%' <<
|
||||
"\nCurrent effort = " << static_cast<double>(hashes_since_last_share) * 100.0 / m_pool->side_chain().difficulty().to_double() << '%' <<
|
||||
"\nConnections = " << m_numConnections.load() << " (" << m_numIncomingConnections.load() << " incoming)"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -876,7 +888,10 @@ void StratumServer::update_hashrate_data(uint64_t hashes, uint64_t timestamp)
|
||||
|
||||
WriteLock lock(m_hashrateDataLock);
|
||||
|
||||
m_cumulativeHashes += hashes;
|
||||
if (hashes) {
|
||||
m_cumulativeHashes += hashes;
|
||||
++m_totalStratumShares;
|
||||
}
|
||||
|
||||
HashrateData* data = m_hashrateData;
|
||||
HashrateData& head = data[m_hashrateDataHead];
|
||||
@@ -978,15 +993,15 @@ void StratumServer::on_share_found(uv_work_t* req)
|
||||
server->m_cumulativeHashesAtLastShare = n;
|
||||
|
||||
server->m_cumulativeFoundSharesDiff += diff;
|
||||
++server->m_totalFoundShares;
|
||||
++server->m_totalFoundSidechainShares;
|
||||
}
|
||||
|
||||
if (!pool->submit_sidechain_block(share->m_templateId, share->m_nonce, share->m_extraNonce)) {
|
||||
WriteLock lock(server->m_hashrateDataLock);
|
||||
|
||||
if (server->m_totalFoundShares > 0) {
|
||||
--server->m_totalFoundShares;
|
||||
++server->m_totalFailedShares;
|
||||
if (server->m_totalFoundSidechainShares > 0) {
|
||||
--server->m_totalFoundSidechainShares;
|
||||
++server->m_totalFailedSidechainShares;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1135,6 +1150,7 @@ StratumServer::StratumClient::StratumClient()
|
||||
, m_lastJobTarget(0)
|
||||
, m_score(0)
|
||||
{
|
||||
m_rawReadBuf[0] = '\0';
|
||||
m_stratumReadBuf[0] = '\0';
|
||||
}
|
||||
|
||||
@@ -1170,7 +1186,7 @@ bool StratumServer::StratumClient::on_connect()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StratumServer::StratumClient::on_read(char* data, uint32_t size)
|
||||
bool StratumServer::StratumClient::on_read(const char* data, uint32_t size)
|
||||
{
|
||||
#ifdef WITH_TLS
|
||||
if (!m_tlsChecked) {
|
||||
@@ -1185,7 +1201,7 @@ bool StratumServer::StratumClient::on_read(char* data, uint32_t size)
|
||||
}
|
||||
#endif
|
||||
|
||||
auto on_parse = [this](char* data, uint32_t size) {
|
||||
auto on_parse = [this](const char* data, uint32_t size) {
|
||||
if (static_cast<size_t>(m_stratumReadBufBytes) + size > STRATUM_BUF_SIZE) {
|
||||
LOGWARN(4, "client " << static_cast<const char*>(m_addrString) << " sent too long Stratum message");
|
||||
ban(DEFAULT_BAN_TIME);
|
||||
@@ -1196,10 +1212,11 @@ bool StratumServer::StratumClient::on_read(char* data, uint32_t size)
|
||||
m_stratumReadBufBytes += size;
|
||||
|
||||
char* line_start = m_stratumReadBuf;
|
||||
for (char *e = line_start + m_stratumReadBufBytes, *c = e - size; c < e; ++c) {
|
||||
const char* e = line_start + m_stratumReadBufBytes;
|
||||
for (char *c = line_start + m_stratumReadBufBytes - size; c < e; ++c) {
|
||||
if (*c == '\n') {
|
||||
// Check if the line starts with "GET " or "HEAD" (an HTTP request)
|
||||
if (c - line_start >= 4) {
|
||||
if (static_cast<StratumServer*>(m_owner)->http_enabled() && (c - line_start >= 4)) {
|
||||
const uint32_t line_start_data = read_unaligned(reinterpret_cast<uint32_t*>(line_start));
|
||||
|
||||
const bool is_http_get = (line_start_data == 0x20544547U);
|
||||
@@ -1308,7 +1325,8 @@ bool StratumServer::StratumClient::process_request(char* data, uint32_t size)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StratumServer::StratumClient::process_login(rapidjson::Document& doc, uint32_t id)
|
||||
template<typename T>
|
||||
bool StratumServer::StratumClient::process_login(T& doc, uint32_t id)
|
||||
{
|
||||
const auto params_it = doc.FindMember("params");
|
||||
if (params_it == doc.MemberEnd()) {
|
||||
@@ -1337,7 +1355,8 @@ bool StratumServer::StratumClient::process_login(rapidjson::Document& doc, uint3
|
||||
return static_cast<StratumServer*>(m_owner)->on_login(this, id, login.GetString());
|
||||
}
|
||||
|
||||
bool StratumServer::StratumClient::process_submit(rapidjson::Document& doc, uint32_t id)
|
||||
template<typename T>
|
||||
bool StratumServer::StratumClient::process_submit(T& doc, uint32_t id)
|
||||
{
|
||||
const auto params_it = doc.FindMember("params");
|
||||
if (params_it == doc.MemberEnd()) {
|
||||
@@ -1455,6 +1474,7 @@ void StratumServer::api_update_local_stats(uint64_t timestamp)
|
||||
uint64_t hashes_since_last_share;
|
||||
double average_effort;
|
||||
uint32_t shares_found, shares_failed;
|
||||
uint64_t total_stratum_shares;
|
||||
|
||||
{
|
||||
ReadLock lock(m_hashrateDataLock);
|
||||
@@ -1483,8 +1503,9 @@ void StratumServer::api_update_local_stats(uint64_t timestamp)
|
||||
average_effort = static_cast<double>(m_cumulativeHashesAtLastShare) * 100.0 / diff;
|
||||
}
|
||||
|
||||
shares_found = m_totalFoundShares;
|
||||
shares_failed = m_totalFailedShares;
|
||||
shares_found = m_totalFoundSidechainShares;
|
||||
shares_failed = m_totalFailedSidechainShares;
|
||||
total_stratum_shares = m_totalStratumShares;
|
||||
}
|
||||
|
||||
const uint64_t hashrate_15m = (dt_15m > 0) ? (hashes_15m / dt_15m) : 0;
|
||||
@@ -1504,6 +1525,7 @@ void StratumServer::api_update_local_stats(uint64_t timestamp)
|
||||
<< ",\"hashrate_1h\":" << hashrate_1h
|
||||
<< ",\"hashrate_24h\":" << hashrate_24h
|
||||
<< ",\"total_hashes\":" << total_hashes
|
||||
<< ",\"total_stratum_shares\":" << total_stratum_shares
|
||||
<< ",\"shares_found\":" << shares_found
|
||||
<< ",\"shares_failed\":" << shares_failed
|
||||
<< ",\"average_effort\":" << average_effort
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "tcp_server.h"
|
||||
#include <rapidjson/document.h>
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
@@ -26,6 +25,7 @@ class p2pool;
|
||||
class BlockTemplate;
|
||||
|
||||
static constexpr size_t STRATUM_BUF_SIZE = log::Stream::BUF_SIZE + 1;
|
||||
static constexpr size_t STRATUM_CALLBACK_BUF_SIZE = 16384;
|
||||
static constexpr int DEFAULT_STRATUM_PORT = 3333;
|
||||
|
||||
class StratumServer : public TCPServer
|
||||
@@ -46,11 +46,11 @@ public:
|
||||
|
||||
void reset() override;
|
||||
[[nodiscard]] bool on_connect() override;
|
||||
[[nodiscard]] bool on_read(char* data, uint32_t size) override;
|
||||
[[nodiscard]] bool on_read(const char* data, uint32_t size) override;
|
||||
|
||||
[[nodiscard]] bool process_request(char* data, uint32_t size);
|
||||
[[nodiscard]] bool process_login(rapidjson::Document& doc, uint32_t id);
|
||||
[[nodiscard]] bool process_submit(rapidjson::Document& doc, uint32_t id);
|
||||
template<typename T> [[nodiscard]] bool process_login(T& doc, uint32_t id);
|
||||
template<typename T> [[nodiscard]] bool process_submit(T& doc, uint32_t id);
|
||||
|
||||
bool send_http_response(bool send_content);
|
||||
|
||||
@@ -102,6 +102,8 @@ public:
|
||||
|
||||
void reset_share_counters();
|
||||
|
||||
bool http_enabled() const;
|
||||
|
||||
private:
|
||||
[[nodiscard]] const char* get_log_category() const override;
|
||||
|
||||
@@ -199,8 +201,9 @@ private:
|
||||
uint64_t m_hashrateDataTail_24h;
|
||||
|
||||
double m_cumulativeFoundSharesDiff;
|
||||
uint32_t m_totalFoundShares;
|
||||
uint32_t m_totalFailedShares;
|
||||
uint32_t m_totalFoundSidechainShares;
|
||||
uint32_t m_totalFailedSidechainShares;
|
||||
uint64_t m_totalStratumShares;
|
||||
|
||||
std::atomic<uint64_t> m_apiLastUpdateTime;
|
||||
|
||||
|
||||
+1
-1
@@ -1107,7 +1107,7 @@ void TCPServer::Client::on_read(uv_stream_t* stream, ssize_t nread, const uv_buf
|
||||
}
|
||||
}
|
||||
|
||||
bool TCPServer::Client::on_proxy_handshake(char* data, uint32_t size)
|
||||
bool TCPServer::Client::on_proxy_handshake(const char* data, uint32_t size)
|
||||
{
|
||||
if ((data != m_readBuf + m_numRead) || (data + size > m_readBuf + m_readBufSize)) {
|
||||
LOGERR(1, "peer " << static_cast<char*>(m_addrString) << " invalid data pointer or size in on_read()");
|
||||
|
||||
+2
-2
@@ -63,8 +63,8 @@ public:
|
||||
|
||||
virtual void reset();
|
||||
[[nodiscard]] virtual bool on_connect() = 0;
|
||||
[[nodiscard]] virtual bool on_read(char* data, uint32_t size) = 0;
|
||||
[[nodiscard]] bool on_proxy_handshake(char* data, uint32_t size);
|
||||
[[nodiscard]] virtual bool on_read(const char* data, uint32_t size) = 0;
|
||||
[[nodiscard]] bool on_proxy_handshake(const char* data, uint32_t size);
|
||||
virtual void on_read_failed(int /*err*/) {}
|
||||
virtual void on_disconnected() {}
|
||||
|
||||
|
||||
+1
-1
@@ -217,7 +217,7 @@ bool ServerTls::init()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ServerTls::on_read_internal(char* data, uint32_t size, ReadCallback::Base&& read_callback, WriteCallback::Base&& write_callback)
|
||||
bool ServerTls::on_read_internal(const char* data, uint32_t size, ReadCallback::Base&& read_callback, WriteCallback::Base&& write_callback)
|
||||
{
|
||||
SSL* ssl = m_ssl.get();
|
||||
if (!ssl) {
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
[[nodiscard]] bool init();
|
||||
|
||||
template<typename T, typename U>
|
||||
[[nodiscard]] FORCEINLINE bool on_read(char* data, uint32_t size, T&& read_callback, U&& write_callback)
|
||||
[[nodiscard]] FORCEINLINE bool on_read(const char* data, uint32_t size, T&& read_callback, U&& write_callback)
|
||||
{
|
||||
return on_read_internal(data, size, ReadCallback::Derived<T>(std::move(read_callback)), WriteCallback::Derived<U>(std::move(write_callback)));
|
||||
}
|
||||
@@ -60,7 +60,7 @@ private:
|
||||
typedef Callback<bool, char*, uint32_t> ReadCallback;
|
||||
typedef Callback<bool, const uint8_t*, size_t> WriteCallback;
|
||||
|
||||
[[nodiscard]] bool on_read_internal(char* data, uint32_t size, ReadCallback::Base&& read_callback, WriteCallback::Base&& write_callback);
|
||||
[[nodiscard]] bool on_read_internal(const char* data, uint32_t size, ReadCallback::Base&& read_callback, WriteCallback::Base&& write_callback);
|
||||
[[nodiscard]] bool on_write_internal(const uint8_t* data, size_t size, WriteCallback::Base&& write_callback);
|
||||
|
||||
private:
|
||||
|
||||
+3
-1
@@ -60,6 +60,8 @@ const char* VERSION = "v" STR2(P2POOL_VERSION_MAJOR) "." STR2(P2POOL_VERSION_MIN
|
||||
#endif
|
||||
" on " __DATE__ ")";
|
||||
|
||||
std::string DATA_DIR;
|
||||
|
||||
SoftwareID get_software_id(uint32_t value)
|
||||
{
|
||||
switch (value) {
|
||||
@@ -452,7 +454,7 @@ void BackgroundJobTracker::print_status()
|
||||
m_impl->print_status();
|
||||
}
|
||||
|
||||
BackgroundJobTracker bkg_jobs_tracker;
|
||||
BackgroundJobTracker* bkg_jobs_tracker = nullptr;
|
||||
|
||||
static thread_local bool main_thread = false;
|
||||
void set_main_thread() { main_thread = true; }
|
||||
|
||||
+6
-4
@@ -35,13 +35,15 @@
|
||||
namespace p2pool {
|
||||
|
||||
#define P2POOL_VERSION_MAJOR 4
|
||||
#define P2POOL_VERSION_MINOR 2
|
||||
#define P2POOL_VERSION_MINOR 3
|
||||
#define P2POOL_VERSION_PATCH 0
|
||||
|
||||
constexpr uint32_t P2POOL_VERSION = (P2POOL_VERSION_MAJOR << 16) | (P2POOL_VERSION_MINOR << 8) | P2POOL_VERSION_PATCH;
|
||||
|
||||
extern const char* VERSION;
|
||||
|
||||
extern std::string DATA_DIR;
|
||||
|
||||
enum class SoftwareID : uint32_t {
|
||||
P2Pool = 0,
|
||||
GoObserver = 0x624F6F47UL,
|
||||
@@ -233,10 +235,10 @@ private:
|
||||
Impl* m_impl;
|
||||
};
|
||||
|
||||
extern BackgroundJobTracker bkg_jobs_tracker;
|
||||
extern BackgroundJobTracker* bkg_jobs_tracker;
|
||||
|
||||
#define BACKGROUND_JOB_START(x) do { bkg_jobs_tracker.start(#x); } while (0)
|
||||
#define BACKGROUND_JOB_STOP(x) do { bkg_jobs_tracker.stop(#x); } while (0)
|
||||
#define BACKGROUND_JOB_START(x) do { bkg_jobs_tracker->start(#x); } while (0)
|
||||
#define BACKGROUND_JOB_STOP(x) do { bkg_jobs_tracker->stop(#x); } while (0)
|
||||
|
||||
void set_main_thread();
|
||||
bool is_main_thread();
|
||||
|
||||
@@ -25,6 +25,16 @@ static_assert(sizeof(in_addr) == 4, "struct in_addr has invalid size");
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
struct ReadWriteLock : public nocopy_nomove {
|
||||
FORCEINLINE ReadWriteLock() { uv_rwlock_init(&m_lock); }
|
||||
FORCEINLINE ~ReadWriteLock() { uv_rwlock_destroy(&m_lock); }
|
||||
|
||||
FORCEINLINE operator uv_rwlock_t&() { return m_lock; }
|
||||
|
||||
private:
|
||||
uv_rwlock_t m_lock;
|
||||
};
|
||||
|
||||
struct MutexLock : public nocopy_nomove
|
||||
{
|
||||
explicit FORCEINLINE MutexLock(uv_mutex_t& handle) : m_handle(&handle) { uv_mutex_lock(&handle); }
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
#include "common.h"
|
||||
#include "zmq_reader.h"
|
||||
#include "json_parsers.h"
|
||||
#include <rapidjson/document.h>
|
||||
#include "rapidjson_wrapper.h"
|
||||
|
||||
LOG_CATEGORY(ZMQReader)
|
||||
|
||||
|
||||
@@ -294,6 +294,8 @@ allowedAPIs = {
|
||||
"OpenThreadToken",
|
||||
"GetOverlappedResult",
|
||||
"CryptGenRandom",
|
||||
"HeapQueryInformation",
|
||||
"AreFileApisANSI",
|
||||
}
|
||||
|
||||
f = open(sys.argv[1], 'r')
|
||||
|
||||
+15
-3
@@ -15,14 +15,26 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "util.h"
|
||||
#include "pool_block.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
void p2pool_usage() {}
|
||||
namespace p2pool { void set_main_thread(); }
|
||||
|
||||
using namespace p2pool;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
p2pool::set_main_thread();
|
||||
set_main_thread();
|
||||
|
||||
PoolBlock::s_precalculatedSharesLock = new ReadWriteLock();
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
const int result = RUN_ALL_TESTS();
|
||||
|
||||
delete PoolBlock::s_precalculatedSharesLock;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "keccak.h"
|
||||
#include "merkle.h"
|
||||
#include "pool_block.h"
|
||||
#include "side_chain.h"
|
||||
#include "keccak.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user