Compare commits
140 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2416a80642 | |||
| 779f72a71e | |||
| 6483c32c8d | |||
| 3f9c622b88 | |||
| 68cbf91fc7 | |||
| df21dd48af | |||
| 9462f2a85b | |||
| 9e37216be2 | |||
| 901b6cb828 | |||
| 2396725eb8 | |||
| 11236f7dc8 | |||
| 8b4b06f1be | |||
| 55e12a3715 | |||
| a66716c0b1 | |||
| abde2ef1ce | |||
| f94d411f3c | |||
| 6178277745 | |||
| a55858b44f | |||
| 2449366d87 | |||
| d1dd95d9c9 | |||
| 37e8cc01cf | |||
| e182c4c992 | |||
| 71b6b8fdef | |||
| 860bb7b067 | |||
| 7361ddf24d | |||
| 1a3ce762b3 | |||
| d006ac2c6e | |||
| 13bd678c03 | |||
| 4aef6cf8bb | |||
| f1c9a1f505 | |||
| 6fe6925f23 | |||
| 2e14be3534 | |||
| f24273378d | |||
| 5a94840442 | |||
| 0936d6e4f0 | |||
| a80d5eb540 | |||
| 6492c6008e | |||
| 9af5dd43ad | |||
| 3558181a7b | |||
| 37e9c3b8a4 | |||
| 3c5c938d40 | |||
| 02a9ce4ee5 | |||
| 9baec059ee | |||
| e9ab515594 | |||
| 07be6a3a81 | |||
| 06aa632e6f | |||
| 9ce9516c99 | |||
| 16053d45d7 | |||
| b39a9bd3ca | |||
| 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 | |||
| 18b280ed1d | |||
| 996bb1baba | |||
| a3006cb51a | |||
| 031a1c2eea | |||
| 3c4cf098a9 | |||
| c9193c53d9 | |||
| 831edc465a | |||
| eb8ac56cf6 | |||
| 8daa05bab2 | |||
| 02006e1b50 | |||
| fb78eb615b | |||
| 2b453dd0cb | |||
| 510a271434 | |||
| 1053e22a52 | |||
| c88f126cb1 | |||
| 61bb862cdb | |||
| 2586290a1d | |||
| d6c9c931fd | |||
| 210ae3f9df | |||
| 4dfdaf5447 | |||
| a1f1719f3b | |||
| d17608e631 | |||
| 38211932dc | |||
| bc2b3fa3ac | |||
| 56f42e0018 | |||
| 25452898d9 | |||
| ad08f8b117 | |||
| 93062e4341 | |||
| 314d306145 | |||
| a003486b4a | |||
| ab6b08404a | |||
| 1a75b201fd | |||
| bbc36c3869 | |||
| bf1a09097f | |||
| f3e96d7138 | |||
| 2b47218406 | |||
| c49f12b41d | |||
| 2eea660184 | |||
| 4b1c077b4a | |||
| de25ef0162 | |||
| ad49afb34b | |||
| 8aad4a16b3 | |||
| 8960365f82 | |||
| c967c84e0e | |||
| 61cc29a260 | |||
| cb3b4de1a5 | |||
| 127dcc04bf | |||
| cb8ea37dab | |||
| ebb6fe6942 | |||
| eb490d89c2 | |||
| 64a199be6d | |||
| b01ba2e116 | |||
| 0bada79b6b | |||
| 8894da4f93 | |||
| 37bf8554fc | |||
| ce6553863a | |||
| b16cf00dae |
+64
-61
@@ -18,9 +18,9 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
config:
|
||||
- {arch: x86_64, branch: latest-stable, flags: "-ffunction-sections -Wno-error=inline"}
|
||||
- {arch: aarch64, branch: latest-stable, flags: "-ffunction-sections -Wno-error=inline -mfix-cortex-a53-835769 -mfix-cortex-a53-843419"}
|
||||
- {arch: riscv64, branch: edge, flags: "-ffunction-sections -Wno-error=inline"}
|
||||
- {arch: x86_64, branch: latest-stable, flags: "-ffunction-sections"}
|
||||
- {arch: aarch64, branch: latest-stable, flags: "-ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419"}
|
||||
- {arch: riscv64, branch: edge, flags: "-ffunction-sections"}
|
||||
|
||||
steps:
|
||||
- name: Setup Alpine Linux
|
||||
@@ -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
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -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_BROTLI=OFF -DCURL_ZSTD=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 -DCURL_DISABLE_WEBSOCKETS=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 -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
cd external/src/libuv
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -62,7 +62,7 @@ jobs:
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build p2pool
|
||||
@@ -70,7 +70,7 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_BINARY=ON -DARCH_ID=${{ matrix.config.arch }}
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_BINARY=ON -DARCH_ID=${{ matrix.config.arch }}
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run RandomX tests
|
||||
@@ -87,7 +87,7 @@ jobs:
|
||||
cd tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=${{ matrix.config.arch }}
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=${{ matrix.config.arch }}
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Run tests
|
||||
@@ -117,9 +117,12 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
config:
|
||||
- {os: ubuntu-20.04, c: gcc-8, cpp: g++-8, flags: ""}
|
||||
- {os: ubuntu-20.04, c: gcc-11, cpp: g++-11, flags: ""}
|
||||
- {os: ubuntu-22.04, c: gcc-9, cpp: g++-9, flags: ""}
|
||||
- {os: ubuntu-22.04, c: gcc-10, cpp: g++-10, flags: ""}
|
||||
- {os: ubuntu-22.04, c: gcc-11, cpp: g++-11, flags: ""}
|
||||
- {os: ubuntu-22.04, c: gcc-12, cpp: g++-12, flags: ""}
|
||||
- {os: ubuntu-24.04, c: gcc-13, cpp: g++-13, flags: ""}
|
||||
- {os: ubuntu-24.04, c: gcc-14, cpp: g++-14, flags: ""}
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
@@ -137,7 +140,7 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cpp }} -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}'
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cpp }} -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}' -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run RandomX tests
|
||||
@@ -152,7 +155,7 @@ jobs:
|
||||
cd tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cpp }} -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}'
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cpp }} -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}' -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Run tests
|
||||
@@ -175,7 +178,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
config:
|
||||
- {flags: "-fuse-linker-plugin -ffunction-sections -Wno-error=inline"}
|
||||
- {flags: "-fuse-linker-plugin -ffunction-sections"}
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
@@ -193,7 +196,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
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -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_BROTLI=OFF -DCURL_ZSTD=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 -DCURL_DISABLE_WEBSOCKETS=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 -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -202,7 +205,7 @@ jobs:
|
||||
cd external/src/libuv
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -210,14 +213,14 @@ jobs:
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run RandomX tests
|
||||
@@ -232,7 +235,7 @@ jobs:
|
||||
cd tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Run tests
|
||||
@@ -255,8 +258,8 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
config:
|
||||
- {os: ubuntu-20.04, flags: "-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419"}
|
||||
- {os: ubuntu-22.04, flags: "-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419"}
|
||||
- {os: ubuntu-24.04, flags: "-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419"}
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
@@ -272,7 +275,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
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -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_BROTLI=OFF -DCURL_ZSTD=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 -DCURL_DISABLE_WEBSOCKETS=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 -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -281,7 +284,7 @@ jobs:
|
||||
cd external/src/libuv
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -289,14 +292,14 @@ jobs:
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=aarch64
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=aarch64 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run RandomX tests
|
||||
@@ -311,7 +314,7 @@ jobs:
|
||||
cd tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_STRIP=/usr/bin/aarch64-linux-gnu-strip -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=aarch64
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_STRIP=/usr/bin/aarch64-linux-gnu-strip -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=aarch64 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Run tests
|
||||
@@ -334,8 +337,8 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
config:
|
||||
- {c: "gcc", cxx: "g++", flags: "-ffunction-sections -Wno-error=maybe-uninitialized -Wno-error=attributes"}
|
||||
- {c: "clang", cxx: "clang++", flags: "-fuse-ld=lld -Wno-unused-command-line-argument -Wno-nan-infinity-disabled"}
|
||||
- {c: "gcc", cxx: "g++", flags: "-ffunction-sections -Wno-error=maybe-uninitialized -Wno-error=attributes -Wno-error=cpp"}
|
||||
- {c: "clang", cxx: "clang++", flags: "-fuse-ld=lld -Wno-unused-command-line-argument -Wno-nan-infinity-disabled -Wno-error=cpp"}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
@@ -353,15 +356,10 @@ jobs:
|
||||
update: true
|
||||
install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang mingw-w64-x86_64-lld mingw-w64-x86_64-cmake make git
|
||||
|
||||
- name: Apply patch
|
||||
run: |
|
||||
cd /
|
||||
git apply --verbose --ignore-whitespace --directory=mingw64/include/c++/`ls mingw64/include/c++`/ /d/a/p2pool/p2pool/patches/msys2/typeinfo.patch
|
||||
|
||||
- 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
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -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_BROTLI=OFF -DCURL_ZSTD=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 -DCURL_DISABLE_WEBSOCKETS=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 -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -370,7 +368,7 @@ jobs:
|
||||
cd external/src/libuv
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -378,14 +376,14 @@ jobs:
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DZMQ_HAVE_IPC=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DZMQ_HAVE_IPC=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DSTATIC_LIBS=ON -DOPENSSL_NO_ASM=ON -DWITH_LTO=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DSTATIC_LIBS=ON -DOPENSSL_NO_ASM=ON -DWITH_LTO=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run RandomX tests
|
||||
@@ -400,7 +398,7 @@ jobs:
|
||||
cd tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DSTATIC_LIBS=ON
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections" -DSTATIC_LIBS=ON -DOPENSSL_NO_ASM=ON
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Run tests
|
||||
@@ -423,11 +421,12 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
config:
|
||||
- {vs: Visual Studio 17 2022, os: 2022, vspath: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise", rx: "ON", upnp: "ON", grpc: "ON"}
|
||||
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "ON", upnp: "ON", grpc: "ON"}
|
||||
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "ON", upnp: "ON", grpc: "OFF"}
|
||||
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "OFF", upnp: "ON", grpc: "OFF"}
|
||||
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "OFF", upnp: "OFF", grpc: "OFF"}
|
||||
- {vs: Visual Studio 17 2022, os: 2022, vspath: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise", rx: "ON", upnp: "ON", grpc: "ON", tls: "ON"}
|
||||
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "ON", upnp: "ON", grpc: "ON", tls: "ON"}
|
||||
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "ON", upnp: "ON", grpc: "OFF", tls: "ON"}
|
||||
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "OFF", upnp: "ON", grpc: "OFF", tls: "ON"}
|
||||
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "OFF", upnp: "OFF", grpc: "OFF", tls: "ON"}
|
||||
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "OFF", upnp: "OFF", grpc: "OFF", tls: "OFF"}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -438,11 +437,15 @@ jobs:
|
||||
- name: Setup cmake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Apply patch
|
||||
run: |
|
||||
git apply --verbose --ignore-whitespace --directory=external/src/grpc/third_party/boringssl-with-bazel patches/boringssl/win7.patch
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "${{ matrix.config.vs }}" -DCMAKE_SYSTEM_VERSION="10.0" -DWITH_RANDOMX=${{ matrix.config.rx }} -DWITH_UPNP=${{ matrix.config.upnp }} -DWITH_GRPC=${{ matrix.config.grpc }}
|
||||
cmake .. -G "${{ matrix.config.vs }}" -DCMAKE_SYSTEM_VERSION="10.0" -DWITH_RANDOMX=${{ matrix.config.rx }} -DWITH_UPNP=${{ matrix.config.upnp }} -DWITH_GRPC=${{ matrix.config.grpc }} -DWITH_TLS=${{ matrix.config.tls }} -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
& "${{ matrix.config.vspath }}\\MSBuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Release p2pool.vcxproj
|
||||
|
||||
- name: Check Windows 7 compatibility
|
||||
@@ -466,7 +469,7 @@ jobs:
|
||||
cd tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "${{ matrix.config.vs }}" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_WITH_ASAN=ON
|
||||
cmake .. -G "${{ matrix.config.vs }}" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_WITH_ASAN=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
& "${{ matrix.config.vspath }}\\MSBuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Debug p2pool_tests.vcxproj
|
||||
|
||||
- name: Run tests
|
||||
@@ -480,7 +483,7 @@ jobs:
|
||||
- name: Archive binary
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: p2pool-vs-${{ matrix.config.os }}-randomx-${{ matrix.config.rx }}-upnp-${{ matrix.config.upnp }}-grpc-${{ matrix.config.grpc }}.exe
|
||||
name: p2pool-vs-${{ matrix.config.os }}-randomx-${{ matrix.config.rx }}-upnp-${{ matrix.config.upnp }}-grpc-${{ matrix.config.grpc }}-tls-${{ matrix.config.tls }}.exe
|
||||
path: build/Release/p2pool.exe
|
||||
|
||||
build-macos:
|
||||
@@ -497,7 +500,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
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -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_BROTLI=OFF -DCURL_ZSTD=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 -DCURL_DISABLE_WEBSOCKETS=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 -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
make -j4
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -506,7 +509,7 @@ jobs:
|
||||
cd external/src/libuv
|
||||
mkdir build
|
||||
cd build
|
||||
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_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -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_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
make -j4
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -514,14 +517,14 @@ jobs:
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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' -DCMAKE_CXX_FLAGS='-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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' -DCMAKE_CXX_FLAGS='-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
make -j4
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_ASM_FLAGS='-target x86_64-apple-macos10.13' -DSTATIC_LIBS=ON
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_ASM_FLAGS='-target x86_64-apple-macos10.13' -DSTATIC_LIBS=ON
|
||||
make -j4 p2pool
|
||||
|
||||
- name: Run RandomX tests
|
||||
@@ -536,7 +539,7 @@ jobs:
|
||||
cd tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DSTATIC_LIBS=ON
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_ASM_FLAGS='-target x86_64-apple-macos10.13' -DSTATIC_LIBS=ON
|
||||
make -j4
|
||||
|
||||
- name: Run tests
|
||||
@@ -565,7 +568,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
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -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_BROTLI=OFF -DCURL_ZSTD=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 -DCURL_DISABLE_WEBSOCKETS=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 -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
make -j3
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -574,7 +577,7 @@ jobs:
|
||||
cd external/src/libuv
|
||||
mkdir build
|
||||
cd build
|
||||
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_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -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_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
make -j3
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -582,14 +585,14 @@ jobs:
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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' -DCMAKE_CXX_FLAGS='-Os -target arm64-apple-macos-11' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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' -DCMAKE_CXX_FLAGS='-Os -target arm64-apple-macos-11' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
make -j3
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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="-target arm64-apple-macos-11" -DCMAKE_CXX_FLAGS="-target arm64-apple-macos-11" -DSTATIC_LIBS=ON -DWITH_LTO=OFF -DARCH_ID=aarch64
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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="-target arm64-apple-macos-11" -DCMAKE_CXX_FLAGS="-target arm64-apple-macos-11" -DSTATIC_LIBS=ON -DWITH_LTO=OFF -DARCH_ID=aarch64
|
||||
make -j3 p2pool
|
||||
|
||||
- name: Run RandomX tests
|
||||
@@ -604,7 +607,7 @@ jobs:
|
||||
cd tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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="-target arm64-apple-macos-11" -DCMAKE_CXX_FLAGS="-target arm64-apple-macos-11" -DSTATIC_LIBS=ON -DWITH_LTO=OFF -DARCH_ID=aarch64
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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="-target arm64-apple-macos-11" -DCMAKE_CXX_FLAGS="-target arm64-apple-macos-11" -DSTATIC_LIBS=ON -DWITH_LTO=OFF -DARCH_ID=aarch64
|
||||
make -j3
|
||||
|
||||
- name: Run tests
|
||||
@@ -655,23 +658,23 @@ 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
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -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_BROTLI=OFF -DCURL_ZSTD=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 -DCURL_DISABLE_WEBSOCKETS=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 -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
make -j4
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
cd ../../libuv
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_FLAGS='-Os -flto' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
make -j4
|
||||
cd ../../libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_FLAGS='-Os -flto' -DCMAKE_CXX_FLAGS='-Os -flto' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto' -DCMAKE_CXX_FLAGS='-Os -flto' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
make -j4
|
||||
cd ../../../..
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DSTATIC_LIBS=ON
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DSTATIC_LIBS=ON
|
||||
make -j4 p2pool
|
||||
./p2pool --test
|
||||
make -j4 randomx-tests
|
||||
@@ -679,7 +682,7 @@ jobs:
|
||||
cd ../tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DSTATIC_LIBS=ON
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DSTATIC_LIBS=ON
|
||||
make -j4 p2pool_tests
|
||||
gunzip *.gz
|
||||
./p2pool_tests
|
||||
@@ -726,11 +729,11 @@ jobs:
|
||||
run: |
|
||||
sudo pkg_add -I cmake libuv zeromq curl
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||
make -j4 p2pool
|
||||
cd ../tests
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||
make -j4 p2pool_tests
|
||||
gunzip *.gz
|
||||
./p2pool_tests
|
||||
|
||||
@@ -18,9 +18,9 @@ jobs:
|
||||
run: |
|
||||
wget https://apt.llvm.org/llvm.sh
|
||||
chmod +x llvm.sh
|
||||
sudo ./llvm.sh 18
|
||||
sudo apt-get install -y clang-tidy-18
|
||||
clang-tidy-18 --verify-config
|
||||
sudo ./llvm.sh 20
|
||||
sudo apt-get install -y clang-tidy-20
|
||||
clang-tidy-20 --verify-config
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
@@ -31,9 +31,9 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DDEV_CLANG_TIDY=ON -DSTATIC_LIBS=ON
|
||||
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DDEV_CLANG_TIDY=ON -DSTATIC_LIBS=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
|
||||
- name: Run clang-tidy
|
||||
run: |
|
||||
cd src
|
||||
clang-tidy-18 *.cpp -p ../build -checks=-clang-diagnostic-undefined-internal,-clang-analyzer-optin.performance.Padding,-clang-diagnostic-nan-infinity-disabled -warnings-as-errors=* -header-filter=^[^\.]
|
||||
clang-tidy-20 *.cpp -p ../build -checks=-clang-diagnostic-undefined-internal,-clang-analyzer-optin.performance.Padding,-clang-diagnostic-nan-infinity-disabled -warnings-as-errors=* -header-filter=^[^\.]
|
||||
|
||||
@@ -61,21 +61,13 @@ jobs:
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
- run: |
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
|
||||
@@ -15,7 +15,7 @@ on:
|
||||
jobs:
|
||||
cppcheck-ubuntu:
|
||||
|
||||
timeout-minutes: 120
|
||||
timeout-minutes: 240
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSTATIC_LIBS=ON
|
||||
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSTATIC_LIBS=ON -DWITH_GRPC=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
python ../cppcheck/remove_external.py compile_commands.json
|
||||
|
||||
- name: Run cppcheck
|
||||
@@ -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
|
||||
@@ -88,7 +90,7 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "Visual Studio 17 2022" -DSTATIC_LIBS=ON
|
||||
cmake .. -G "Visual Studio 17 2022" -DSTATIC_LIBS=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
|
||||
- name: Run cppcheck
|
||||
run: |
|
||||
@@ -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
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
submodules: recursive
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -B ${{ env.build }} -DCMAKE_BUILD_TYPE=${{ env.config }}
|
||||
run: cmake -B ${{ env.build }} -DCMAKE_BUILD_TYPE=${{ env.config }} -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
|
||||
# Build is not required unless generated source files are used
|
||||
# - name: Build CMake
|
||||
|
||||
@@ -1,426 +0,0 @@
|
||||
name: Sync test (old)
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'docker-compose/**'
|
||||
- 'docs/**'
|
||||
- 'README.md'
|
||||
|
||||
pull_request:
|
||||
|
||||
schedule:
|
||||
- cron: '47 0/3 * * *'
|
||||
|
||||
jobs:
|
||||
sync-test-ubuntu-tsan:
|
||||
|
||||
timeout-minutes: 60
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
sudo apt update
|
||||
sudo apt install -y git build-essential cmake gcc-12 g++-12
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- 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
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
- name: Build libuv
|
||||
run: |
|
||||
cd external/src/libuv
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build libzmq
|
||||
run: |
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_TSAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DWITH_LTO=OFF -DSTATIC_LIBS=ON
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
run: |
|
||||
cd build
|
||||
mkdir data
|
||||
python ../tests/src/stratum_dummy.py 1 &
|
||||
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
|
||||
|
||||
- name: Check p2pool.log
|
||||
run: |
|
||||
cd build
|
||||
grep 'Synchronization finished successfully' p2pool.log
|
||||
|
||||
- name: Archive p2pool.log
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: p2pool_ubuntu_data_tsan
|
||||
path: |
|
||||
build/*.log
|
||||
build/data/
|
||||
|
||||
sync-test-ubuntu-msan:
|
||||
timeout-minutes: 60
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y git build-essential cmake ninja-build
|
||||
|
||||
- name: Install clang
|
||||
run: |
|
||||
wget https://apt.llvm.org/llvm.sh
|
||||
chmod +x llvm.sh
|
||||
sudo ./llvm.sh 18
|
||||
|
||||
- name: Build libcxx_msan
|
||||
run: |
|
||||
git clone --depth=1 https://github.com/llvm/llvm-project -b release/18.x
|
||||
cd llvm-project
|
||||
mkdir build
|
||||
cmake -G Ninja -S runtimes -B build -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DLLVM_USE_SANITIZER=MemoryWithOrigins -DLIBCXXABI_USE_LLVM_UNWINDER=OFF
|
||||
ninja -C build cxx cxxabi
|
||||
cd build
|
||||
mkdir /tmp/libcxx_msan
|
||||
cp -r include /tmp/libcxx_msan
|
||||
cp -r lib /tmp/libcxx_msan
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
cmake . -DCMAKE_C_COMPILER=clang-18 -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
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
- name: Build libuv
|
||||
run: |
|
||||
cd external/src/libuv
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER=clang-18 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build libzmq
|
||||
run: |
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g -isystem /tmp/libcxx_msan/include/c++/v1 -L/tmp/libcxx_msan/lib -lc++ -lc++abi -Wno-unused-command-line-argument' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -isystem /tmp/libcxx_msan/include/c++/v1 -L/tmp/libcxx_msan/lib -Wl,-rpath /tmp/libcxx_msan/lib -lc++ -lc++abi -Wno-unused-command-line-argument -fuse-ld=lld-18 -fno-omit-frame-pointer -g' -DDEV_TEST_SYNC=ON -DDEV_WITH_MSAN=ON -DWITH_LTO=OFF -DSTATIC_LIBS=ON
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
run: |
|
||||
cd build
|
||||
mkdir data
|
||||
python ../tests/src/stratum_dummy.py 1 &
|
||||
python ../tests/src/stratum_dummy.py 2 &
|
||||
python ../tests/src/stratum_dummy.py 3 &
|
||||
sudo sysctl vm.mmap_rnd_bits=28
|
||||
MSAN_OPTIONS="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
|
||||
|
||||
- name: Check p2pool.log
|
||||
run: |
|
||||
cd build
|
||||
grep 'Synchronization finished successfully' p2pool.log
|
||||
|
||||
- name: Archive p2pool.log
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: p2pool_ubuntu_data_msan
|
||||
path: |
|
||||
build/*.log
|
||||
build/data/
|
||||
|
||||
sync-test-ubuntu-ubsan:
|
||||
|
||||
timeout-minutes: 60
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
sudo apt update
|
||||
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev gcc-12 g++-12
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_UBSAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DWITH_LTO=OFF
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
run: |
|
||||
cd build
|
||||
mkdir data
|
||||
python ../tests/src/stratum_dummy.py 1 &
|
||||
python ../tests/src/stratum_dummy.py 2 &
|
||||
python ../tests/src/stratum_dummy.py 3 &
|
||||
sudo sysctl vm.mmap_rnd_bits=28
|
||||
UBSAN_OPTIONS="suppressions=../tests/src/ubsan_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
|
||||
|
||||
- name: Check p2pool.log
|
||||
run: |
|
||||
cd build
|
||||
grep 'Synchronization finished successfully' p2pool.log
|
||||
|
||||
- name: Archive p2pool.log
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: p2pool_ubuntu_data_ubsan
|
||||
path: |
|
||||
build/*.log
|
||||
build/data/
|
||||
|
||||
sync-test-ubuntu-asan:
|
||||
|
||||
timeout-minutes: 60
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
sudo apt update
|
||||
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev gcc-12 g++-12
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_ASAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS="-fno-omit-frame-pointer -fsanitize=address -Og -g" -DCMAKE_CXX_FLAGS="-fno-omit-frame-pointer -fsanitize=address -Og -g" -DWITH_LTO=OFF
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
run: |
|
||||
cd build
|
||||
mkdir data
|
||||
python ../tests/src/stratum_dummy.py 1 &
|
||||
python ../tests/src/stratum_dummy.py 2 &
|
||||
python ../tests/src/stratum_dummy.py 3 &
|
||||
sudo sysctl vm.mmap_rnd_bits=28
|
||||
ASAN_OPTIONS="detect_stack_use_after_return=1 atexit=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
|
||||
|
||||
- name: Check p2pool.log
|
||||
run: |
|
||||
cd build
|
||||
grep 'Synchronization finished successfully' p2pool.log
|
||||
|
||||
- name: Archive p2pool.log
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: p2pool_ubuntu_data_asan
|
||||
path: |
|
||||
build/*.log
|
||||
build/data/
|
||||
|
||||
sync-test-macos:
|
||||
|
||||
timeout-minutes: 60
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
config:
|
||||
- {os: macos-13, flags: "-Og -ftrapv"}
|
||||
- {os: macos-14, flags: "-Og -ftrapv -target arm64-apple-macos-11"}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
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
|
||||
make -j4
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
- name: Build libuv
|
||||
run: |
|
||||
cd external/src/libuv
|
||||
mkdir build
|
||||
cd build
|
||||
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_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
make -j4
|
||||
|
||||
- name: Build libzmq
|
||||
run: |
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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 }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
make -j4
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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 }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}' -DWITH_LTO=OFF -DSTATIC_LIBS=ON -DDEV_TEST_SYNC=ON
|
||||
make -j4 p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
run: |
|
||||
cd build
|
||||
mkdir data
|
||||
python3 ../tests/src/stratum_dummy.py 1 &
|
||||
python3 ../tests/src/stratum_dummy.py 2 &
|
||||
python3 ../tests/src/stratum_dummy.py 3 &
|
||||
./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: |
|
||||
cd build
|
||||
grep 'Synchronization finished successfully' p2pool.log
|
||||
|
||||
- name: Archive p2pool.log
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: p2pool_${{ matrix.config.os }}_data
|
||||
path: |
|
||||
build/*.log
|
||||
build/data/
|
||||
|
||||
sync-test-windows-debug-asan:
|
||||
|
||||
timeout-minutes: 60
|
||||
runs-on: windows-2022
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup cmake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_TEST_SYNC=ON -DDEV_WITH_ASAN=ON
|
||||
& "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Debug p2pool.vcxproj
|
||||
|
||||
- name: Run p2pool
|
||||
shell: cmd
|
||||
run: |
|
||||
call "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvarsall.bat" amd64
|
||||
cd build/Debug
|
||||
mkdir data
|
||||
start python ../../tests/src/stratum_dummy.py 1
|
||||
start python ../../tests/src/stratum_dummy.py 2
|
||||
start python ../../tests/src/stratum_dummy.py 3
|
||||
p2pool.exe --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: |
|
||||
cd build/Debug
|
||||
findstr /C:"Synchronization finished successfully" p2pool.log
|
||||
|
||||
- name: Archive p2pool.log
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: p2pool_windows_data_debug_asan
|
||||
path: |
|
||||
build/Debug/*.log
|
||||
build/Debug/data/
|
||||
|
||||
sync-test-windows-leaks:
|
||||
|
||||
timeout-minutes: 60
|
||||
runs-on: windows-2022
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup cmake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_TEST_SYNC=ON -DDEV_TRACK_MEMORY=ON
|
||||
& "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=RelWithDebInfo p2pool.vcxproj
|
||||
|
||||
- name: Run p2pool
|
||||
run: |
|
||||
cd build/RelWithDebInfo
|
||||
mkdir data
|
||||
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 1"
|
||||
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 2"
|
||||
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 3"
|
||||
./p2pool.exe --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: |
|
||||
cd build/RelWithDebInfo
|
||||
findstr /C:"Synchronization finished successfully" p2pool.log
|
||||
|
||||
- name: Archive p2pool.log
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: p2pool_windows_data_leaks
|
||||
path: |
|
||||
build/RelWithDebInfo/*.log
|
||||
build/RelWithDebInfo/data/
|
||||
@@ -10,7 +10,7 @@ on:
|
||||
pull_request:
|
||||
|
||||
schedule:
|
||||
- cron: '17 0/3 * * *'
|
||||
- cron: '47 0/3 * * *'
|
||||
|
||||
jobs:
|
||||
sync-test-ubuntu-tsan:
|
||||
@@ -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
|
||||
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_BROTLI=OFF -DCURL_ZSTD=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 -DCURL_DISABLE_WEBSOCKETS=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 -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -50,14 +50,14 @@ jobs:
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_TSAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DWITH_LTO=OFF -DSTATIC_LIBS=ON
|
||||
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_TSAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DWITH_LTO=OFF -DSTATIC_LIBS=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
@@ -67,11 +67,8 @@ jobs:
|
||||
python ../tests/src/stratum_dummy.py 1 &
|
||||
python ../tests/src/stratum_dummy.py 2 &
|
||||
python ../tests/src/stratum_dummy.py 3 &
|
||||
python ../tests/src/mm_server.py 8000 id0 data0 &
|
||||
python ../tests/src/mm_server.py 8001 id1 data1 &
|
||||
python ../tests/src/mm_server.py 8002 id2 data2 &
|
||||
sudo sysctl vm.mmap_rnd_bits=28
|
||||
TSAN_OPTIONS="suppressions=../tests/src/tsan_sup.txt halt_on_error=1" ./p2pool ${{ secrets.TESTNET_NODE_PARAMS }} --config ../tests/src/mm_test_config.json --wallet 9y9HUSpSZX7j2J5UUngX5nCRezR6mZfLmL2D5JXpmPjYVDCPCCcw6Tab2R55xqPTN2FoQEEDmz99TVdy9EW74mqMUw5xRun --data-api data --local-api --merge-mine 127.0.0.1:8000 test0 --merge-mine 127.0.0.1:8001 test1 --merge-mine 127.0.0.1:8002 test2 --loglevel 6
|
||||
TSAN_OPTIONS="suppressions=../tests/src/tsan_sup.txt halt_on_error=1 history_size=4" ./p2pool --host xmrbandwagon.hopto.org --rpc-port 18081 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||
|
||||
- name: Check p2pool.log
|
||||
run: |
|
||||
@@ -100,14 +97,14 @@ jobs:
|
||||
run: |
|
||||
wget https://apt.llvm.org/llvm.sh
|
||||
chmod +x llvm.sh
|
||||
sudo ./llvm.sh 18
|
||||
sudo ./llvm.sh 20 all
|
||||
|
||||
- name: Build libcxx_msan
|
||||
run: |
|
||||
git clone --depth=1 https://github.com/llvm/llvm-project -b release/18.x
|
||||
git clone --depth=1 https://github.com/llvm/llvm-project -b release/20.x
|
||||
cd llvm-project
|
||||
mkdir build
|
||||
cmake -G Ninja -S runtimes -B build -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DLLVM_USE_SANITIZER=MemoryWithOrigins -DLIBCXXABI_USE_LLVM_UNWINDER=OFF
|
||||
cmake -G Ninja -S runtimes -B build -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DLLVM_USE_SANITIZER=MemoryWithOrigins -DLIBCXXABI_USE_LLVM_UNWINDER=OFF
|
||||
ninja -C build cxx cxxabi
|
||||
cd build
|
||||
mkdir /tmp/libcxx_msan
|
||||
@@ -122,7 +119,7 @@ jobs:
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
cmake . -DCMAKE_C_COMPILER=clang-18 -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
|
||||
cmake . -DCMAKE_C_COMPILER=clang-20 -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_BROTLI=OFF -DCURL_ZSTD=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 -DCURL_DISABLE_WEBSOCKETS=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 -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -131,7 +128,7 @@ jobs:
|
||||
cd external/src/libuv
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER=clang-18 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_C_COMPILER=clang-20 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -139,14 +136,14 @@ jobs:
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g -isystem /tmp/libcxx_msan/include/c++/v1 -L/tmp/libcxx_msan/lib -lc++ -lc++abi -Wno-unused-command-line-argument' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
|
||||
cmake .. -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Og -fno-omit-frame-pointer -g -isystem /tmp/libcxx_msan/include/c++/v1 -L/tmp/libcxx_msan/lib -lc++ -lc++abi -Wno-unused-command-line-argument' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -isystem /tmp/libcxx_msan/include/c++/v1 -L/tmp/libcxx_msan/lib -Wl,-rpath /tmp/libcxx_msan/lib -lc++ -lc++abi -Wno-unused-command-line-argument -fuse-ld=lld-18 -fno-omit-frame-pointer -g' -DDEV_TEST_SYNC=ON -DDEV_WITH_MSAN=ON -DWITH_LTO=OFF -DSTATIC_LIBS=ON
|
||||
cmake .. -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -isystem /tmp/libcxx_msan/include/c++/v1 -L/tmp/libcxx_msan/lib -Wl,-rpath /tmp/libcxx_msan/lib -lc++ -lc++abi -Wno-unused-command-line-argument -fuse-ld=lld-20 -fno-omit-frame-pointer -g' -DDEV_TEST_SYNC=ON -DDEV_WITH_MSAN=ON -DWITH_LTO=OFF -DSTATIC_LIBS=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
@@ -156,11 +153,8 @@ jobs:
|
||||
python ../tests/src/stratum_dummy.py 1 &
|
||||
python ../tests/src/stratum_dummy.py 2 &
|
||||
python ../tests/src/stratum_dummy.py 3 &
|
||||
python ../tests/src/mm_server.py 8000 id0 data0 &
|
||||
python ../tests/src/mm_server.py 8001 id1 data1 &
|
||||
python ../tests/src/mm_server.py 8002 id2 data2 &
|
||||
sudo sysctl vm.mmap_rnd_bits=28
|
||||
MSAN_OPTIONS="halt_on_error=1" ./p2pool ${{ secrets.TESTNET_NODE_PARAMS }} --config ../tests/src/mm_test_config.json --wallet 9y9HUSpSZX7j2J5UUngX5nCRezR6mZfLmL2D5JXpmPjYVDCPCCcw6Tab2R55xqPTN2FoQEEDmz99TVdy9EW74mqMUw5xRun --data-api data --local-api --merge-mine 127.0.0.1:8000 test0 --merge-mine 127.0.0.1:8001 test1 --merge-mine 127.0.0.1:8002 test2 --loglevel 6
|
||||
MSAN_OPTIONS="halt_on_error=1" ./p2pool --host xmrbandwagon.hopto.org --rpc-port 18081 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||
|
||||
- name: Check p2pool.log
|
||||
run: |
|
||||
@@ -196,7 +190,7 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_UBSAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DWITH_LTO=OFF
|
||||
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_UBSAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DWITH_LTO=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
@@ -206,11 +200,8 @@ jobs:
|
||||
python ../tests/src/stratum_dummy.py 1 &
|
||||
python ../tests/src/stratum_dummy.py 2 &
|
||||
python ../tests/src/stratum_dummy.py 3 &
|
||||
python ../tests/src/mm_server.py 8000 id0 data0 &
|
||||
python ../tests/src/mm_server.py 8001 id1 data1 &
|
||||
python ../tests/src/mm_server.py 8002 id2 data2 &
|
||||
sudo sysctl vm.mmap_rnd_bits=28
|
||||
UBSAN_OPTIONS="suppressions=../tests/src/ubsan_sup.txt halt_on_error=1" ./p2pool ${{ secrets.TESTNET_NODE_PARAMS }} --config ../tests/src/mm_test_config.json --wallet 9y9HUSpSZX7j2J5UUngX5nCRezR6mZfLmL2D5JXpmPjYVDCPCCcw6Tab2R55xqPTN2FoQEEDmz99TVdy9EW74mqMUw5xRun --data-api data --local-api --merge-mine 127.0.0.1:8000 test0 --merge-mine 127.0.0.1:8001 test1 --merge-mine 127.0.0.1:8002 test2 --loglevel 6
|
||||
UBSAN_OPTIONS="suppressions=../tests/src/ubsan_sup.txt halt_on_error=1" ./p2pool --host xmrbandwagon.hopto.org --rpc-port 18081 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||
|
||||
- name: Check p2pool.log
|
||||
run: |
|
||||
@@ -246,7 +237,7 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_ASAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS="-fno-omit-frame-pointer -fsanitize=address -Og -g" -DCMAKE_CXX_FLAGS="-fno-omit-frame-pointer -fsanitize=address -Og -g" -DWITH_LTO=OFF
|
||||
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_ASAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_FLAGS="-fno-omit-frame-pointer -fsanitize=address -Og -g" -DCMAKE_CXX_FLAGS="-fno-omit-frame-pointer -fsanitize=address -Og -g" -DWITH_LTO=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
@@ -256,11 +247,8 @@ jobs:
|
||||
python ../tests/src/stratum_dummy.py 1 &
|
||||
python ../tests/src/stratum_dummy.py 2 &
|
||||
python ../tests/src/stratum_dummy.py 3 &
|
||||
python ../tests/src/mm_server.py 8000 id0 data0 &
|
||||
python ../tests/src/mm_server.py 8001 id1 data1 &
|
||||
python ../tests/src/mm_server.py 8002 id2 data2 &
|
||||
sudo sysctl vm.mmap_rnd_bits=28
|
||||
ASAN_OPTIONS="detect_stack_use_after_return=1 atexit=1" ./p2pool ${{ secrets.TESTNET_NODE_PARAMS }} --config ../tests/src/mm_test_config.json --wallet 9y9HUSpSZX7j2J5UUngX5nCRezR6mZfLmL2D5JXpmPjYVDCPCCcw6Tab2R55xqPTN2FoQEEDmz99TVdy9EW74mqMUw5xRun --data-api data --local-api --merge-mine 127.0.0.1:8000 test0 --merge-mine 127.0.0.1:8001 test1 --merge-mine 127.0.0.1:8002 test2 --loglevel 6
|
||||
ASAN_OPTIONS="detect_stack_use_after_return=1 atexit=1" ./p2pool --host xmrbandwagon.hopto.org --rpc-port 18081 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||
|
||||
- name: Check p2pool.log
|
||||
run: |
|
||||
@@ -283,8 +271,8 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
config:
|
||||
- {os: macos-13, flags: "-Og -ftrapv"}
|
||||
- {os: macos-14, flags: "-Og -ftrapv -target arm64-apple-macos-11"}
|
||||
- {os: macos-13, flags: ""}
|
||||
- {os: macos-14, flags: "-target arm64-apple-macos-11"}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -292,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
|
||||
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_BROTLI=OFF -DCURL_ZSTD=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 -DCURL_DISABLE_WEBSOCKETS=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 -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
make -j4
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
@@ -324,7 +307,7 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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 }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}' -DWITH_LTO=OFF -DSTATIC_LIBS=ON -DDEV_TEST_SYNC=ON
|
||||
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_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 }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}' -DWITH_LTO=OFF -DSTATIC_LIBS=ON -DDEV_TEST_SYNC=ON -DDEV_DEBUG=ON
|
||||
make -j4 p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
@@ -334,10 +317,7 @@ jobs:
|
||||
python3 ../tests/src/stratum_dummy.py 1 &
|
||||
python3 ../tests/src/stratum_dummy.py 2 &
|
||||
python3 ../tests/src/stratum_dummy.py 3 &
|
||||
python3 ../tests/src/mm_server.py 8000 id0 data0 &
|
||||
python3 ../tests/src/mm_server.py 8001 id1 data1 &
|
||||
python3 ../tests/src/mm_server.py 8002 id2 data2 &
|
||||
./p2pool ${{ secrets.TESTNET_NODE_PARAMS }} --config ../tests/src/mm_test_config.json --wallet 9y9HUSpSZX7j2J5UUngX5nCRezR6mZfLmL2D5JXpmPjYVDCPCCcw6Tab2R55xqPTN2FoQEEDmz99TVdy9EW74mqMUw5xRun --data-api data --local-api --merge-mine 127.0.0.1:8000 test0 --merge-mine 127.0.0.1:8001 test1 --merge-mine 127.0.0.1:8002 test2 --loglevel 6
|
||||
./p2pool --host xmrbandwagon.hopto.org --rpc-port 18081 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||
|
||||
- name: Check p2pool.log
|
||||
run: |
|
||||
@@ -370,7 +350,7 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_TEST_SYNC=ON -DDEV_WITH_ASAN=ON
|
||||
cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_TEST_SYNC=ON -DDEV_WITH_ASAN=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
& "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Debug p2pool.vcxproj
|
||||
|
||||
- name: Run p2pool
|
||||
@@ -382,10 +362,7 @@ jobs:
|
||||
start python ../../tests/src/stratum_dummy.py 1
|
||||
start python ../../tests/src/stratum_dummy.py 2
|
||||
start python ../../tests/src/stratum_dummy.py 3
|
||||
start python ../../tests/src/mm_server.py 8000 id0 data0 &
|
||||
start python ../../tests/src/mm_server.py 8001 id1 data1 &
|
||||
start python ../../tests/src/mm_server.py 8002 id2 data2 &
|
||||
p2pool.exe ${{ secrets.TESTNET_NODE_PARAMS }} --config ../../tests/src/mm_test_config.json --wallet 9y9HUSpSZX7j2J5UUngX5nCRezR6mZfLmL2D5JXpmPjYVDCPCCcw6Tab2R55xqPTN2FoQEEDmz99TVdy9EW74mqMUw5xRun --data-api data --local-api --merge-mine 127.0.0.1:8000 test0 --merge-mine 127.0.0.1:8001 test1 --merge-mine 127.0.0.1:8002 test2 --loglevel 6
|
||||
p2pool.exe --host xmrbandwagon.hopto.org --rpc-port 18081 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||
|
||||
- name: Check p2pool.log
|
||||
run: |
|
||||
@@ -418,7 +395,7 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_TEST_SYNC=ON -DDEV_TRACK_MEMORY=ON
|
||||
cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_TEST_SYNC=ON -DDEV_TRACK_MEMORY=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
& "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=RelWithDebInfo p2pool.vcxproj
|
||||
|
||||
- name: Run p2pool
|
||||
@@ -428,20 +405,19 @@ jobs:
|
||||
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 1"
|
||||
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 2"
|
||||
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 3"
|
||||
Start-Process python -ArgumentList "../../tests/src/mm_server.py 8000 id0 data0"
|
||||
Start-Process python -ArgumentList "../../tests/src/mm_server.py 8001 id1 data1"
|
||||
Start-Process python -ArgumentList "../../tests/src/mm_server.py 8002 id2 data2"
|
||||
./p2pool.exe ${{ secrets.TESTNET_NODE_PARAMS }} --config ../../tests/src/mm_test_config.json --wallet 9y9HUSpSZX7j2J5UUngX5nCRezR6mZfLmL2D5JXpmPjYVDCPCCcw6Tab2R55xqPTN2FoQEEDmz99TVdy9EW74mqMUw5xRun --data-api data --local-api --merge-mine 127.0.0.1:8000 test0 --merge-mine 127.0.0.1:8001 test1 --merge-mine 127.0.0.1:8002 test2 --loglevel 6
|
||||
./p2pool.exe --host xmrbandwagon.hopto.org --rpc-port 18081 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||
|
||||
- name: Check p2pool.log
|
||||
run: |
|
||||
cd build/RelWithDebInfo
|
||||
Remove-Item p2pool.cache -Force
|
||||
findstr /C:"Synchronization finished successfully" p2pool.log
|
||||
|
||||
- name: Archive p2pool.log
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: p2pool_windows_data_leaks
|
||||
path: |
|
||||
build/RelWithDebInfo/*.log
|
||||
build/RelWithDebInfo/p2pool.*
|
||||
build/RelWithDebInfo/data/
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
.vscode
|
||||
build
|
||||
logs
|
||||
|
||||
+42
-17
@@ -17,6 +17,7 @@ option(WITH_RANDOMX "Include the RandomX library in the build. If this is turned
|
||||
option(WITH_LTO "Use link-time compiler optimization (if linking fails for you, run cmake with -DWITH_LTO=OFF)" ON)
|
||||
option(WITH_UPNP "Include UPnP support. If this is turned off, p2pool will not be able to configure port forwarding on UPnP-enabled routers." ON)
|
||||
option(WITH_GRPC "Include gRPC support. If this is turned off, p2pool will not be able to merge mine with Tari." ON)
|
||||
option(WITH_TLS "Include TLS support. If this is turned off, p2pool will not support Stratum TLS connections." ON)
|
||||
|
||||
option(DEV_TEST_SYNC "[Developer only] Sync test, stop p2pool after sync is complete" OFF)
|
||||
option(DEV_WITH_TSAN "[Developer only] Compile with thread sanitizer" OFF)
|
||||
@@ -25,11 +26,12 @@ option(DEV_WITH_UBSAN "[Developer only] Compile with undefined behavior sanitize
|
||||
option(DEV_WITH_ASAN "[Developer only] Compile with address sanitizer" OFF)
|
||||
option(DEV_CLANG_TIDY "[Developer only] Compile for clang-tidy" OFF)
|
||||
option(DEV_TRACK_MEMORY "[Developer only] Track memory allocations" OFF)
|
||||
option(DEV_DEBUG "[Developer only] Compile a debug build" OFF)
|
||||
|
||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT p2pool)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION 10.0)
|
||||
include(cmake/msvc_libs.cmake)
|
||||
endif()
|
||||
|
||||
if (WITH_GRPC)
|
||||
@@ -37,6 +39,9 @@ if (WITH_GRPC)
|
||||
include(cmake/grpc.cmake)
|
||||
|
||||
add_subdirectory(external/src/Tari)
|
||||
elseif (WITH_TLS)
|
||||
add_subdirectory(cmake/ssl)
|
||||
include_directories(external/src/grpc/third_party/boringssl-with-bazel/src/include)
|
||||
endif()
|
||||
|
||||
if (WITH_RANDOMX)
|
||||
@@ -79,6 +84,10 @@ if (DEV_TRACK_MEMORY)
|
||||
add_definitions(-DDEV_TRACK_MEMORY)
|
||||
endif()
|
||||
|
||||
if (DEV_DEBUG)
|
||||
add_definitions(-DDEV_DEBUG)
|
||||
endif()
|
||||
|
||||
include(cmake/flags.cmake)
|
||||
|
||||
set(HEADERS
|
||||
@@ -166,6 +175,13 @@ if (WITH_GRPC)
|
||||
set(SOURCES ${SOURCES} src/merge_mining_client_tari.cpp)
|
||||
endif()
|
||||
|
||||
if (WITH_TLS)
|
||||
add_definitions(-DWITH_TLS)
|
||||
|
||||
set(HEADERS ${HEADERS} src/tls.h)
|
||||
set(SOURCES ${SOURCES} src/tls.cpp)
|
||||
endif()
|
||||
|
||||
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "Header Files" FILES ${HEADERS})
|
||||
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "Source Files" FILES ${SOURCES})
|
||||
|
||||
@@ -204,7 +220,7 @@ if (WITH_UPNP)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
set(LIBS ${LIBS} ws2_32 iphlpapi userenv psapi dnsapi dbghelp)
|
||||
set(LIBS ${LIBS} ws2_32 iphlpapi userenv psapi dnsapi dbghelp advapi32)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
set(LIBS ${LIBS} bcrypt)
|
||||
endif()
|
||||
@@ -217,16 +233,7 @@ elseif (NOT APPLE)
|
||||
set(LIBS ${LIBS} pthread)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
find_library(ZMQ_LIBRARY_DEBUG NAMES libzmq-v142-mt-sgd-4_3_6 PATHS "external/lib/libzmq/Debug")
|
||||
find_library(ZMQ_LIBRARY NAMES libzmq-v142-mt-s-4_3_6 PATHS "external/lib/libzmq/Release")
|
||||
find_library(UV_LIBRARY_DEBUG NAMES libuv PATHS "external/lib/libuv/Debug")
|
||||
find_library(UV_LIBRARY NAMES libuv PATHS "external/lib/libuv/Release")
|
||||
find_library(CURL_LIBRARY_DEBUG NAMES libcurl-d PATHS "external/lib/libcurl/Debug")
|
||||
find_library(CURL_LIBRARY NAMES libcurl PATHS "external/lib/libcurl/Release")
|
||||
add_definitions(-D_DISABLE_VECTOR_ANNOTATION)
|
||||
add_definitions(-D_DISABLE_STRING_ANNOTATION)
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
||||
find_library(ZMQ_LIBRARY_DEBUG NAMES zmq libzmq.a)
|
||||
find_library(ZMQ_LIBRARY NAMES zmq libzmq.a)
|
||||
find_library(UV_LIBRARY_DEBUG NAMES uv libuv.a)
|
||||
@@ -338,6 +345,16 @@ int main(int argc, char* argv[])
|
||||
return 0;
|
||||
}" HAVE_RES_QUERY)
|
||||
|
||||
check_c_source_compiles("
|
||||
#define _GNU_SOURCE
|
||||
#include <pthread.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
pthread_setname_np(pthread_self(), \"Main\");
|
||||
return 0;
|
||||
}" HAVE_PTHREAD_SETNAME_NP)
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
if (HAVE_BUILTIN_CLZLL)
|
||||
@@ -359,12 +376,16 @@ if (HAVE_RES_QUERY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (HAVE_PTHREAD_SETNAME_NP)
|
||||
add_definitions(/DHAVE_PTHREAD_SETNAME_NP)
|
||||
endif()
|
||||
|
||||
add_definitions("-DRAPIDJSON_PARSE_DEFAULT_FLAGS=kParseTrailingCommasFlag")
|
||||
|
||||
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES})
|
||||
|
||||
if (STATIC_BINARY OR STATIC_LIBS)
|
||||
if (NOT (DEV_WITH_TSAN OR DEV_WITH_MSAN OR DEV_WITH_UBSAN OR DEV_WITH_ASAN))
|
||||
if ((CMAKE_BUILD_TYPE STREQUAL "Release") AND (NOT (DEV_WITH_TSAN OR DEV_WITH_MSAN OR DEV_WITH_UBSAN OR DEV_WITH_ASAN)))
|
||||
if (WIN32)
|
||||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} "${CMAKE_PROJECT_NAME}.exe")
|
||||
else()
|
||||
@@ -404,6 +425,8 @@ if (STATIC_BINARY OR STATIC_LIBS)
|
||||
|
||||
if (WITH_GRPC)
|
||||
set(STATIC_LIBS ${STATIC_LIBS} Tari_gRPC grpc grpc++ libprotobuf)
|
||||
elseif(WITH_TLS)
|
||||
set(STATIC_LIBS ${STATIC_LIBS} ssl crypto)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME}
|
||||
@@ -415,14 +438,16 @@ if (STATIC_BINARY OR STATIC_LIBS)
|
||||
else()
|
||||
if (WITH_GRPC)
|
||||
set(LIBS ${LIBS} Tari_gRPC grpc grpc++ libprotobuf)
|
||||
elseif(WITH_TLS)
|
||||
set(LIBS ${LIBS} ssl crypto)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} debug ${ZMQ_LIBRARY_DEBUG} debug ${UV_LIBRARY_DEBUG} debug ${CURL_LIBRARY_DEBUG} optimized ${ZMQ_LIBRARY} optimized ${UV_LIBRARY} optimized ${CURL_LIBRARY} ${LIBS})
|
||||
endif()
|
||||
|
||||
message(STATUS "Summary of build options:
|
||||
C compiler: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID})
|
||||
CXX compiler: ${CMAKE_CXX_COMPILER} (${CMAKE_CXX_COMPILER_ID})
|
||||
C_FLAGS: ${CMAKE_C_FLAGS}
|
||||
CXX_FLAGS: ${CMAKE_CXX_FLAGS}
|
||||
C compiler: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID})
|
||||
CXX compiler: ${CMAKE_CXX_COMPILER} (${CMAKE_CXX_COMPILER_ID})
|
||||
C_FLAGS: ${CMAKE_C_FLAGS}
|
||||
CXX_FLAGS: ${CMAKE_CXX_FLAGS}
|
||||
")
|
||||
|
||||
@@ -82,7 +82,7 @@ In order to continue mining on P2Pool, you must update both Monero and P2Pool so
|
||||
|
||||
|Monero protocol version|Required Monero software version|Required P2Pool version
|
||||
|-|-|-|
|
||||
|v15, v16 (active after August 13th, 2022)|v0.18.0.0 or newer, v0.18.3.3 is recommended|v4.0 or newer
|
||||
|v15, v16 (active after August 13th, 2022)|v0.18.0.0 or newer, v0.18.3.4 is recommended|v4.0 or newer
|
||||
|
||||
## How to mine on P2Pool
|
||||
|
||||
|
||||
+43
-15
@@ -17,7 +17,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
set(GENERAL_FLAGS "${GENERAL_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
|
||||
endif()
|
||||
|
||||
set(WARNING_FLAGS "-Wall -Wextra -Wcast-qual -Wlogical-op -Wundef -Wformat=2 -Wpointer-arith -Werror")
|
||||
set(WARNING_FLAGS "-Wall -Wextra -Wcast-qual -Wlogical-op -Wundef -Wformat=2 -Wpointer-arith -Werror -Wno-error=inline -Wno-error=unused-function")
|
||||
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.5.0)
|
||||
set(WARNING_FLAGS "${WARNING_FLAGS} -Wstrict-overflow=2")
|
||||
@@ -27,13 +27,19 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
set(WARNING_FLAGS "-w")
|
||||
endif()
|
||||
|
||||
if (DEV_WITH_TSAN OR DEV_WITH_UBSAN OR DEV_WITH_ASAN)
|
||||
set(OPTIMIZATION_FLAGS "-Og -g")
|
||||
if (DEV_WITH_TSAN OR DEV_WITH_UBSAN OR DEV_WITH_ASAN OR DEV_DEBUG OR (CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
|
||||
add_definitions(-DDEBUG_BUILD)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(OPTIMIZATION_FLAGS "-O0")
|
||||
else()
|
||||
set(OPTIMIZATION_FLAGS "-Og")
|
||||
endif()
|
||||
set(OPTIMIZATION_FLAGS "${OPTIMIZATION_FLAGS} -g3 -ftrapv")
|
||||
else()
|
||||
set(OPTIMIZATION_FLAGS "-Ofast -s")
|
||||
set(OPTIMIZATION_FLAGS "-O3 -ffast-math -s")
|
||||
endif()
|
||||
|
||||
if (WITH_LTO)
|
||||
if (WITH_LTO AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
|
||||
set(OPTIMIZATION_FLAGS "${OPTIMIZATION_FLAGS} -flto=auto -fuse-linker-plugin")
|
||||
endif()
|
||||
|
||||
@@ -42,10 +48,16 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
|
||||
set(CMAKE_C_FLAGS_DEBUG "")
|
||||
set(CMAKE_C_FLAGS_RELEASE "")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "")
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "")
|
||||
|
||||
if (WIN32)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
|
||||
@@ -60,12 +72,16 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
set(GENERAL_FLAGS "/MP /EHa")
|
||||
set(WARNING_FLAGS "/Wall /WX /sdl")
|
||||
set(SECURITY_FLAGS "/GS /guard:cf")
|
||||
set(OPTIMIZATION_FLAGS "/O2 /Oi /Ob2 /Ot /DNDEBUG /GL")
|
||||
set(OPTIMIZATION_FLAGS "/O2 /Oi /Ob2 /Ot /Oy /DNDEBUG /GL")
|
||||
|
||||
if (DISABLE_WARNINGS)
|
||||
set(WARNING_FLAGS "/W0")
|
||||
endif()
|
||||
|
||||
if (DEV_DEBUG OR (CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
|
||||
add_definitions(-DDEBUG_BUILD)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "${GENERAL_FLAGS} ${WARNING_FLAGS} ${SECURITY_FLAGS} /Od /Ob0 /Zi /MTd")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${GENERAL_FLAGS} ${WARNING_FLAGS} ${SECURITY_FLAGS} /Od /Ob0 /Zi /MTd")
|
||||
|
||||
@@ -93,25 +109,37 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
||||
set(GENERAL_FLAGS "${GENERAL_FLAGS} -mfix-cortex-a53-835769")
|
||||
endif()
|
||||
|
||||
set(WARNING_FLAGS "-Wall -Wextra -Wno-undefined-internal -Wunreachable-code-aggressive -Wmissing-prototypes -Wmissing-variable-declarations -Werror")
|
||||
set(WARNING_FLAGS "-Wall -Wextra -Wno-unused-function -Wno-undefined-internal -Wunreachable-code-aggressive -Wmissing-prototypes -Wmissing-variable-declarations -Werror")
|
||||
|
||||
if (DISABLE_WARNINGS)
|
||||
set(WARNING_FLAGS "-w")
|
||||
endif()
|
||||
|
||||
if (DEV_WITH_MSAN)
|
||||
set(OPTIMIZATION_FLAGS "-Og -g")
|
||||
if (DEV_WITH_MSAN OR DEV_DEBUG OR (CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
|
||||
add_definitions(-DDEBUG_BUILD)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(OPTIMIZATION_FLAGS "-O0")
|
||||
else()
|
||||
set(OPTIMIZATION_FLAGS "-Og")
|
||||
endif()
|
||||
set(OPTIMIZATION_FLAGS "${OPTIMIZATION_FLAGS} -g3 -ftrapv")
|
||||
else()
|
||||
set(OPTIMIZATION_FLAGS "-Ofast -funroll-loops -fmerge-all-constants")
|
||||
set(OPTIMIZATION_FLAGS "-O3 -ffast-math -funroll-loops -fmerge-all-constants")
|
||||
endif()
|
||||
|
||||
if (WITH_LTO)
|
||||
if (WITH_LTO AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
|
||||
set(OPTIMIZATION_FLAGS "${OPTIMIZATION_FLAGS} -flto")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
|
||||
set(CMAKE_C_FLAGS_DEBUG "")
|
||||
set(CMAKE_C_FLAGS_RELEASE "")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "")
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${GENERAL_FLAGS} ${WARNING_FLAGS} ${OPTIMIZATION_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "")
|
||||
endif()
|
||||
|
||||
@@ -35,5 +35,6 @@ add_definitions(-DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0)
|
||||
add_subdirectory(external/src/grpc)
|
||||
|
||||
include_directories(external/src/grpc/third_party/abseil-cpp)
|
||||
include_directories(external/src/grpc/third_party/boringssl-with-bazel/src/include)
|
||||
include_directories(external/src/grpc/third_party/protobuf/src)
|
||||
include_directories(external/src/grpc/include)
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION 10.0)
|
||||
|
||||
add_definitions(-D_DISABLE_VECTOR_ANNOTATION)
|
||||
add_definitions(-D_DISABLE_STRING_ANNOTATION)
|
||||
|
||||
set(BUILD_TESTING OFF CACHE BOOL "")
|
||||
set(LIBUV_BUILD_SHARED OFF CACHE BOOL "")
|
||||
set(WITH_LIBSODIUM OFF CACHE BOOL "")
|
||||
set(WITH_LIBBSD OFF CACHE BOOL "")
|
||||
set(BUILD_TESTS OFF CACHE BOOL "")
|
||||
set(ZMQ_HAVE_IPC OFF CACHE BOOL "")
|
||||
set(WITH_DOCS OFF CACHE BOOL "")
|
||||
set(ENABLE_DRAFTS OFF CACHE BOOL "")
|
||||
set(BUILD_SHARED OFF CACHE BOOL "")
|
||||
set(ENABLE_CLANG OFF CACHE BOOL "")
|
||||
|
||||
set(CURL_TARGET_WINDOWS_VERSION "0x0600" CACHE STRING "")
|
||||
set(BUILD_CURL_EXE OFF CACHE BOOL "")
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "")
|
||||
set(CURL_DISABLE_INSTALL ON CACHE BOOL "")
|
||||
set(CURL_ENABLE_EXPORT_TARGET OFF CACHE BOOL "")
|
||||
set(CURL_DISABLE_HEADERS_API ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_BINDLOCAL ON CACHE BOOL "")
|
||||
set(BUILD_LIBCURL_DOCS OFF CACHE BOOL "")
|
||||
set(BUILD_MISC_DOCS OFF CACHE BOOL "")
|
||||
set(ENABLE_CURL_MANUAL OFF CACHE BOOL "")
|
||||
set(CURL_ZLIB OFF CACHE BOOL "")
|
||||
set(CURL_BROTLI OFF CACHE BOOL "")
|
||||
set(CURL_ZSTD OFF CACHE BOOL "")
|
||||
set(CURL_DISABLE_ALTSVC ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_COOKIES ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_DOH ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_GETOPTIONS ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_HSTS ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_LIBCURL_OPTION ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_MIME ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_NETRC ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_NTLM ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_PARSEDATE ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_PROGRESS_METER ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_SHUFFLE_DNS ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_SOCKETPAIR ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_VERBOSE_STRINGS ON CACHE BOOL "")
|
||||
set(CURL_DISABLE_WEBSOCKETS ON CACHE BOOL "")
|
||||
set(HTTP_ONLY ON CACHE BOOL "")
|
||||
set(CURL_ENABLE_SSL OFF CACHE BOOL "")
|
||||
set(USE_LIBIDN2 OFF CACHE BOOL "")
|
||||
set(CURL_USE_LIBPSL OFF CACHE BOOL "")
|
||||
set(CURL_USE_LIBSSH2 OFF CACHE BOOL "")
|
||||
set(ENABLE_UNIX_SOCKETS OFF CACHE BOOL "")
|
||||
set(CURL_DISABLE_TESTS ON CACHE BOOL "")
|
||||
set(USE_NGHTTP2 OFF CACHE BOOL "")
|
||||
set(BUILD_EXAMPLES OFF CACHE BOOL "")
|
||||
set(CURL_DISABLE_SRP ON CACHE BOOL "")
|
||||
set(CURL_STATIC_CRT ON CACHE BOOL "")
|
||||
|
||||
if (WITH_TLS)
|
||||
set(P2POOL_BORINGSSL ON CACHE BOOL "")
|
||||
set(OPENSSL_INCLUDE_DIR "../grpc/third_party/boringssl-with-bazel/src/include" CACHE STRING "")
|
||||
endif()
|
||||
|
||||
add_subdirectory(external/src/curl)
|
||||
add_subdirectory(external/src/libuv)
|
||||
add_subdirectory(external/src/libzmq)
|
||||
|
||||
set(CURL_LIBRARY_DEBUG libcurl_static)
|
||||
set(CURL_LIBRARY libcurl_static)
|
||||
|
||||
set(UV_LIBRARY_DEBUG uv_a)
|
||||
set(UV_LIBRARY uv_a)
|
||||
|
||||
set(ZMQ_LIBRARY_DEBUG libzmq-static)
|
||||
set(ZMQ_LIBRARY libzmq-static)
|
||||
@@ -0,0 +1,31 @@
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
project(P2Pool_SSL LANGUAGES C CXX)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W0 /Zi /Od /Ob0 /MP /MTd")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W0 /Zi /Od /Ob0 /MP /MTd")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /W0 /O1 /Ob2 /Oi /Os /Oy /MP /MT")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W0 /O1 /Ob2 /Oi /Os /Oy /MP /MT")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /W0 /Ob1 /Ot /Zi /MP /MT")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /W0 /Ob1 /Ot /Zi /MP /MT")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -w")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -w")
|
||||
endif()
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
||||
message(WARNING "Disabling SSL assembly support because CMake version ${CMAKE_VERSION} is too old (less than 3.13)")
|
||||
set(OPENSSL_NO_ASM ON)
|
||||
else()
|
||||
include(CheckLanguage)
|
||||
check_language(ASM_NASM)
|
||||
if(NOT CMAKE_ASM_NASM_COMPILER)
|
||||
message(WARNING "Disabling SSL assembly support because NASM could not be found")
|
||||
set(OPENSSL_NO_ASM ON)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(../../external/src/grpc/third_party/boringssl-with-bazel BoringSSL)
|
||||
+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.6
|
||||
|
||||
Vendored
+3
-4
@@ -7,12 +7,11 @@ if [ -z "$DOCKER_VER" ]; then
|
||||
echo "Docker not found; install it: https://docs.docker.com/engine/install/"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$(echo "$DOCKER_VER"| cut -d'.' -f 1)" -ge 19 ] && \
|
||||
[ "$(echo "$DOCKER_VER"| cut -d'.' -f 2)" -ge 0 ] && \
|
||||
[ "$(echo "$DOCKER_VER"| cut -d'.' -f 3)" -ge 3 ]; then
|
||||
MIN_DOCKER_VER=19.0.3
|
||||
if { echo "$MIN_DOCKER_VER"; echo "$DOCKER_VER"; } | sort --version-sort --check=quiet; then
|
||||
echo "Docker Found; OK"
|
||||
else
|
||||
echo "Docker version less than 19.0.3; upgrade it: https://docs.docker.com/engine/install/"
|
||||
echo "Docker version less than $MIN_DOCKER_VER; upgrade it: https://docs.docker.com/engine/install/"
|
||||
exit 1
|
||||
fi
|
||||
docker compose version 2>&1 > /dev/null
|
||||
|
||||
@@ -5,4 +5,6 @@ COPY app /app
|
||||
WORKDIR /app
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
STOPSIGNAL SIGINT
|
||||
|
||||
CMD ["/app/p2pool_statistics.py"]
|
||||
|
||||
+68
-34
@@ -1,36 +1,42 @@
|
||||
### P2Pool command line options
|
||||
|
||||
```
|
||||
--wallet Wallet address to mine to. Subaddresses and integrated addresses are not supported!
|
||||
--host IP address of your Monero node, default is 127.0.0.1
|
||||
--rpc-port monerod RPC API port number, default is 18081
|
||||
--zmq-port monerod ZMQ pub port number, default is 18083 (same port as in monerod's "--zmq-pub" command line parameter)
|
||||
--stratum Comma-separated list of IP:port for stratum server to listen on
|
||||
--p2p Comma-separated list of IP:port for p2p server to listen on
|
||||
--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)
|
||||
--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
|
||||
--no-color Disable colors in console output
|
||||
--no-randomx Disable internal RandomX hasher: p2pool will use RPC calls to monerod to check PoW hashes
|
||||
--out-peers N Maximum number of outgoing connections for p2p server (any value between 10 and 450)
|
||||
--in-peers N Maximum number of incoming connections for p2p server (any value between 10 and 450)
|
||||
--start-mining N Start built-in miner using N threads (any value between 1 and 64)
|
||||
--mini Connect to p2pool-mini sidechain. Note that it will also change default p2p port from 37889 to 37888
|
||||
--no-autodiff Disable automatic difficulty adjustment for miners connected to stratum (WARNING: incompatible with Nicehash and MRR)
|
||||
--rpc-login Specify username[:password] required for Monero RPC server
|
||||
--socks5 Specify IP:port of a SOCKS5 proxy to use for outgoing connections
|
||||
--no-dns Disable DNS queries, use only IP addresses to connect to peers (seed node DNS will be unavailable too)
|
||||
--p2p-external-port Port number that your router uses for mapping to your local p2p port. Use it if you are behind a NAT and still want to accept incoming connections
|
||||
--no-upnp Disable UPnP port forwarding
|
||||
--no-igd An alias for --no-upnp
|
||||
--upnp-stratum Port forward Stratum port (it's not forwarded by default)
|
||||
--merge-mine IP:port and wallet address for another blockchain to merge mine with
|
||||
--version Print p2pool's version and build details
|
||||
--wallet Wallet address to mine to. Subaddresses and integrated addresses are not supported!
|
||||
--host IP address of your Monero node, default is 127.0.0.1
|
||||
--rpc-port monerod RPC API port number, default is 18081
|
||||
--zmq-port monerod ZMQ pub port number, default is 18083 (same port as in monerod's "--zmq-pub" command line parameter)
|
||||
--stratum Comma-separated list of IP:port for stratum server to listen on
|
||||
--p2p Comma-separated list of IP:port for p2p server to listen on
|
||||
--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
|
||||
--data-dir Path to store general p2pool files (log, cache, peer data, etc.), default is current directory
|
||||
--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
|
||||
--no-color Disable colors in console output
|
||||
--no-randomx Disable internal RandomX hasher: p2pool will use RPC calls to monerod to check PoW hashes
|
||||
--out-peers N Maximum number of outgoing connections for p2p server (any value between 10 and 450)
|
||||
--in-peers N Maximum number of incoming connections for p2p server (any value between 10 and 450)
|
||||
--start-mining N Start built-in miner using N threads (any value between 1 and 64)
|
||||
--mini Connect to p2pool-mini sidechain. Note that it will also change default p2p port from 37889 to 37888
|
||||
--no-autodiff Disable automatic difficulty adjustment for miners connected to stratum (WARNING: incompatible with Nicehash and MRR)
|
||||
--rpc-login Specify username[:password] required for Monero RPC server
|
||||
--socks5 Specify IP:port of a SOCKS5 proxy to use for outgoing connections
|
||||
--no-dns Disable DNS queries, use only IP addresses to connect to peers (seed node DNS will be unavailable too)
|
||||
--p2p-external-port Port number that your router uses for mapping to your local p2p port. Use it if you are behind a NAT and still want to accept incoming connections
|
||||
--no-upnp Disable UPnP port forwarding
|
||||
--no-igd An alias for --no-upnp
|
||||
--upnp-stratum Port forward Stratum port (it's not forwarded by default)
|
||||
--merge-mine IP:port and wallet address for another blockchain to merge mine with
|
||||
--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
|
||||
--rpc-ssl Enable SSL on RPC connections to the Monero node
|
||||
--rpc-ssl-fingerprint base64-encoded fingerprint of the Monero node's certificate (optional, use it for certificate pinning)
|
||||
--no-stratum-http Disable HTTP on Stratum ports
|
||||
```
|
||||
|
||||
### Example command line
|
||||
@@ -43,9 +49,9 @@ p2pool.exe --host 127.0.0.1 --rpc-port 18081 --zmq-port 18083 --wallet YOUR_WALL
|
||||
|
||||
You can have multiple hosts in command line. If P2Pool detects that the host it's currently using is down or stuck, it will cycle through hosts until it finds a working one. It will not switch back as long as the current host it found is working.
|
||||
|
||||
Each new host uses RPC and zmq-pub port numbers from the previous host (or default 18081/18083 if none were specified). Note that `--rpc-login` is not copied from the previous host, you must specify it for each host that has username/password.
|
||||
Each new host uses RPC and zmq-pub port numbers from the previous host (or default 18081/18083 if none were specified). Note that `--rpc-login`, `--rpc-ssl` and `--rpc-ssl-fingerprint` are not copied from the previous host, you must specify it for each host that has username/password or RPC-SSL enabled.
|
||||
|
||||
In this example, you have local Monero host running on ports 18081/18083 (RPC/zmq-pub), and several backup hosts running on ports 18089/18084.
|
||||
In the following example, you have local Monero host running on ports 18081/18083 (RPC/zmq-pub), and several backup hosts running on ports 18089/18084.
|
||||
|
||||
|
||||
```
|
||||
@@ -65,6 +71,34 @@ Merge mining will be available in P2Pool after the fork on October 12th, 2024. V
|
||||
|
||||
- [Tari](https://www.tari.com/) uses their own gRPC API and requires a different command line:
|
||||
```
|
||||
p2pool.exe --wallet YOUR_MONERO_WALLET_ADDRESS --merge-mine tari://IP:port TARI_WALLET_ADDRESS
|
||||
./p2pool --wallet YOUR_MONERO_WALLET_ADDRESS --merge-mine tari://IP:port TARI_WALLET_ADDRESS
|
||||
```
|
||||
Merge mining is available for testing in Tari's [v1.0.0-pre.14 release](https://github.com/tari-project/tari/releases/tag/v1.0.0-pre.14) (Esmeralda testnet).
|
||||
and on the Tari side
|
||||
```
|
||||
./minotari_node --grpc-enabled --mining-enabled
|
||||
```
|
||||
Merge mining is available for testing in Tari's [latest release](https://github.com/tari-project/tari/releases) (Esmeralda testnet).
|
||||
|
||||
### TLS
|
||||
|
||||
Starting from v4.1, P2Pool supports SSL/TLS connections to its Stratum port. Port 443 can also be safely used for Stratum connections since v4.1 - P2Pool will detect HTTP requests and respond to them.
|
||||
|
||||
All `--tls...` parameters are optional. If they are not provided, P2Pool will generate a self-signed certificate upon startup.
|
||||
|
||||
If you want to use your own certificate, please refer to your certificate provider's documentation (or OpenSSL documentation) on how to generate the appropriate PEM files.
|
||||
|
||||
Note that you need to use certificate files and `--tls...` parameters to be able to use certificate pinning in XMRig miners that connect to your P2Pool instance.
|
||||
|
||||
`--tls-cert` and `--tls-cert-key` parameters must always be used together.
|
||||
|
||||
### RPC-SSL
|
||||
|
||||
Starting from v4.4, P2Pool supports RPC-SSL connections to Monero nodes. Add `--rpc-ssl` to P2Pool command line to enable it.
|
||||
|
||||
P2Pool supports certificate pinning on RPC-SSL connections via `--rpc-ssl-fingerprint MONERO_NODE_FINGERPRINT_BASE64` parameter. To get your node certificate's fingerprint, run
|
||||
|
||||
```
|
||||
openssl x509 -in rpc_ssl.crt -pubkey -noout -inform pem | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
|
||||
```
|
||||
|
||||
By default, `rpc_ssl.crt` can be found in Monero data directory: `/home/username/.bitmonero/rpc_ssl.crt` on Linux and `C:\ProgramData\bitmonero\rpc_ssl.crt` on Windows.
|
||||
@@ -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
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Vendored
+1
-1
Submodule external/src/RandomX updated: d1c5a15507...e613bfe364
Vendored
+2
-2
@@ -39,8 +39,8 @@ include_directories(../grpc/third_party/abseil-cpp)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W0 /Zi /Od /Ob0 /MP /MTd")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W0 /Zi /Od /Ob0 /MP /MTd")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /W0 /O1 /Ob2 /Oi /Os /Oy /MP /GL /MT")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W0 /O1 /Ob2 /Oi /Os /Oy /MP /GL /MT")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /W0 /O1 /Ob2 /Oi /Os /Oy /MP /GL /MT /GS /guard:cf")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W0 /O1 /Ob2 /Oi /Os /Oy /MP /GL /MT /GS /guard:cf")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /W0 /Ob1 /Ot /Zi /MP /MT")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /W0 /Ob1 /Ot /Zi /MP /MT")
|
||||
else()
|
||||
|
||||
@@ -59,6 +59,7 @@ static const char* BaseNode_method_names[] = {
|
||||
"/tari.rpc.BaseNode/GetShardKey",
|
||||
"/tari.rpc.BaseNode/GetTemplateRegistrations",
|
||||
"/tari.rpc.BaseNode/GetSideChainUtxos",
|
||||
"/tari.rpc.BaseNode/GetNetworkState",
|
||||
};
|
||||
|
||||
std::unique_ptr< BaseNode::Stub> BaseNode::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
|
||||
@@ -104,6 +105,7 @@ BaseNode::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel,
|
||||
, rpcmethod_GetShardKey_(BaseNode_method_names[33], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_GetTemplateRegistrations_(BaseNode_method_names[34], options.suffix_for_stats(),::grpc::internal::RpcMethod::SERVER_STREAMING, channel)
|
||||
, rpcmethod_GetSideChainUtxos_(BaseNode_method_names[35], options.suffix_for_stats(),::grpc::internal::RpcMethod::SERVER_STREAMING, channel)
|
||||
, rpcmethod_GetNetworkState_(BaseNode_method_names[36], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
{}
|
||||
|
||||
::grpc::ClientReader< ::tari::rpc::BlockHeaderResponse>* BaseNode::Stub::ListHeadersRaw(::grpc::ClientContext* context, const ::tari::rpc::ListHeadersRequest& request) {
|
||||
@@ -850,6 +852,29 @@ void BaseNode::Stub::async::GetSideChainUtxos(::grpc::ClientContext* context, co
|
||||
return ::grpc::internal::ClientAsyncReaderFactory< ::tari::rpc::GetSideChainUtxosResponse>::Create(channel_.get(), cq, rpcmethod_GetSideChainUtxos_, context, request, false, nullptr);
|
||||
}
|
||||
|
||||
::grpc::Status BaseNode::Stub::GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::tari::rpc::GetNetworkStateResponse* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall< ::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_GetNetworkState_, context, request, response);
|
||||
}
|
||||
|
||||
void BaseNode::Stub::async::GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc::internal::CallbackUnaryCall< ::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_GetNetworkState_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
void BaseNode::Stub::async::GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response, ::grpc::ClientUnaryReactor* reactor) {
|
||||
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_GetNetworkState_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>* BaseNode::Stub::PrepareAsyncGetNetworkStateRaw(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::tari::rpc::GetNetworkStateResponse, ::tari::rpc::GetNetworkStateRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_GetNetworkState_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>* BaseNode::Stub::AsyncGetNetworkStateRaw(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
auto* result =
|
||||
this->PrepareAsyncGetNetworkStateRaw(context, request, cq);
|
||||
result->StartCall();
|
||||
return result;
|
||||
}
|
||||
|
||||
BaseNode::Service::Service() {
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
BaseNode_method_names[0],
|
||||
@@ -1211,6 +1236,16 @@ BaseNode::Service::Service() {
|
||||
::grpc::ServerWriter<::tari::rpc::GetSideChainUtxosResponse>* writer) {
|
||||
return service->GetSideChainUtxos(ctx, req, writer);
|
||||
}, this)));
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
BaseNode_method_names[36],
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< BaseNode::Service, ::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
|
||||
[](BaseNode::Service* service,
|
||||
::grpc::ServerContext* ctx,
|
||||
const ::tari::rpc::GetNetworkStateRequest* req,
|
||||
::tari::rpc::GetNetworkStateResponse* resp) {
|
||||
return service->GetNetworkState(ctx, req, resp);
|
||||
}, this)));
|
||||
}
|
||||
|
||||
BaseNode::Service::~Service() {
|
||||
@@ -1468,6 +1503,13 @@ BaseNode::Service::~Service() {
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
::grpc::Status BaseNode::Service::GetNetworkState(::grpc::ServerContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
|
||||
} // namespace tari
|
||||
} // namespace rpc
|
||||
|
||||
+161
-4
@@ -367,6 +367,13 @@ class BaseNode final {
|
||||
std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::tari::rpc::GetSideChainUtxosResponse>> PrepareAsyncGetSideChainUtxos(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::tari::rpc::GetSideChainUtxosResponse>>(PrepareAsyncGetSideChainUtxosRaw(context, request, cq));
|
||||
}
|
||||
virtual ::grpc::Status GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::tari::rpc::GetNetworkStateResponse* response) = 0;
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::tari::rpc::GetNetworkStateResponse>> AsyncGetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::tari::rpc::GetNetworkStateResponse>>(AsyncGetNetworkStateRaw(context, request, cq));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::tari::rpc::GetNetworkStateResponse>> PrepareAsyncGetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::tari::rpc::GetNetworkStateResponse>>(PrepareAsyncGetNetworkStateRaw(context, request, cq));
|
||||
}
|
||||
class async_interface {
|
||||
public:
|
||||
virtual ~async_interface() {}
|
||||
@@ -462,6 +469,8 @@ class BaseNode final {
|
||||
// Get templates
|
||||
virtual void GetTemplateRegistrations(::grpc::ClientContext* context, const ::tari::rpc::GetTemplateRegistrationsRequest* request, ::grpc::ClientReadReactor< ::tari::rpc::GetTemplateRegistrationResponse>* reactor) = 0;
|
||||
virtual void GetSideChainUtxos(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest* request, ::grpc::ClientReadReactor< ::tari::rpc::GetSideChainUtxosResponse>* reactor) = 0;
|
||||
virtual void GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response, std::function<void(::grpc::Status)>) = 0;
|
||||
virtual void GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0;
|
||||
};
|
||||
typedef class async_interface experimental_async_interface;
|
||||
virtual class async_interface* async() { return nullptr; }
|
||||
@@ -551,6 +560,8 @@ class BaseNode final {
|
||||
virtual ::grpc::ClientReaderInterface< ::tari::rpc::GetSideChainUtxosResponse>* GetSideChainUtxosRaw(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request) = 0;
|
||||
virtual ::grpc::ClientAsyncReaderInterface< ::tari::rpc::GetSideChainUtxosResponse>* AsyncGetSideChainUtxosRaw(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request, ::grpc::CompletionQueue* cq, void* tag) = 0;
|
||||
virtual ::grpc::ClientAsyncReaderInterface< ::tari::rpc::GetSideChainUtxosResponse>* PrepareAsyncGetSideChainUtxosRaw(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::tari::rpc::GetNetworkStateResponse>* AsyncGetNetworkStateRaw(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::tari::rpc::GetNetworkStateResponse>* PrepareAsyncGetNetworkStateRaw(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
};
|
||||
class Stub final : public StubInterface {
|
||||
public:
|
||||
@@ -831,6 +842,13 @@ class BaseNode final {
|
||||
std::unique_ptr< ::grpc::ClientAsyncReader< ::tari::rpc::GetSideChainUtxosResponse>> PrepareAsyncGetSideChainUtxos(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncReader< ::tari::rpc::GetSideChainUtxosResponse>>(PrepareAsyncGetSideChainUtxosRaw(context, request, cq));
|
||||
}
|
||||
::grpc::Status GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::tari::rpc::GetNetworkStateResponse* response) override;
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>> AsyncGetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>>(AsyncGetNetworkStateRaw(context, request, cq));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>> PrepareAsyncGetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>>(PrepareAsyncGetNetworkStateRaw(context, request, cq));
|
||||
}
|
||||
class async final :
|
||||
public StubInterface::async_interface {
|
||||
public:
|
||||
@@ -894,6 +912,8 @@ class BaseNode final {
|
||||
void GetShardKey(::grpc::ClientContext* context, const ::tari::rpc::GetShardKeyRequest* request, ::tari::rpc::GetShardKeyResponse* response, ::grpc::ClientUnaryReactor* reactor) override;
|
||||
void GetTemplateRegistrations(::grpc::ClientContext* context, const ::tari::rpc::GetTemplateRegistrationsRequest* request, ::grpc::ClientReadReactor< ::tari::rpc::GetTemplateRegistrationResponse>* reactor) override;
|
||||
void GetSideChainUtxos(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest* request, ::grpc::ClientReadReactor< ::tari::rpc::GetSideChainUtxosResponse>* reactor) override;
|
||||
void GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response, std::function<void(::grpc::Status)>) override;
|
||||
void GetNetworkState(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response, ::grpc::ClientUnaryReactor* reactor) override;
|
||||
private:
|
||||
friend class Stub;
|
||||
explicit async(Stub* stub): stub_(stub) { }
|
||||
@@ -989,6 +1009,8 @@ class BaseNode final {
|
||||
::grpc::ClientReader< ::tari::rpc::GetSideChainUtxosResponse>* GetSideChainUtxosRaw(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request) override;
|
||||
::grpc::ClientAsyncReader< ::tari::rpc::GetSideChainUtxosResponse>* AsyncGetSideChainUtxosRaw(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request, ::grpc::CompletionQueue* cq, void* tag) override;
|
||||
::grpc::ClientAsyncReader< ::tari::rpc::GetSideChainUtxosResponse>* PrepareAsyncGetSideChainUtxosRaw(::grpc::ClientContext* context, const ::tari::rpc::GetSideChainUtxosRequest& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>* AsyncGetNetworkStateRaw(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientAsyncResponseReader< ::tari::rpc::GetNetworkStateResponse>* PrepareAsyncGetNetworkStateRaw(::grpc::ClientContext* context, const ::tari::rpc::GetNetworkStateRequest& request, ::grpc::CompletionQueue* cq) override;
|
||||
const ::grpc::internal::RpcMethod rpcmethod_ListHeaders_;
|
||||
const ::grpc::internal::RpcMethod rpcmethod_GetHeaderByHash_;
|
||||
const ::grpc::internal::RpcMethod rpcmethod_GetBlocks_;
|
||||
@@ -1025,6 +1047,7 @@ class BaseNode final {
|
||||
const ::grpc::internal::RpcMethod rpcmethod_GetShardKey_;
|
||||
const ::grpc::internal::RpcMethod rpcmethod_GetTemplateRegistrations_;
|
||||
const ::grpc::internal::RpcMethod rpcmethod_GetSideChainUtxos_;
|
||||
const ::grpc::internal::RpcMethod rpcmethod_GetNetworkState_;
|
||||
};
|
||||
static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
|
||||
|
||||
@@ -1100,6 +1123,7 @@ class BaseNode final {
|
||||
// Get templates
|
||||
virtual ::grpc::Status GetTemplateRegistrations(::grpc::ServerContext* context, const ::tari::rpc::GetTemplateRegistrationsRequest* request, ::grpc::ServerWriter< ::tari::rpc::GetTemplateRegistrationResponse>* writer);
|
||||
virtual ::grpc::Status GetSideChainUtxos(::grpc::ServerContext* context, const ::tari::rpc::GetSideChainUtxosRequest* request, ::grpc::ServerWriter< ::tari::rpc::GetSideChainUtxosResponse>* writer);
|
||||
virtual ::grpc::Status GetNetworkState(::grpc::ServerContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response);
|
||||
};
|
||||
template <class BaseClass>
|
||||
class WithAsyncMethod_ListHeaders : public BaseClass {
|
||||
@@ -1821,7 +1845,27 @@ class BaseNode final {
|
||||
::grpc::Service::RequestAsyncServerStreaming(35, context, request, writer, new_call_cq, notification_cq, tag);
|
||||
}
|
||||
};
|
||||
typedef WithAsyncMethod_ListHeaders<WithAsyncMethod_GetHeaderByHash<WithAsyncMethod_GetBlocks<WithAsyncMethod_GetBlockTiming<WithAsyncMethod_GetConstants<WithAsyncMethod_GetBlockSize<WithAsyncMethod_GetBlockFees<WithAsyncMethod_GetVersion<WithAsyncMethod_CheckForUpdates<WithAsyncMethod_GetTokensInCirculation<WithAsyncMethod_GetNetworkDifficulty<WithAsyncMethod_GetNewBlockTemplate<WithAsyncMethod_GetNewBlock<WithAsyncMethod_GetNewBlockWithCoinbases<WithAsyncMethod_GetNewBlockTemplateWithCoinbases<WithAsyncMethod_GetNewBlockBlob<WithAsyncMethod_SubmitBlock<WithAsyncMethod_SubmitBlockBlob<WithAsyncMethod_SubmitTransaction<WithAsyncMethod_GetSyncInfo<WithAsyncMethod_GetSyncProgress<WithAsyncMethod_GetTipInfo<WithAsyncMethod_SearchKernels<WithAsyncMethod_SearchUtxos<WithAsyncMethod_FetchMatchingUtxos<WithAsyncMethod_GetPeers<WithAsyncMethod_GetMempoolTransactions<WithAsyncMethod_TransactionState<WithAsyncMethod_Identify<WithAsyncMethod_GetNetworkStatus<WithAsyncMethod_ListConnectedPeers<WithAsyncMethod_GetMempoolStats<WithAsyncMethod_GetActiveValidatorNodes<WithAsyncMethod_GetShardKey<WithAsyncMethod_GetTemplateRegistrations<WithAsyncMethod_GetSideChainUtxos<Service > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > AsyncService;
|
||||
template <class BaseClass>
|
||||
class WithAsyncMethod_GetNetworkState : public BaseClass {
|
||||
private:
|
||||
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
|
||||
public:
|
||||
WithAsyncMethod_GetNetworkState() {
|
||||
::grpc::Service::MarkMethodAsync(36);
|
||||
}
|
||||
~WithAsyncMethod_GetNetworkState() override {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status GetNetworkState(::grpc::ServerContext* /*context*/, const ::tari::rpc::GetNetworkStateRequest* /*request*/, ::tari::rpc::GetNetworkStateResponse* /*response*/) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
void RequestGetNetworkState(::grpc::ServerContext* context, ::tari::rpc::GetNetworkStateRequest* request, ::grpc::ServerAsyncResponseWriter< ::tari::rpc::GetNetworkStateResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
|
||||
::grpc::Service::RequestAsyncUnary(36, context, request, response, new_call_cq, notification_cq, tag);
|
||||
}
|
||||
};
|
||||
typedef WithAsyncMethod_ListHeaders<WithAsyncMethod_GetHeaderByHash<WithAsyncMethod_GetBlocks<WithAsyncMethod_GetBlockTiming<WithAsyncMethod_GetConstants<WithAsyncMethod_GetBlockSize<WithAsyncMethod_GetBlockFees<WithAsyncMethod_GetVersion<WithAsyncMethod_CheckForUpdates<WithAsyncMethod_GetTokensInCirculation<WithAsyncMethod_GetNetworkDifficulty<WithAsyncMethod_GetNewBlockTemplate<WithAsyncMethod_GetNewBlock<WithAsyncMethod_GetNewBlockWithCoinbases<WithAsyncMethod_GetNewBlockTemplateWithCoinbases<WithAsyncMethod_GetNewBlockBlob<WithAsyncMethod_SubmitBlock<WithAsyncMethod_SubmitBlockBlob<WithAsyncMethod_SubmitTransaction<WithAsyncMethod_GetSyncInfo<WithAsyncMethod_GetSyncProgress<WithAsyncMethod_GetTipInfo<WithAsyncMethod_SearchKernels<WithAsyncMethod_SearchUtxos<WithAsyncMethod_FetchMatchingUtxos<WithAsyncMethod_GetPeers<WithAsyncMethod_GetMempoolTransactions<WithAsyncMethod_TransactionState<WithAsyncMethod_Identify<WithAsyncMethod_GetNetworkStatus<WithAsyncMethod_ListConnectedPeers<WithAsyncMethod_GetMempoolStats<WithAsyncMethod_GetActiveValidatorNodes<WithAsyncMethod_GetShardKey<WithAsyncMethod_GetTemplateRegistrations<WithAsyncMethod_GetSideChainUtxos<WithAsyncMethod_GetNetworkState<Service > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > AsyncService;
|
||||
template <class BaseClass>
|
||||
class WithCallbackMethod_ListHeaders : public BaseClass {
|
||||
private:
|
||||
@@ -2734,7 +2778,34 @@ class BaseNode final {
|
||||
virtual ::grpc::ServerWriteReactor< ::tari::rpc::GetSideChainUtxosResponse>* GetSideChainUtxos(
|
||||
::grpc::CallbackServerContext* /*context*/, const ::tari::rpc::GetSideChainUtxosRequest* /*request*/) { return nullptr; }
|
||||
};
|
||||
typedef WithCallbackMethod_ListHeaders<WithCallbackMethod_GetHeaderByHash<WithCallbackMethod_GetBlocks<WithCallbackMethod_GetBlockTiming<WithCallbackMethod_GetConstants<WithCallbackMethod_GetBlockSize<WithCallbackMethod_GetBlockFees<WithCallbackMethod_GetVersion<WithCallbackMethod_CheckForUpdates<WithCallbackMethod_GetTokensInCirculation<WithCallbackMethod_GetNetworkDifficulty<WithCallbackMethod_GetNewBlockTemplate<WithCallbackMethod_GetNewBlock<WithCallbackMethod_GetNewBlockWithCoinbases<WithCallbackMethod_GetNewBlockTemplateWithCoinbases<WithCallbackMethod_GetNewBlockBlob<WithCallbackMethod_SubmitBlock<WithCallbackMethod_SubmitBlockBlob<WithCallbackMethod_SubmitTransaction<WithCallbackMethod_GetSyncInfo<WithCallbackMethod_GetSyncProgress<WithCallbackMethod_GetTipInfo<WithCallbackMethod_SearchKernels<WithCallbackMethod_SearchUtxos<WithCallbackMethod_FetchMatchingUtxos<WithCallbackMethod_GetPeers<WithCallbackMethod_GetMempoolTransactions<WithCallbackMethod_TransactionState<WithCallbackMethod_Identify<WithCallbackMethod_GetNetworkStatus<WithCallbackMethod_ListConnectedPeers<WithCallbackMethod_GetMempoolStats<WithCallbackMethod_GetActiveValidatorNodes<WithCallbackMethod_GetShardKey<WithCallbackMethod_GetTemplateRegistrations<WithCallbackMethod_GetSideChainUtxos<Service > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > CallbackService;
|
||||
template <class BaseClass>
|
||||
class WithCallbackMethod_GetNetworkState : public BaseClass {
|
||||
private:
|
||||
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
|
||||
public:
|
||||
WithCallbackMethod_GetNetworkState() {
|
||||
::grpc::Service::MarkMethodCallback(36,
|
||||
new ::grpc::internal::CallbackUnaryHandler< ::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse>(
|
||||
[this](
|
||||
::grpc::CallbackServerContext* context, const ::tari::rpc::GetNetworkStateRequest* request, ::tari::rpc::GetNetworkStateResponse* response) { return this->GetNetworkState(context, request, response); }));}
|
||||
void SetMessageAllocatorFor_GetNetworkState(
|
||||
::grpc::MessageAllocator< ::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse>* allocator) {
|
||||
::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(36);
|
||||
static_cast<::grpc::internal::CallbackUnaryHandler< ::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse>*>(handler)
|
||||
->SetMessageAllocator(allocator);
|
||||
}
|
||||
~WithCallbackMethod_GetNetworkState() override {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status GetNetworkState(::grpc::ServerContext* /*context*/, const ::tari::rpc::GetNetworkStateRequest* /*request*/, ::tari::rpc::GetNetworkStateResponse* /*response*/) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
virtual ::grpc::ServerUnaryReactor* GetNetworkState(
|
||||
::grpc::CallbackServerContext* /*context*/, const ::tari::rpc::GetNetworkStateRequest* /*request*/, ::tari::rpc::GetNetworkStateResponse* /*response*/) { return nullptr; }
|
||||
};
|
||||
typedef WithCallbackMethod_ListHeaders<WithCallbackMethod_GetHeaderByHash<WithCallbackMethod_GetBlocks<WithCallbackMethod_GetBlockTiming<WithCallbackMethod_GetConstants<WithCallbackMethod_GetBlockSize<WithCallbackMethod_GetBlockFees<WithCallbackMethod_GetVersion<WithCallbackMethod_CheckForUpdates<WithCallbackMethod_GetTokensInCirculation<WithCallbackMethod_GetNetworkDifficulty<WithCallbackMethod_GetNewBlockTemplate<WithCallbackMethod_GetNewBlock<WithCallbackMethod_GetNewBlockWithCoinbases<WithCallbackMethod_GetNewBlockTemplateWithCoinbases<WithCallbackMethod_GetNewBlockBlob<WithCallbackMethod_SubmitBlock<WithCallbackMethod_SubmitBlockBlob<WithCallbackMethod_SubmitTransaction<WithCallbackMethod_GetSyncInfo<WithCallbackMethod_GetSyncProgress<WithCallbackMethod_GetTipInfo<WithCallbackMethod_SearchKernels<WithCallbackMethod_SearchUtxos<WithCallbackMethod_FetchMatchingUtxos<WithCallbackMethod_GetPeers<WithCallbackMethod_GetMempoolTransactions<WithCallbackMethod_TransactionState<WithCallbackMethod_Identify<WithCallbackMethod_GetNetworkStatus<WithCallbackMethod_ListConnectedPeers<WithCallbackMethod_GetMempoolStats<WithCallbackMethod_GetActiveValidatorNodes<WithCallbackMethod_GetShardKey<WithCallbackMethod_GetTemplateRegistrations<WithCallbackMethod_GetSideChainUtxos<WithCallbackMethod_GetNetworkState<Service > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > CallbackService;
|
||||
typedef CallbackService ExperimentalCallbackService;
|
||||
template <class BaseClass>
|
||||
class WithGenericMethod_ListHeaders : public BaseClass {
|
||||
@@ -3349,6 +3420,23 @@ class BaseNode final {
|
||||
}
|
||||
};
|
||||
template <class BaseClass>
|
||||
class WithGenericMethod_GetNetworkState : public BaseClass {
|
||||
private:
|
||||
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
|
||||
public:
|
||||
WithGenericMethod_GetNetworkState() {
|
||||
::grpc::Service::MarkMethodGeneric(36);
|
||||
}
|
||||
~WithGenericMethod_GetNetworkState() override {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status GetNetworkState(::grpc::ServerContext* /*context*/, const ::tari::rpc::GetNetworkStateRequest* /*request*/, ::tari::rpc::GetNetworkStateResponse* /*response*/) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
};
|
||||
template <class BaseClass>
|
||||
class WithRawMethod_ListHeaders : public BaseClass {
|
||||
private:
|
||||
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
|
||||
@@ -4069,6 +4157,26 @@ class BaseNode final {
|
||||
}
|
||||
};
|
||||
template <class BaseClass>
|
||||
class WithRawMethod_GetNetworkState : public BaseClass {
|
||||
private:
|
||||
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
|
||||
public:
|
||||
WithRawMethod_GetNetworkState() {
|
||||
::grpc::Service::MarkMethodRaw(36);
|
||||
}
|
||||
~WithRawMethod_GetNetworkState() override {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status GetNetworkState(::grpc::ServerContext* /*context*/, const ::tari::rpc::GetNetworkStateRequest* /*request*/, ::tari::rpc::GetNetworkStateResponse* /*response*/) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
void RequestGetNetworkState(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
|
||||
::grpc::Service::RequestAsyncUnary(36, context, request, response, new_call_cq, notification_cq, tag);
|
||||
}
|
||||
};
|
||||
template <class BaseClass>
|
||||
class WithRawCallbackMethod_ListHeaders : public BaseClass {
|
||||
private:
|
||||
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
|
||||
@@ -4861,6 +4969,28 @@ class BaseNode final {
|
||||
::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/) { return nullptr; }
|
||||
};
|
||||
template <class BaseClass>
|
||||
class WithRawCallbackMethod_GetNetworkState : public BaseClass {
|
||||
private:
|
||||
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
|
||||
public:
|
||||
WithRawCallbackMethod_GetNetworkState() {
|
||||
::grpc::Service::MarkMethodRawCallback(36,
|
||||
new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>(
|
||||
[this](
|
||||
::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->GetNetworkState(context, request, response); }));
|
||||
}
|
||||
~WithRawCallbackMethod_GetNetworkState() override {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status GetNetworkState(::grpc::ServerContext* /*context*/, const ::tari::rpc::GetNetworkStateRequest* /*request*/, ::tari::rpc::GetNetworkStateResponse* /*response*/) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
virtual ::grpc::ServerUnaryReactor* GetNetworkState(
|
||||
::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; }
|
||||
};
|
||||
template <class BaseClass>
|
||||
class WithStreamedUnaryMethod_GetHeaderByHash : public BaseClass {
|
||||
private:
|
||||
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
|
||||
@@ -5508,7 +5638,34 @@ class BaseNode final {
|
||||
// replace default version of method with streamed unary
|
||||
virtual ::grpc::Status StreamedGetShardKey(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::tari::rpc::GetShardKeyRequest,::tari::rpc::GetShardKeyResponse>* server_unary_streamer) = 0;
|
||||
};
|
||||
typedef WithStreamedUnaryMethod_GetHeaderByHash<WithStreamedUnaryMethod_GetBlockTiming<WithStreamedUnaryMethod_GetConstants<WithStreamedUnaryMethod_GetBlockSize<WithStreamedUnaryMethod_GetBlockFees<WithStreamedUnaryMethod_GetVersion<WithStreamedUnaryMethod_CheckForUpdates<WithStreamedUnaryMethod_GetNewBlockTemplate<WithStreamedUnaryMethod_GetNewBlock<WithStreamedUnaryMethod_GetNewBlockWithCoinbases<WithStreamedUnaryMethod_GetNewBlockTemplateWithCoinbases<WithStreamedUnaryMethod_GetNewBlockBlob<WithStreamedUnaryMethod_SubmitBlock<WithStreamedUnaryMethod_SubmitBlockBlob<WithStreamedUnaryMethod_SubmitTransaction<WithStreamedUnaryMethod_GetSyncInfo<WithStreamedUnaryMethod_GetSyncProgress<WithStreamedUnaryMethod_GetTipInfo<WithStreamedUnaryMethod_TransactionState<WithStreamedUnaryMethod_Identify<WithStreamedUnaryMethod_GetNetworkStatus<WithStreamedUnaryMethod_ListConnectedPeers<WithStreamedUnaryMethod_GetMempoolStats<WithStreamedUnaryMethod_GetShardKey<Service > > > > > > > > > > > > > > > > > > > > > > > > StreamedUnaryService;
|
||||
template <class BaseClass>
|
||||
class WithStreamedUnaryMethod_GetNetworkState : public BaseClass {
|
||||
private:
|
||||
void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
|
||||
public:
|
||||
WithStreamedUnaryMethod_GetNetworkState() {
|
||||
::grpc::Service::MarkMethodStreamed(36,
|
||||
new ::grpc::internal::StreamedUnaryHandler<
|
||||
::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse>(
|
||||
[this](::grpc::ServerContext* context,
|
||||
::grpc::ServerUnaryStreamer<
|
||||
::tari::rpc::GetNetworkStateRequest, ::tari::rpc::GetNetworkStateResponse>* streamer) {
|
||||
return this->StreamedGetNetworkState(context,
|
||||
streamer);
|
||||
}));
|
||||
}
|
||||
~WithStreamedUnaryMethod_GetNetworkState() override {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable regular version of this method
|
||||
::grpc::Status GetNetworkState(::grpc::ServerContext* /*context*/, const ::tari::rpc::GetNetworkStateRequest* /*request*/, ::tari::rpc::GetNetworkStateResponse* /*response*/) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
// replace default version of method with streamed unary
|
||||
virtual ::grpc::Status StreamedGetNetworkState(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::tari::rpc::GetNetworkStateRequest,::tari::rpc::GetNetworkStateResponse>* server_unary_streamer) = 0;
|
||||
};
|
||||
typedef WithStreamedUnaryMethod_GetHeaderByHash<WithStreamedUnaryMethod_GetBlockTiming<WithStreamedUnaryMethod_GetConstants<WithStreamedUnaryMethod_GetBlockSize<WithStreamedUnaryMethod_GetBlockFees<WithStreamedUnaryMethod_GetVersion<WithStreamedUnaryMethod_CheckForUpdates<WithStreamedUnaryMethod_GetNewBlockTemplate<WithStreamedUnaryMethod_GetNewBlock<WithStreamedUnaryMethod_GetNewBlockWithCoinbases<WithStreamedUnaryMethod_GetNewBlockTemplateWithCoinbases<WithStreamedUnaryMethod_GetNewBlockBlob<WithStreamedUnaryMethod_SubmitBlock<WithStreamedUnaryMethod_SubmitBlockBlob<WithStreamedUnaryMethod_SubmitTransaction<WithStreamedUnaryMethod_GetSyncInfo<WithStreamedUnaryMethod_GetSyncProgress<WithStreamedUnaryMethod_GetTipInfo<WithStreamedUnaryMethod_TransactionState<WithStreamedUnaryMethod_Identify<WithStreamedUnaryMethod_GetNetworkStatus<WithStreamedUnaryMethod_ListConnectedPeers<WithStreamedUnaryMethod_GetMempoolStats<WithStreamedUnaryMethod_GetShardKey<WithStreamedUnaryMethod_GetNetworkState<Service > > > > > > > > > > > > > > > > > > > > > > > > > StreamedUnaryService;
|
||||
template <class BaseClass>
|
||||
class WithSplitStreamingMethod_ListHeaders : public BaseClass {
|
||||
private:
|
||||
@@ -5834,7 +5991,7 @@ class BaseNode final {
|
||||
virtual ::grpc::Status StreamedGetSideChainUtxos(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer< ::tari::rpc::GetSideChainUtxosRequest,::tari::rpc::GetSideChainUtxosResponse>* server_split_streamer) = 0;
|
||||
};
|
||||
typedef WithSplitStreamingMethod_ListHeaders<WithSplitStreamingMethod_GetBlocks<WithSplitStreamingMethod_GetTokensInCirculation<WithSplitStreamingMethod_GetNetworkDifficulty<WithSplitStreamingMethod_SearchKernels<WithSplitStreamingMethod_SearchUtxos<WithSplitStreamingMethod_FetchMatchingUtxos<WithSplitStreamingMethod_GetPeers<WithSplitStreamingMethod_GetMempoolTransactions<WithSplitStreamingMethod_GetActiveValidatorNodes<WithSplitStreamingMethod_GetTemplateRegistrations<WithSplitStreamingMethod_GetSideChainUtxos<Service > > > > > > > > > > > > SplitStreamedService;
|
||||
typedef WithSplitStreamingMethod_ListHeaders<WithStreamedUnaryMethod_GetHeaderByHash<WithSplitStreamingMethod_GetBlocks<WithStreamedUnaryMethod_GetBlockTiming<WithStreamedUnaryMethod_GetConstants<WithStreamedUnaryMethod_GetBlockSize<WithStreamedUnaryMethod_GetBlockFees<WithStreamedUnaryMethod_GetVersion<WithStreamedUnaryMethod_CheckForUpdates<WithSplitStreamingMethod_GetTokensInCirculation<WithSplitStreamingMethod_GetNetworkDifficulty<WithStreamedUnaryMethod_GetNewBlockTemplate<WithStreamedUnaryMethod_GetNewBlock<WithStreamedUnaryMethod_GetNewBlockWithCoinbases<WithStreamedUnaryMethod_GetNewBlockTemplateWithCoinbases<WithStreamedUnaryMethod_GetNewBlockBlob<WithStreamedUnaryMethod_SubmitBlock<WithStreamedUnaryMethod_SubmitBlockBlob<WithStreamedUnaryMethod_SubmitTransaction<WithStreamedUnaryMethod_GetSyncInfo<WithStreamedUnaryMethod_GetSyncProgress<WithStreamedUnaryMethod_GetTipInfo<WithSplitStreamingMethod_SearchKernels<WithSplitStreamingMethod_SearchUtxos<WithSplitStreamingMethod_FetchMatchingUtxos<WithSplitStreamingMethod_GetPeers<WithSplitStreamingMethod_GetMempoolTransactions<WithStreamedUnaryMethod_TransactionState<WithStreamedUnaryMethod_Identify<WithStreamedUnaryMethod_GetNetworkStatus<WithStreamedUnaryMethod_ListConnectedPeers<WithStreamedUnaryMethod_GetMempoolStats<WithSplitStreamingMethod_GetActiveValidatorNodes<WithStreamedUnaryMethod_GetShardKey<WithSplitStreamingMethod_GetTemplateRegistrations<WithSplitStreamingMethod_GetSideChainUtxos<Service > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > StreamedService;
|
||||
typedef WithSplitStreamingMethod_ListHeaders<WithStreamedUnaryMethod_GetHeaderByHash<WithSplitStreamingMethod_GetBlocks<WithStreamedUnaryMethod_GetBlockTiming<WithStreamedUnaryMethod_GetConstants<WithStreamedUnaryMethod_GetBlockSize<WithStreamedUnaryMethod_GetBlockFees<WithStreamedUnaryMethod_GetVersion<WithStreamedUnaryMethod_CheckForUpdates<WithSplitStreamingMethod_GetTokensInCirculation<WithSplitStreamingMethod_GetNetworkDifficulty<WithStreamedUnaryMethod_GetNewBlockTemplate<WithStreamedUnaryMethod_GetNewBlock<WithStreamedUnaryMethod_GetNewBlockWithCoinbases<WithStreamedUnaryMethod_GetNewBlockTemplateWithCoinbases<WithStreamedUnaryMethod_GetNewBlockBlob<WithStreamedUnaryMethod_SubmitBlock<WithStreamedUnaryMethod_SubmitBlockBlob<WithStreamedUnaryMethod_SubmitTransaction<WithStreamedUnaryMethod_GetSyncInfo<WithStreamedUnaryMethod_GetSyncProgress<WithStreamedUnaryMethod_GetTipInfo<WithSplitStreamingMethod_SearchKernels<WithSplitStreamingMethod_SearchUtxos<WithSplitStreamingMethod_FetchMatchingUtxos<WithSplitStreamingMethod_GetPeers<WithSplitStreamingMethod_GetMempoolTransactions<WithStreamedUnaryMethod_TransactionState<WithStreamedUnaryMethod_Identify<WithStreamedUnaryMethod_GetNetworkStatus<WithStreamedUnaryMethod_ListConnectedPeers<WithStreamedUnaryMethod_GetMempoolStats<WithSplitStreamingMethod_GetActiveValidatorNodes<WithStreamedUnaryMethod_GetShardKey<WithSplitStreamingMethod_GetTemplateRegistrations<WithSplitStreamingMethod_GetSideChainUtxos<WithStreamedUnaryMethod_GetNetworkState<Service > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > StreamedService;
|
||||
};
|
||||
|
||||
} // namespace rpc
|
||||
|
||||
+983
-297
File diff suppressed because it is too large
Load Diff
+990
-39
File diff suppressed because it is too large
Load Diff
+29
-2
@@ -99,6 +99,7 @@ service BaseNode {
|
||||
// Get templates
|
||||
rpc GetTemplateRegistrations(GetTemplateRegistrationsRequest) returns (stream GetTemplateRegistrationResponse);
|
||||
rpc GetSideChainUtxos(GetSideChainUtxosRequest) returns (stream GetSideChainUtxosResponse);
|
||||
rpc GetNetworkState(GetNetworkStateRequest) returns (GetNetworkStateResponse);
|
||||
}
|
||||
|
||||
message GetAssetMetadataRequest {
|
||||
@@ -160,6 +161,7 @@ message TipInfoResponse {
|
||||
MetaData metadata = 1;
|
||||
bool initial_sync_achieved = 2;
|
||||
BaseNodeState base_node_state = 3;
|
||||
bool failed_checkpoints = 4;
|
||||
}
|
||||
|
||||
enum BaseNodeState{
|
||||
@@ -217,6 +219,8 @@ message NetworkDifficultyResponse {
|
||||
uint64 pow_algo = 5;
|
||||
uint64 sha3x_estimated_hash_rate = 6;
|
||||
uint64 randomx_estimated_hash_rate = 7;
|
||||
uint64 num_coinbases = 8;
|
||||
repeated bytes coinbase_extras = 9;
|
||||
}
|
||||
|
||||
// A generic single value response for a specific height
|
||||
@@ -339,10 +343,11 @@ message MetaData {
|
||||
uint64 best_block_height = 1;
|
||||
// The block hash of the current tip of the longest valid chain, or `None` for an empty chain
|
||||
bytes best_block_hash = 2;
|
||||
// This is the min height this node can provide complete blocks for. A 0 here means this node is archival and can provide complete blocks for every height.
|
||||
uint64 pruned_height = 6;
|
||||
// The current geometric mean of the pow of the chain tip, or `None` if there is no chain
|
||||
bytes accumulated_difficulty = 5;
|
||||
// This is the min height this node can provide complete blocks for. A 0 here means this node is archival and can provide complete blocks for every height.
|
||||
uint64 pruned_height = 6;
|
||||
uint64 timestamp = 7;
|
||||
}
|
||||
|
||||
message SyncInfoResponse {
|
||||
@@ -355,6 +360,8 @@ message SyncProgressResponse {
|
||||
uint64 tip_height = 1;
|
||||
uint64 local_height = 2;
|
||||
SyncState state = 3;
|
||||
string short_desc = 4;
|
||||
uint64 initial_connected_peers = 5;
|
||||
}
|
||||
|
||||
enum SyncState {
|
||||
@@ -515,3 +522,23 @@ message GetSideChainUtxosResponse {
|
||||
repeated TransactionOutput outputs = 2;
|
||||
}
|
||||
|
||||
message GetNetworkStateRequest {
|
||||
}
|
||||
|
||||
message GetNetworkStateResponse {
|
||||
// metadata
|
||||
MetaData metadata = 1;
|
||||
// has the base node synced
|
||||
bool initial_sync_achieved = 2;
|
||||
//current state of the base node
|
||||
BaseNodeState base_node_state = 3;
|
||||
// do we have failed checkpoints
|
||||
bool failed_checkpoints = 4;
|
||||
// The block reward of the next tip
|
||||
uint64 reward = 5;
|
||||
// estimate sha3x hash rate
|
||||
uint64 sha3x_estimated_hash_rate = 6;
|
||||
// estimate randomx hash rate
|
||||
uint64 randomx_estimated_hash_rate = 7;
|
||||
}
|
||||
|
||||
|
||||
+106
-47
@@ -107,6 +107,9 @@ inline constexpr BlockHeader::Impl_::Impl_(
|
||||
output_mr_(
|
||||
&::google::protobuf::internal::fixed_address_empty_string,
|
||||
::_pbi::ConstantInitialized()),
|
||||
block_output_mr_(
|
||||
&::google::protobuf::internal::fixed_address_empty_string,
|
||||
::_pbi::ConstantInitialized()),
|
||||
kernel_mr_(
|
||||
&::google::protobuf::internal::fixed_address_empty_string,
|
||||
::_pbi::ConstantInitialized()),
|
||||
@@ -149,7 +152,8 @@ inline constexpr NewBlockTemplate::Impl_::Impl_(
|
||||
::_pbi::ConstantInitialized) noexcept
|
||||
: _cached_size_{0},
|
||||
header_{nullptr},
|
||||
body_{nullptr} {}
|
||||
body_{nullptr},
|
||||
is_mempool_in_sync_{false} {}
|
||||
|
||||
template <typename>
|
||||
PROTOBUF_CONSTEXPR NewBlockTemplate::NewBlockTemplate(::_pbi::ConstantInitialized)
|
||||
@@ -227,6 +231,7 @@ const ::uint32_t
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::BlockHeader, _impl_.prev_hash_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::BlockHeader, _impl_.timestamp_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::BlockHeader, _impl_.output_mr_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::BlockHeader, _impl_.block_output_mr_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::BlockHeader, _impl_.kernel_mr_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::BlockHeader, _impl_.input_mr_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::BlockHeader, _impl_.total_kernel_offset_),
|
||||
@@ -247,6 +252,7 @@ const ::uint32_t
|
||||
~0u,
|
||||
~0u,
|
||||
~0u,
|
||||
~0u,
|
||||
0,
|
||||
~0u,
|
||||
~0u,
|
||||
@@ -326,19 +332,21 @@ const ::uint32_t
|
||||
~0u, // no sizeof(Split)
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::NewBlockTemplate, _impl_.header_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::NewBlockTemplate, _impl_.body_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::NewBlockTemplate, _impl_.is_mempool_in_sync_),
|
||||
0,
|
||||
1,
|
||||
~0u,
|
||||
};
|
||||
|
||||
static const ::_pbi::MigrationSchema
|
||||
schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
|
||||
{0, 24, -1, sizeof(::tari::rpc::BlockHeader)},
|
||||
{40, -1, -1, sizeof(::tari::rpc::ProofOfWork)},
|
||||
{50, -1, -1, sizeof(::tari::rpc::PowAlgo)},
|
||||
{59, 69, -1, sizeof(::tari::rpc::Block)},
|
||||
{71, 81, -1, sizeof(::tari::rpc::HistoricalBlock)},
|
||||
{83, 97, -1, sizeof(::tari::rpc::NewBlockHeaderTemplate)},
|
||||
{103, 113, -1, sizeof(::tari::rpc::NewBlockTemplate)},
|
||||
{0, 25, -1, sizeof(::tari::rpc::BlockHeader)},
|
||||
{42, -1, -1, sizeof(::tari::rpc::ProofOfWork)},
|
||||
{52, -1, -1, sizeof(::tari::rpc::PowAlgo)},
|
||||
{61, 71, -1, sizeof(::tari::rpc::Block)},
|
||||
{73, 83, -1, sizeof(::tari::rpc::HistoricalBlock)},
|
||||
{85, 99, -1, sizeof(::tari::rpc::NewBlockHeaderTemplate)},
|
||||
{105, 116, -1, sizeof(::tari::rpc::NewBlockTemplate)},
|
||||
};
|
||||
static const ::_pb::Message* const file_default_instances[] = {
|
||||
&::tari::rpc::_BlockHeader_default_instance_._instance,
|
||||
@@ -352,31 +360,33 @@ static const ::_pb::Message* const file_default_instances[] = {
|
||||
const char descriptor_table_protodef_block_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
|
||||
protodesc_cold) = {
|
||||
"\n\013block.proto\022\010tari.rpc\032\021transaction.pro"
|
||||
"to\"\361\002\n\013BlockHeader\022\014\n\004hash\030\001 \001(\014\022\017\n\007vers"
|
||||
"to\"\212\003\n\013BlockHeader\022\014\n\004hash\030\001 \001(\014\022\017\n\007vers"
|
||||
"ion\030\002 \001(\r\022\016\n\006height\030\003 \001(\004\022\021\n\tprev_hash\030\004"
|
||||
" \001(\014\022\021\n\ttimestamp\030\005 \001(\004\022\021\n\toutput_mr\030\006 \001"
|
||||
"(\014\022\021\n\tkernel_mr\030\010 \001(\014\022\020\n\010input_mr\030\t \001(\014\022"
|
||||
"\033\n\023total_kernel_offset\030\n \001(\014\022\r\n\005nonce\030\013 "
|
||||
"\001(\004\022\"\n\003pow\030\014 \001(\0132\025.tari.rpc.ProofOfWork\022"
|
||||
"\027\n\017kernel_mmr_size\030\r \001(\004\022\027\n\017output_mmr_s"
|
||||
"ize\030\016 \001(\004\022\033\n\023total_script_offset\030\017 \001(\014\022\031"
|
||||
"\n\021validator_node_mr\030\020 \001(\014\022\033\n\023validator_n"
|
||||
"ode_size\030\021 \001(\004\"1\n\013ProofOfWork\022\020\n\010pow_alg"
|
||||
"o\030\001 \001(\004\022\020\n\010pow_data\030\004 \001(\014\"o\n\007PowAlgo\022,\n\010"
|
||||
"pow_algo\030\001 \001(\0162\032.tari.rpc.PowAlgo.PowAlg"
|
||||
"os\"6\n\010PowAlgos\022\025\n\021POW_ALGOS_RANDOMX\020\000\022\023\n"
|
||||
"\017POW_ALGOS_SHA3X\020\001\"U\n\005Block\022%\n\006header\030\001 "
|
||||
"\001(\0132\025.tari.rpc.BlockHeader\022%\n\004body\030\002 \001(\013"
|
||||
"2\027.tari.rpc.AggregateBody\"H\n\017HistoricalB"
|
||||
"lock\022\025\n\rconfirmations\030\001 \001(\004\022\036\n\005block\030\002 \001"
|
||||
"(\0132\017.tari.rpc.Block\"\252\001\n\026NewBlockHeaderTe"
|
||||
"mplate\022\017\n\007version\030\001 \001(\r\022\016\n\006height\030\002 \001(\004\022"
|
||||
"\021\n\tprev_hash\030\003 \001(\014\022\033\n\023total_kernel_offse"
|
||||
"t\030\004 \001(\014\022\"\n\003pow\030\005 \001(\0132\025.tari.rpc.ProofOfW"
|
||||
"ork\022\033\n\023total_script_offset\030\007 \001(\014\"k\n\020NewB"
|
||||
"lockTemplate\0220\n\006header\030\001 \001(\0132 .tari.rpc."
|
||||
"NewBlockHeaderTemplate\022%\n\004body\030\002 \001(\0132\027.t"
|
||||
"ari.rpc.AggregateBodyb\006proto3"
|
||||
"(\014\022\027\n\017block_output_mr\030\007 \001(\014\022\021\n\tkernel_mr"
|
||||
"\030\010 \001(\014\022\020\n\010input_mr\030\t \001(\014\022\033\n\023total_kernel"
|
||||
"_offset\030\n \001(\014\022\r\n\005nonce\030\013 \001(\004\022\"\n\003pow\030\014 \001("
|
||||
"\0132\025.tari.rpc.ProofOfWork\022\027\n\017kernel_mmr_s"
|
||||
"ize\030\r \001(\004\022\027\n\017output_mmr_size\030\016 \001(\004\022\033\n\023to"
|
||||
"tal_script_offset\030\017 \001(\014\022\031\n\021validator_nod"
|
||||
"e_mr\030\020 \001(\014\022\033\n\023validator_node_size\030\021 \001(\004\""
|
||||
"1\n\013ProofOfWork\022\020\n\010pow_algo\030\001 \001(\004\022\020\n\010pow_"
|
||||
"data\030\004 \001(\014\"o\n\007PowAlgo\022,\n\010pow_algo\030\001 \001(\0162"
|
||||
"\032.tari.rpc.PowAlgo.PowAlgos\"6\n\010PowAlgos\022"
|
||||
"\025\n\021POW_ALGOS_RANDOMX\020\000\022\023\n\017POW_ALGOS_SHA3"
|
||||
"X\020\001\"U\n\005Block\022%\n\006header\030\001 \001(\0132\025.tari.rpc."
|
||||
"BlockHeader\022%\n\004body\030\002 \001(\0132\027.tari.rpc.Agg"
|
||||
"regateBody\"H\n\017HistoricalBlock\022\025\n\rconfirm"
|
||||
"ations\030\001 \001(\004\022\036\n\005block\030\002 \001(\0132\017.tari.rpc.B"
|
||||
"lock\"\252\001\n\026NewBlockHeaderTemplate\022\017\n\007versi"
|
||||
"on\030\001 \001(\r\022\016\n\006height\030\002 \001(\004\022\021\n\tprev_hash\030\003 "
|
||||
"\001(\014\022\033\n\023total_kernel_offset\030\004 \001(\014\022\"\n\003pow\030"
|
||||
"\005 \001(\0132\025.tari.rpc.ProofOfWork\022\033\n\023total_sc"
|
||||
"ript_offset\030\007 \001(\014\"\207\001\n\020NewBlockTemplate\0220"
|
||||
"\n\006header\030\001 \001(\0132 .tari.rpc.NewBlockHeader"
|
||||
"Template\022%\n\004body\030\002 \001(\0132\027.tari.rpc.Aggreg"
|
||||
"ateBody\022\032\n\022is_mempool_in_sync\030\003 \001(\010b\006pro"
|
||||
"to3"
|
||||
};
|
||||
static const ::_pbi::DescriptorTable* const descriptor_table_block_2eproto_deps[1] =
|
||||
{
|
||||
@@ -386,7 +396,7 @@ static ::absl::once_flag descriptor_table_block_2eproto_once;
|
||||
const ::_pbi::DescriptorTable descriptor_table_block_2eproto = {
|
||||
false,
|
||||
false,
|
||||
1029,
|
||||
1083,
|
||||
descriptor_table_protodef_block_2eproto,
|
||||
"block.proto",
|
||||
&descriptor_table_block_2eproto_once,
|
||||
@@ -459,6 +469,7 @@ inline PROTOBUF_NDEBUG_INLINE BlockHeader::Impl_::Impl_(
|
||||
hash_(arena, from.hash_),
|
||||
prev_hash_(arena, from.prev_hash_),
|
||||
output_mr_(arena, from.output_mr_),
|
||||
block_output_mr_(arena, from.block_output_mr_),
|
||||
kernel_mr_(arena, from.kernel_mr_),
|
||||
input_mr_(arena, from.input_mr_),
|
||||
total_kernel_offset_(arena, from.total_kernel_offset_),
|
||||
@@ -495,6 +506,7 @@ inline PROTOBUF_NDEBUG_INLINE BlockHeader::Impl_::Impl_(
|
||||
hash_(arena),
|
||||
prev_hash_(arena),
|
||||
output_mr_(arena),
|
||||
block_output_mr_(arena),
|
||||
kernel_mr_(arena),
|
||||
input_mr_(arena),
|
||||
total_kernel_offset_(arena),
|
||||
@@ -520,6 +532,7 @@ inline void BlockHeader::SharedDtor() {
|
||||
_impl_.hash_.Destroy();
|
||||
_impl_.prev_hash_.Destroy();
|
||||
_impl_.output_mr_.Destroy();
|
||||
_impl_.block_output_mr_.Destroy();
|
||||
_impl_.kernel_mr_.Destroy();
|
||||
_impl_.input_mr_.Destroy();
|
||||
_impl_.total_kernel_offset_.Destroy();
|
||||
@@ -553,6 +566,7 @@ PROTOBUF_NOINLINE void BlockHeader::Clear() {
|
||||
_impl_.hash_.ClearToEmpty();
|
||||
_impl_.prev_hash_.ClearToEmpty();
|
||||
_impl_.output_mr_.ClearToEmpty();
|
||||
_impl_.block_output_mr_.ClearToEmpty();
|
||||
_impl_.kernel_mr_.ClearToEmpty();
|
||||
_impl_.input_mr_.ClearToEmpty();
|
||||
_impl_.total_kernel_offset_.ClearToEmpty();
|
||||
@@ -578,15 +592,15 @@ const char* BlockHeader::_InternalParse(
|
||||
|
||||
|
||||
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
|
||||
const ::_pbi::TcParseTable<5, 16, 1, 0, 2> BlockHeader::_table_ = {
|
||||
const ::_pbi::TcParseTable<5, 17, 1, 0, 2> BlockHeader::_table_ = {
|
||||
{
|
||||
PROTOBUF_FIELD_OFFSET(BlockHeader, _impl_._has_bits_),
|
||||
0, // no _extensions_
|
||||
17, 248, // max_field_number, fast_idx_mask
|
||||
offsetof(decltype(_table_), field_lookup_table),
|
||||
4294836288, // skipmap
|
||||
4294836224, // skipmap
|
||||
offsetof(decltype(_table_), field_entries),
|
||||
16, // num_field_entries
|
||||
17, // num_field_entries
|
||||
1, // num_aux_entries
|
||||
offsetof(decltype(_table_), aux_entries),
|
||||
&_BlockHeader_default_instance_._instance,
|
||||
@@ -614,7 +628,9 @@ const ::_pbi::TcParseTable<5, 16, 1, 0, 2> BlockHeader::_table_ = {
|
||||
// bytes output_mr = 6;
|
||||
{::_pbi::TcParser::FastBS1,
|
||||
{50, 63, 0, PROTOBUF_FIELD_OFFSET(BlockHeader, _impl_.output_mr_)}},
|
||||
{::_pbi::TcParser::MiniParse, {}},
|
||||
// bytes block_output_mr = 7;
|
||||
{::_pbi::TcParser::FastBS1,
|
||||
{58, 63, 0, PROTOBUF_FIELD_OFFSET(BlockHeader, _impl_.block_output_mr_)}},
|
||||
// bytes kernel_mr = 8;
|
||||
{::_pbi::TcParser::FastBS1,
|
||||
{66, 63, 0, PROTOBUF_FIELD_OFFSET(BlockHeader, _impl_.kernel_mr_)}},
|
||||
@@ -680,6 +696,9 @@ const ::_pbi::TcParseTable<5, 16, 1, 0, 2> BlockHeader::_table_ = {
|
||||
// bytes output_mr = 6;
|
||||
{PROTOBUF_FIELD_OFFSET(BlockHeader, _impl_.output_mr_), -1, 0,
|
||||
(0 | ::_fl::kFcSingular | ::_fl::kBytes | ::_fl::kRepAString)},
|
||||
// bytes block_output_mr = 7;
|
||||
{PROTOBUF_FIELD_OFFSET(BlockHeader, _impl_.block_output_mr_), -1, 0,
|
||||
(0 | ::_fl::kFcSingular | ::_fl::kBytes | ::_fl::kRepAString)},
|
||||
// bytes kernel_mr = 8;
|
||||
{PROTOBUF_FIELD_OFFSET(BlockHeader, _impl_.kernel_mr_), -1, 0,
|
||||
(0 | ::_fl::kFcSingular | ::_fl::kBytes | ::_fl::kRepAString)},
|
||||
@@ -762,6 +781,12 @@ const ::_pbi::TcParseTable<5, 16, 1, 0, 2> BlockHeader::_table_ = {
|
||||
target = stream->WriteBytesMaybeAliased(6, _s, target);
|
||||
}
|
||||
|
||||
// bytes block_output_mr = 7;
|
||||
if (!this->_internal_block_output_mr().empty()) {
|
||||
const std::string& _s = this->_internal_block_output_mr();
|
||||
target = stream->WriteBytesMaybeAliased(7, _s, target);
|
||||
}
|
||||
|
||||
// bytes kernel_mr = 8;
|
||||
if (!this->_internal_kernel_mr().empty()) {
|
||||
const std::string& _s = this->_internal_kernel_mr();
|
||||
@@ -862,6 +887,12 @@ const ::_pbi::TcParseTable<5, 16, 1, 0, 2> BlockHeader::_table_ = {
|
||||
this->_internal_output_mr());
|
||||
}
|
||||
|
||||
// bytes block_output_mr = 7;
|
||||
if (!this->_internal_block_output_mr().empty()) {
|
||||
total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize(
|
||||
this->_internal_block_output_mr());
|
||||
}
|
||||
|
||||
// bytes kernel_mr = 8;
|
||||
if (!this->_internal_kernel_mr().empty()) {
|
||||
total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize(
|
||||
@@ -963,6 +994,9 @@ void BlockHeader::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goo
|
||||
if (!from._internal_output_mr().empty()) {
|
||||
_this->_internal_set_output_mr(from._internal_output_mr());
|
||||
}
|
||||
if (!from._internal_block_output_mr().empty()) {
|
||||
_this->_internal_set_block_output_mr(from._internal_block_output_mr());
|
||||
}
|
||||
if (!from._internal_kernel_mr().empty()) {
|
||||
_this->_internal_set_kernel_mr(from._internal_kernel_mr());
|
||||
}
|
||||
@@ -1033,6 +1067,7 @@ void BlockHeader::InternalSwap(BlockHeader* PROTOBUF_RESTRICT other) {
|
||||
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.hash_, &other->_impl_.hash_, arena);
|
||||
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.prev_hash_, &other->_impl_.prev_hash_, arena);
|
||||
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.output_mr_, &other->_impl_.output_mr_, arena);
|
||||
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.block_output_mr_, &other->_impl_.block_output_mr_, arena);
|
||||
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.kernel_mr_, &other->_impl_.kernel_mr_, arena);
|
||||
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.input_mr_, &other->_impl_.input_mr_, arena);
|
||||
::_pbi::ArenaStringPtr::InternalSwap(&_impl_.total_kernel_offset_, &other->_impl_.total_kernel_offset_, arena);
|
||||
@@ -2366,6 +2401,7 @@ NewBlockTemplate::NewBlockTemplate(
|
||||
_impl_.body_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::tari::rpc::AggregateBody>(
|
||||
arena, *from._impl_.body_)
|
||||
: nullptr;
|
||||
_impl_.is_mempool_in_sync_ = from._impl_.is_mempool_in_sync_;
|
||||
|
||||
// @@protoc_insertion_point(copy_constructor:tari.rpc.NewBlockTemplate)
|
||||
}
|
||||
@@ -2379,9 +2415,9 @@ inline void NewBlockTemplate::SharedCtor(::_pb::Arena* arena) {
|
||||
::memset(reinterpret_cast<char *>(&_impl_) +
|
||||
offsetof(Impl_, header_),
|
||||
0,
|
||||
offsetof(Impl_, body_) -
|
||||
offsetof(Impl_, is_mempool_in_sync_) -
|
||||
offsetof(Impl_, header_) +
|
||||
sizeof(Impl_::body_));
|
||||
sizeof(Impl_::is_mempool_in_sync_));
|
||||
}
|
||||
NewBlockTemplate::~NewBlockTemplate() {
|
||||
// @@protoc_insertion_point(destructor:tari.rpc.NewBlockTemplate)
|
||||
@@ -2427,6 +2463,7 @@ PROTOBUF_NOINLINE void NewBlockTemplate::Clear() {
|
||||
_impl_.body_->Clear();
|
||||
}
|
||||
}
|
||||
_impl_.is_mempool_in_sync_ = false;
|
||||
_impl_._has_bits_.Clear();
|
||||
_internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>();
|
||||
}
|
||||
@@ -2439,15 +2476,15 @@ const char* NewBlockTemplate::_InternalParse(
|
||||
|
||||
|
||||
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
|
||||
const ::_pbi::TcParseTable<1, 2, 2, 0, 2> NewBlockTemplate::_table_ = {
|
||||
const ::_pbi::TcParseTable<2, 3, 2, 0, 2> NewBlockTemplate::_table_ = {
|
||||
{
|
||||
PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_._has_bits_),
|
||||
0, // no _extensions_
|
||||
2, 8, // max_field_number, fast_idx_mask
|
||||
3, 24, // max_field_number, fast_idx_mask
|
||||
offsetof(decltype(_table_), field_lookup_table),
|
||||
4294967292, // skipmap
|
||||
4294967288, // skipmap
|
||||
offsetof(decltype(_table_), field_entries),
|
||||
2, // num_field_entries
|
||||
3, // num_field_entries
|
||||
2, // num_aux_entries
|
||||
offsetof(decltype(_table_), aux_entries),
|
||||
&_NewBlockTemplate_default_instance_._instance,
|
||||
@@ -2456,12 +2493,16 @@ const ::_pbi::TcParseTable<1, 2, 2, 0, 2> NewBlockTemplate::_table_ = {
|
||||
::_pbi::TcParser::GetTable<::tari::rpc::NewBlockTemplate>(), // to_prefetch
|
||||
#endif // PROTOBUF_PREFETCH_PARSE_TABLE
|
||||
}, {{
|
||||
// .tari.rpc.AggregateBody body = 2;
|
||||
{::_pbi::TcParser::FastMtS1,
|
||||
{18, 1, 1, PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.body_)}},
|
||||
{::_pbi::TcParser::MiniParse, {}},
|
||||
// .tari.rpc.NewBlockHeaderTemplate header = 1;
|
||||
{::_pbi::TcParser::FastMtS1,
|
||||
{10, 0, 0, PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.header_)}},
|
||||
// .tari.rpc.AggregateBody body = 2;
|
||||
{::_pbi::TcParser::FastMtS1,
|
||||
{18, 1, 1, PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.body_)}},
|
||||
// bool is_mempool_in_sync = 3;
|
||||
{::_pbi::TcParser::SingularVarintNoZag1<bool, offsetof(NewBlockTemplate, _impl_.is_mempool_in_sync_), 63>(),
|
||||
{24, 63, 0, PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.is_mempool_in_sync_)}},
|
||||
}}, {{
|
||||
65535, 65535
|
||||
}}, {{
|
||||
@@ -2471,6 +2512,9 @@ const ::_pbi::TcParseTable<1, 2, 2, 0, 2> NewBlockTemplate::_table_ = {
|
||||
// .tari.rpc.AggregateBody body = 2;
|
||||
{PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.body_), _Internal::kHasBitsOffset + 1, 1,
|
||||
(0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)},
|
||||
// bool is_mempool_in_sync = 3;
|
||||
{PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.is_mempool_in_sync_), -1, 0,
|
||||
(0 | ::_fl::kFcSingular | ::_fl::kBool)},
|
||||
}}, {{
|
||||
{::_pbi::TcParser::GetTable<::tari::rpc::NewBlockHeaderTemplate>()},
|
||||
{::_pbi::TcParser::GetTable<::tari::rpc::AggregateBody>()},
|
||||
@@ -2498,6 +2542,13 @@ const ::_pbi::TcParseTable<1, 2, 2, 0, 2> NewBlockTemplate::_table_ = {
|
||||
2, *_impl_.body_, _impl_.body_->GetCachedSize(), target, stream);
|
||||
}
|
||||
|
||||
// bool is_mempool_in_sync = 3;
|
||||
if (this->_internal_is_mempool_in_sync() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::_pbi::WireFormatLite::WriteBoolToArray(
|
||||
3, this->_internal_is_mempool_in_sync(), target);
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target =
|
||||
::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
@@ -2530,6 +2581,11 @@ const ::_pbi::TcParseTable<1, 2, 2, 0, 2> NewBlockTemplate::_table_ = {
|
||||
}
|
||||
|
||||
}
|
||||
// bool is_mempool_in_sync = 3;
|
||||
if (this->_internal_is_mempool_in_sync() != 0) {
|
||||
total_size += 2;
|
||||
}
|
||||
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
|
||||
}
|
||||
|
||||
@@ -2564,6 +2620,9 @@ void NewBlockTemplate::MergeImpl(::google::protobuf::MessageLite& to_msg, const
|
||||
}
|
||||
}
|
||||
}
|
||||
if (from._internal_is_mempool_in_sync() != 0) {
|
||||
_this->_impl_.is_mempool_in_sync_ = from._impl_.is_mempool_in_sync_;
|
||||
}
|
||||
_this->_impl_._has_bits_[0] |= cached_has_bits;
|
||||
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
@@ -2584,8 +2643,8 @@ void NewBlockTemplate::InternalSwap(NewBlockTemplate* PROTOBUF_RESTRICT other) {
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
|
||||
::google::protobuf::internal::memswap<
|
||||
PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.body_)
|
||||
+ sizeof(NewBlockTemplate::_impl_.body_)
|
||||
PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.is_mempool_in_sync_)
|
||||
+ sizeof(NewBlockTemplate::_impl_.is_mempool_in_sync_)
|
||||
- PROTOBUF_FIELD_OFFSET(NewBlockTemplate, _impl_.header_)>(
|
||||
reinterpret_cast<char*>(&_impl_.header_),
|
||||
reinterpret_cast<char*>(&other->_impl_.header_));
|
||||
|
||||
+104
-2
@@ -872,6 +872,7 @@ class BlockHeader final : public ::google::protobuf::Message
|
||||
kHashFieldNumber = 1,
|
||||
kPrevHashFieldNumber = 4,
|
||||
kOutputMrFieldNumber = 6,
|
||||
kBlockOutputMrFieldNumber = 7,
|
||||
kKernelMrFieldNumber = 8,
|
||||
kInputMrFieldNumber = 9,
|
||||
kTotalKernelOffsetFieldNumber = 10,
|
||||
@@ -933,6 +934,22 @@ class BlockHeader final : public ::google::protobuf::Message
|
||||
const std::string& value);
|
||||
std::string* _internal_mutable_output_mr();
|
||||
|
||||
public:
|
||||
// bytes block_output_mr = 7;
|
||||
void clear_block_output_mr() ;
|
||||
const std::string& block_output_mr() const;
|
||||
template <typename Arg_ = const std::string&, typename... Args_>
|
||||
void set_block_output_mr(Arg_&& arg, Args_... args);
|
||||
std::string* mutable_block_output_mr();
|
||||
PROTOBUF_NODISCARD std::string* release_block_output_mr();
|
||||
void set_allocated_block_output_mr(std::string* value);
|
||||
|
||||
private:
|
||||
const std::string& _internal_block_output_mr() const;
|
||||
inline PROTOBUF_ALWAYS_INLINE void _internal_set_block_output_mr(
|
||||
const std::string& value);
|
||||
std::string* _internal_mutable_block_output_mr();
|
||||
|
||||
public:
|
||||
// bytes kernel_mr = 8;
|
||||
void clear_kernel_mr() ;
|
||||
@@ -1104,7 +1121,7 @@ class BlockHeader final : public ::google::protobuf::Message
|
||||
class _Internal;
|
||||
friend class ::google::protobuf::internal::TcParser;
|
||||
static const ::google::protobuf::internal::TcParseTable<
|
||||
5, 16, 1,
|
||||
5, 17, 1,
|
||||
0, 2>
|
||||
_table_;
|
||||
friend class ::google::protobuf::MessageLite;
|
||||
@@ -1125,6 +1142,7 @@ class BlockHeader final : public ::google::protobuf::Message
|
||||
::google::protobuf::internal::ArenaStringPtr hash_;
|
||||
::google::protobuf::internal::ArenaStringPtr prev_hash_;
|
||||
::google::protobuf::internal::ArenaStringPtr output_mr_;
|
||||
::google::protobuf::internal::ArenaStringPtr block_output_mr_;
|
||||
::google::protobuf::internal::ArenaStringPtr kernel_mr_;
|
||||
::google::protobuf::internal::ArenaStringPtr input_mr_;
|
||||
::google::protobuf::internal::ArenaStringPtr total_kernel_offset_;
|
||||
@@ -1272,6 +1290,7 @@ class NewBlockTemplate final : public ::google::protobuf::Message
|
||||
enum : int {
|
||||
kHeaderFieldNumber = 1,
|
||||
kBodyFieldNumber = 2,
|
||||
kIsMempoolInSyncFieldNumber = 3,
|
||||
};
|
||||
// .tari.rpc.NewBlockHeaderTemplate header = 1;
|
||||
bool has_header() const;
|
||||
@@ -1302,13 +1321,23 @@ class NewBlockTemplate final : public ::google::protobuf::Message
|
||||
const ::tari::rpc::AggregateBody& _internal_body() const;
|
||||
::tari::rpc::AggregateBody* _internal_mutable_body();
|
||||
|
||||
public:
|
||||
// bool is_mempool_in_sync = 3;
|
||||
void clear_is_mempool_in_sync() ;
|
||||
bool is_mempool_in_sync() const;
|
||||
void set_is_mempool_in_sync(bool value);
|
||||
|
||||
private:
|
||||
bool _internal_is_mempool_in_sync() const;
|
||||
void _internal_set_is_mempool_in_sync(bool value);
|
||||
|
||||
public:
|
||||
// @@protoc_insertion_point(class_scope:tari.rpc.NewBlockTemplate)
|
||||
private:
|
||||
class _Internal;
|
||||
friend class ::google::protobuf::internal::TcParser;
|
||||
static const ::google::protobuf::internal::TcParseTable<
|
||||
1, 2, 2,
|
||||
2, 3, 2,
|
||||
0, 2>
|
||||
_table_;
|
||||
friend class ::google::protobuf::MessageLite;
|
||||
@@ -1328,6 +1357,7 @@ class NewBlockTemplate final : public ::google::protobuf::Message
|
||||
mutable ::google::protobuf::internal::CachedSize _cached_size_;
|
||||
::tari::rpc::NewBlockHeaderTemplate* header_;
|
||||
::tari::rpc::AggregateBody* body_;
|
||||
bool is_mempool_in_sync_;
|
||||
PROTOBUF_TSAN_DECLARE_MEMBER
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
@@ -1941,6 +1971,56 @@ inline void BlockHeader::set_allocated_output_mr(std::string* value) {
|
||||
// @@protoc_insertion_point(field_set_allocated:tari.rpc.BlockHeader.output_mr)
|
||||
}
|
||||
|
||||
// bytes block_output_mr = 7;
|
||||
inline void BlockHeader::clear_block_output_mr() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
_impl_.block_output_mr_.ClearToEmpty();
|
||||
}
|
||||
inline const std::string& BlockHeader::block_output_mr() const
|
||||
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
// @@protoc_insertion_point(field_get:tari.rpc.BlockHeader.block_output_mr)
|
||||
return _internal_block_output_mr();
|
||||
}
|
||||
template <typename Arg_, typename... Args_>
|
||||
inline PROTOBUF_ALWAYS_INLINE void BlockHeader::set_block_output_mr(Arg_&& arg,
|
||||
Args_... args) {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
_impl_.block_output_mr_.SetBytes(static_cast<Arg_&&>(arg), args..., GetArena());
|
||||
// @@protoc_insertion_point(field_set:tari.rpc.BlockHeader.block_output_mr)
|
||||
}
|
||||
inline std::string* BlockHeader::mutable_block_output_mr() ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
std::string* _s = _internal_mutable_block_output_mr();
|
||||
// @@protoc_insertion_point(field_mutable:tari.rpc.BlockHeader.block_output_mr)
|
||||
return _s;
|
||||
}
|
||||
inline const std::string& BlockHeader::_internal_block_output_mr() const {
|
||||
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
|
||||
return _impl_.block_output_mr_.Get();
|
||||
}
|
||||
inline void BlockHeader::_internal_set_block_output_mr(const std::string& value) {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
_impl_.block_output_mr_.Set(value, GetArena());
|
||||
}
|
||||
inline std::string* BlockHeader::_internal_mutable_block_output_mr() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
return _impl_.block_output_mr_.Mutable( GetArena());
|
||||
}
|
||||
inline std::string* BlockHeader::release_block_output_mr() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
// @@protoc_insertion_point(field_release:tari.rpc.BlockHeader.block_output_mr)
|
||||
return _impl_.block_output_mr_.Release();
|
||||
}
|
||||
inline void BlockHeader::set_allocated_block_output_mr(std::string* value) {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
_impl_.block_output_mr_.SetAllocated(value, GetArena());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (_impl_.block_output_mr_.IsDefault()) {
|
||||
_impl_.block_output_mr_.Set("", GetArena());
|
||||
}
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
// @@protoc_insertion_point(field_set_allocated:tari.rpc.BlockHeader.block_output_mr)
|
||||
}
|
||||
|
||||
// bytes kernel_mr = 8;
|
||||
inline void BlockHeader::clear_kernel_mr() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
@@ -3275,6 +3355,28 @@ inline void NewBlockTemplate::set_allocated_body(::tari::rpc::AggregateBody* val
|
||||
// @@protoc_insertion_point(field_set_allocated:tari.rpc.NewBlockTemplate.body)
|
||||
}
|
||||
|
||||
// bool is_mempool_in_sync = 3;
|
||||
inline void NewBlockTemplate::clear_is_mempool_in_sync() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
_impl_.is_mempool_in_sync_ = false;
|
||||
}
|
||||
inline bool NewBlockTemplate::is_mempool_in_sync() const {
|
||||
// @@protoc_insertion_point(field_get:tari.rpc.NewBlockTemplate.is_mempool_in_sync)
|
||||
return _internal_is_mempool_in_sync();
|
||||
}
|
||||
inline void NewBlockTemplate::set_is_mempool_in_sync(bool value) {
|
||||
_internal_set_is_mempool_in_sync(value);
|
||||
// @@protoc_insertion_point(field_set:tari.rpc.NewBlockTemplate.is_mempool_in_sync)
|
||||
}
|
||||
inline bool NewBlockTemplate::_internal_is_mempool_in_sync() const {
|
||||
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
|
||||
return _impl_.is_mempool_in_sync_;
|
||||
}
|
||||
inline void NewBlockTemplate::_internal_set_is_mempool_in_sync(bool value) {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
_impl_.is_mempool_in_sync_ = value;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
+6
-2
@@ -38,9 +38,10 @@ message BlockHeader {
|
||||
bytes prev_hash = 4;
|
||||
// Timestamp at which the block was built.
|
||||
uint64 timestamp = 5;
|
||||
// This is the UTXO merkle root of the outputs
|
||||
// This is calculated as Hash (txo MMR root || roaring bitmap hash of UTXO indices)
|
||||
// This is the UTXO merkle root of the outputs in the blockchain
|
||||
bytes output_mr = 6;
|
||||
// This is the merkle root of all outputs in this block
|
||||
bytes block_output_mr = 7;
|
||||
// This is the MMR root of the kernels
|
||||
bytes kernel_mr = 8;
|
||||
// This is the Merkle root of the inputs in this block
|
||||
@@ -133,5 +134,8 @@ message NewBlockTemplate {
|
||||
// This flag indicates if the inputs, outputs and kernels have been sorted internally, that is, the sort() method
|
||||
// has been called. This may be false even if all components are sorted.
|
||||
AggregateBody body = 2;
|
||||
// Sometimes the mempool has not synced to the latest tip, this flag indicates if the mempool is out of sync.
|
||||
// In most cases the next call to get_new_block_template will return a block with the mempool in sync.
|
||||
bool is_mempool_in_sync = 3;
|
||||
}
|
||||
|
||||
|
||||
+58
-14
@@ -108,6 +108,7 @@ inline constexpr UnblindedOutput::Impl_::Impl_(
|
||||
::_pbi::ConstantInitialized()),
|
||||
features_{nullptr},
|
||||
metadata_signature_{nullptr},
|
||||
range_proof_{nullptr},
|
||||
value_{::uint64_t{0u}},
|
||||
script_lock_height_{::uint64_t{0u}},
|
||||
minimum_value_promise_{::uint64_t{0u}} {}
|
||||
@@ -427,6 +428,7 @@ const ::uint32_t
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::UnblindedOutput, _impl_.covenant_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::UnblindedOutput, _impl_.encrypted_data_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::UnblindedOutput, _impl_.minimum_value_promise_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::UnblindedOutput, _impl_.range_proof_),
|
||||
~0u,
|
||||
~0u,
|
||||
0,
|
||||
@@ -439,6 +441,7 @@ const ::uint32_t
|
||||
~0u,
|
||||
~0u,
|
||||
~0u,
|
||||
2,
|
||||
};
|
||||
|
||||
static const ::_pbi::MigrationSchema
|
||||
@@ -449,7 +452,7 @@ static const ::_pbi::MigrationSchema
|
||||
{90, 104, -1, sizeof(::tari::rpc::OutputFeatures)},
|
||||
{110, -1, -1, sizeof(::tari::rpc::AggregateBody)},
|
||||
{121, 132, -1, sizeof(::tari::rpc::Transaction)},
|
||||
{135, 155, -1, sizeof(::tari::rpc::UnblindedOutput)},
|
||||
{135, 156, -1, sizeof(::tari::rpc::UnblindedOutput)},
|
||||
};
|
||||
static const ::_pb::Message* const file_default_instances[] = {
|
||||
&::tari::rpc::_TransactionKernel_default_instance_._instance,
|
||||
@@ -498,7 +501,7 @@ const char descriptor_table_protodef_transaction_2eproto[] ABSL_ATTRIBUTE_SECTIO
|
||||
"tari.rpc.TransactionKernel\"[\n\013Transactio"
|
||||
"n\022\016\n\006offset\030\001 \001(\014\022%\n\004body\030\002 \001(\0132\027.tari.r"
|
||||
"pc.AggregateBody\022\025\n\rscript_offset\030\003 \001(\014\""
|
||||
"\343\002\n\017UnblindedOutput\022\r\n\005value\030\001 \001(\004\022\024\n\014sp"
|
||||
"\216\003\n\017UnblindedOutput\022\r\n\005value\030\001 \001(\004\022\024\n\014sp"
|
||||
"ending_key\030\002 \001(\014\022*\n\010features\030\003 \001(\0132\030.tar"
|
||||
"i.rpc.OutputFeatures\022\016\n\006script\030\004 \001(\014\022\022\n\n"
|
||||
"input_data\030\005 \001(\014\022\032\n\022script_private_key\030\007"
|
||||
@@ -506,8 +509,9 @@ const char descriptor_table_protodef_transaction_2eproto[] ABSL_ATTRIBUTE_SECTIO
|
||||
"\n\022metadata_signature\030\t \001(\0132\034.tari.rpc.Co"
|
||||
"mAndPubSignature\022\032\n\022script_lock_height\030\n"
|
||||
" \001(\004\022\020\n\010covenant\030\013 \001(\014\022\026\n\016encrypted_data"
|
||||
"\030\014 \001(\014\022\035\n\025minimum_value_promise\030\r \001(\004b\006p"
|
||||
"roto3"
|
||||
"\030\014 \001(\014\022\035\n\025minimum_value_promise\030\r \001(\004\022)\n"
|
||||
"\013range_proof\030\016 \001(\0132\024.tari.rpc.RangeProof"
|
||||
"b\006proto3"
|
||||
};
|
||||
static const ::_pbi::DescriptorTable* const descriptor_table_transaction_2eproto_deps[2] =
|
||||
{
|
||||
@@ -518,7 +522,7 @@ static ::absl::once_flag descriptor_table_transaction_2eproto_once;
|
||||
const ::_pbi::DescriptorTable descriptor_table_transaction_2eproto = {
|
||||
false,
|
||||
false,
|
||||
1805,
|
||||
1848,
|
||||
descriptor_table_protodef_transaction_2eproto,
|
||||
"transaction.proto",
|
||||
&descriptor_table_transaction_2eproto_once,
|
||||
@@ -2988,6 +2992,11 @@ void UnblindedOutput::clear_metadata_signature() {
|
||||
if (_impl_.metadata_signature_ != nullptr) _impl_.metadata_signature_->Clear();
|
||||
_impl_._has_bits_[0] &= ~0x00000002u;
|
||||
}
|
||||
void UnblindedOutput::clear_range_proof() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
if (_impl_.range_proof_ != nullptr) _impl_.range_proof_->Clear();
|
||||
_impl_._has_bits_[0] &= ~0x00000004u;
|
||||
}
|
||||
UnblindedOutput::UnblindedOutput(::google::protobuf::Arena* arena)
|
||||
: ::google::protobuf::Message(arena) {
|
||||
SharedCtor(arena);
|
||||
@@ -3022,6 +3031,9 @@ UnblindedOutput::UnblindedOutput(
|
||||
_impl_.metadata_signature_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::tari::rpc::ComAndPubSignature>(
|
||||
arena, *from._impl_.metadata_signature_)
|
||||
: nullptr;
|
||||
_impl_.range_proof_ = (cached_has_bits & 0x00000004u) ? ::google::protobuf::Message::CopyConstruct<::tari::rpc::RangeProof>(
|
||||
arena, *from._impl_.range_proof_)
|
||||
: nullptr;
|
||||
::memcpy(reinterpret_cast<char *>(&_impl_) +
|
||||
offsetof(Impl_, value_),
|
||||
reinterpret_cast<const char *>(&from._impl_) +
|
||||
@@ -3069,6 +3081,7 @@ inline void UnblindedOutput::SharedDtor() {
|
||||
_impl_.encrypted_data_.Destroy();
|
||||
delete _impl_.features_;
|
||||
delete _impl_.metadata_signature_;
|
||||
delete _impl_.range_proof_;
|
||||
_impl_.~Impl_();
|
||||
}
|
||||
|
||||
@@ -3101,7 +3114,7 @@ PROTOBUF_NOINLINE void UnblindedOutput::Clear() {
|
||||
_impl_.covenant_.ClearToEmpty();
|
||||
_impl_.encrypted_data_.ClearToEmpty();
|
||||
cached_has_bits = _impl_._has_bits_[0];
|
||||
if (cached_has_bits & 0x00000003u) {
|
||||
if (cached_has_bits & 0x00000007u) {
|
||||
if (cached_has_bits & 0x00000001u) {
|
||||
ABSL_DCHECK(_impl_.features_ != nullptr);
|
||||
_impl_.features_->Clear();
|
||||
@@ -3110,6 +3123,10 @@ PROTOBUF_NOINLINE void UnblindedOutput::Clear() {
|
||||
ABSL_DCHECK(_impl_.metadata_signature_ != nullptr);
|
||||
_impl_.metadata_signature_->Clear();
|
||||
}
|
||||
if (cached_has_bits & 0x00000004u) {
|
||||
ABSL_DCHECK(_impl_.range_proof_ != nullptr);
|
||||
_impl_.range_proof_->Clear();
|
||||
}
|
||||
}
|
||||
::memset(&_impl_.value_, 0, static_cast<::size_t>(
|
||||
reinterpret_cast<char*>(&_impl_.minimum_value_promise_) -
|
||||
@@ -3126,16 +3143,16 @@ const char* UnblindedOutput::_InternalParse(
|
||||
|
||||
|
||||
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
|
||||
const ::_pbi::TcParseTable<4, 12, 2, 0, 2> UnblindedOutput::_table_ = {
|
||||
const ::_pbi::TcParseTable<4, 13, 3, 0, 2> UnblindedOutput::_table_ = {
|
||||
{
|
||||
PROTOBUF_FIELD_OFFSET(UnblindedOutput, _impl_._has_bits_),
|
||||
0, // no _extensions_
|
||||
13, 120, // max_field_number, fast_idx_mask
|
||||
14, 120, // max_field_number, fast_idx_mask
|
||||
offsetof(decltype(_table_), field_lookup_table),
|
||||
4294959136, // skipmap
|
||||
4294950944, // skipmap
|
||||
offsetof(decltype(_table_), field_entries),
|
||||
12, // num_field_entries
|
||||
2, // num_aux_entries
|
||||
13, // num_field_entries
|
||||
3, // num_aux_entries
|
||||
offsetof(decltype(_table_), aux_entries),
|
||||
&_UnblindedOutput_default_instance_._instance,
|
||||
::_pbi::TcParser::GenericFallback, // fallback
|
||||
@@ -3181,7 +3198,9 @@ const ::_pbi::TcParseTable<4, 12, 2, 0, 2> UnblindedOutput::_table_ = {
|
||||
// uint64 minimum_value_promise = 13;
|
||||
{::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(UnblindedOutput, _impl_.minimum_value_promise_), 63>(),
|
||||
{104, 63, 0, PROTOBUF_FIELD_OFFSET(UnblindedOutput, _impl_.minimum_value_promise_)}},
|
||||
{::_pbi::TcParser::MiniParse, {}},
|
||||
// .tari.rpc.RangeProof range_proof = 14;
|
||||
{::_pbi::TcParser::FastMtS1,
|
||||
{114, 2, 2, PROTOBUF_FIELD_OFFSET(UnblindedOutput, _impl_.range_proof_)}},
|
||||
{::_pbi::TcParser::MiniParse, {}},
|
||||
}}, {{
|
||||
65535, 65535
|
||||
@@ -3222,9 +3241,13 @@ const ::_pbi::TcParseTable<4, 12, 2, 0, 2> UnblindedOutput::_table_ = {
|
||||
// uint64 minimum_value_promise = 13;
|
||||
{PROTOBUF_FIELD_OFFSET(UnblindedOutput, _impl_.minimum_value_promise_), -1, 0,
|
||||
(0 | ::_fl::kFcSingular | ::_fl::kUInt64)},
|
||||
// .tari.rpc.RangeProof range_proof = 14;
|
||||
{PROTOBUF_FIELD_OFFSET(UnblindedOutput, _impl_.range_proof_), _Internal::kHasBitsOffset + 2, 2,
|
||||
(0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)},
|
||||
}}, {{
|
||||
{::_pbi::TcParser::GetTable<::tari::rpc::OutputFeatures>()},
|
||||
{::_pbi::TcParser::GetTable<::tari::rpc::ComAndPubSignature>()},
|
||||
{::_pbi::TcParser::GetTable<::tari::rpc::RangeProof>()},
|
||||
}}, {{
|
||||
}},
|
||||
};
|
||||
@@ -3312,6 +3335,12 @@ const ::_pbi::TcParseTable<4, 12, 2, 0, 2> UnblindedOutput::_table_ = {
|
||||
13, this->_internal_minimum_value_promise(), target);
|
||||
}
|
||||
|
||||
// .tari.rpc.RangeProof range_proof = 14;
|
||||
if (cached_has_bits & 0x00000004u) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage(
|
||||
14, *_impl_.range_proof_, _impl_.range_proof_->GetCachedSize(), target, stream);
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target =
|
||||
::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
@@ -3372,7 +3401,7 @@ const ::_pbi::TcParseTable<4, 12, 2, 0, 2> UnblindedOutput::_table_ = {
|
||||
}
|
||||
|
||||
cached_has_bits = _impl_._has_bits_[0];
|
||||
if (cached_has_bits & 0x00000003u) {
|
||||
if (cached_has_bits & 0x00000007u) {
|
||||
// .tari.rpc.OutputFeatures features = 3;
|
||||
if (cached_has_bits & 0x00000001u) {
|
||||
total_size +=
|
||||
@@ -3385,6 +3414,12 @@ const ::_pbi::TcParseTable<4, 12, 2, 0, 2> UnblindedOutput::_table_ = {
|
||||
1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.metadata_signature_);
|
||||
}
|
||||
|
||||
// .tari.rpc.RangeProof range_proof = 14;
|
||||
if (cached_has_bits & 0x00000004u) {
|
||||
total_size +=
|
||||
1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.range_proof_);
|
||||
}
|
||||
|
||||
}
|
||||
// uint64 value = 1;
|
||||
if (this->_internal_value() != 0) {
|
||||
@@ -3439,7 +3474,7 @@ void UnblindedOutput::MergeImpl(::google::protobuf::MessageLite& to_msg, const :
|
||||
_this->_internal_set_encrypted_data(from._internal_encrypted_data());
|
||||
}
|
||||
cached_has_bits = from._impl_._has_bits_[0];
|
||||
if (cached_has_bits & 0x00000003u) {
|
||||
if (cached_has_bits & 0x00000007u) {
|
||||
if (cached_has_bits & 0x00000001u) {
|
||||
ABSL_DCHECK(from._impl_.features_ != nullptr);
|
||||
if (_this->_impl_.features_ == nullptr) {
|
||||
@@ -3458,6 +3493,15 @@ void UnblindedOutput::MergeImpl(::google::protobuf::MessageLite& to_msg, const :
|
||||
_this->_impl_.metadata_signature_->MergeFrom(*from._impl_.metadata_signature_);
|
||||
}
|
||||
}
|
||||
if (cached_has_bits & 0x00000004u) {
|
||||
ABSL_DCHECK(from._impl_.range_proof_ != nullptr);
|
||||
if (_this->_impl_.range_proof_ == nullptr) {
|
||||
_this->_impl_.range_proof_ =
|
||||
::google::protobuf::Message::CopyConstruct<::tari::rpc::RangeProof>(arena, *from._impl_.range_proof_);
|
||||
} else {
|
||||
_this->_impl_.range_proof_->MergeFrom(*from._impl_.range_proof_);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (from._internal_value() != 0) {
|
||||
_this->_impl_.value_ = from._impl_.value_;
|
||||
|
||||
+109
-1
@@ -737,6 +737,7 @@ class UnblindedOutput final : public ::google::protobuf::Message
|
||||
kEncryptedDataFieldNumber = 12,
|
||||
kFeaturesFieldNumber = 3,
|
||||
kMetadataSignatureFieldNumber = 9,
|
||||
kRangeProofFieldNumber = 14,
|
||||
kValueFieldNumber = 1,
|
||||
kScriptLockHeightFieldNumber = 10,
|
||||
kMinimumValuePromiseFieldNumber = 13,
|
||||
@@ -882,6 +883,21 @@ class UnblindedOutput final : public ::google::protobuf::Message
|
||||
const ::tari::rpc::ComAndPubSignature& _internal_metadata_signature() const;
|
||||
::tari::rpc::ComAndPubSignature* _internal_mutable_metadata_signature();
|
||||
|
||||
public:
|
||||
// .tari.rpc.RangeProof range_proof = 14;
|
||||
bool has_range_proof() const;
|
||||
void clear_range_proof() ;
|
||||
const ::tari::rpc::RangeProof& range_proof() const;
|
||||
PROTOBUF_NODISCARD ::tari::rpc::RangeProof* release_range_proof();
|
||||
::tari::rpc::RangeProof* mutable_range_proof();
|
||||
void set_allocated_range_proof(::tari::rpc::RangeProof* value);
|
||||
void unsafe_arena_set_allocated_range_proof(::tari::rpc::RangeProof* value);
|
||||
::tari::rpc::RangeProof* unsafe_arena_release_range_proof();
|
||||
|
||||
private:
|
||||
const ::tari::rpc::RangeProof& _internal_range_proof() const;
|
||||
::tari::rpc::RangeProof* _internal_mutable_range_proof();
|
||||
|
||||
public:
|
||||
// uint64 value = 1;
|
||||
void clear_value() ;
|
||||
@@ -918,7 +934,7 @@ class UnblindedOutput final : public ::google::protobuf::Message
|
||||
class _Internal;
|
||||
friend class ::google::protobuf::internal::TcParser;
|
||||
static const ::google::protobuf::internal::TcParseTable<
|
||||
4, 12, 2,
|
||||
4, 13, 3,
|
||||
0, 2>
|
||||
_table_;
|
||||
friend class ::google::protobuf::MessageLite;
|
||||
@@ -945,6 +961,7 @@ class UnblindedOutput final : public ::google::protobuf::Message
|
||||
::google::protobuf::internal::ArenaStringPtr encrypted_data_;
|
||||
::tari::rpc::OutputFeatures* features_;
|
||||
::tari::rpc::ComAndPubSignature* metadata_signature_;
|
||||
::tari::rpc::RangeProof* range_proof_;
|
||||
::uint64_t value_;
|
||||
::uint64_t script_lock_height_;
|
||||
::uint64_t minimum_value_promise_;
|
||||
@@ -5045,6 +5062,97 @@ inline void UnblindedOutput::_internal_set_minimum_value_promise(::uint64_t valu
|
||||
_impl_.minimum_value_promise_ = value;
|
||||
}
|
||||
|
||||
// .tari.rpc.RangeProof range_proof = 14;
|
||||
inline bool UnblindedOutput::has_range_proof() const {
|
||||
bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0;
|
||||
PROTOBUF_ASSUME(!value || _impl_.range_proof_ != nullptr);
|
||||
return value;
|
||||
}
|
||||
inline const ::tari::rpc::RangeProof& UnblindedOutput::_internal_range_proof() const {
|
||||
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
|
||||
const ::tari::rpc::RangeProof* p = _impl_.range_proof_;
|
||||
return p != nullptr ? *p : reinterpret_cast<const ::tari::rpc::RangeProof&>(::tari::rpc::_RangeProof_default_instance_);
|
||||
}
|
||||
inline const ::tari::rpc::RangeProof& UnblindedOutput::range_proof() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
// @@protoc_insertion_point(field_get:tari.rpc.UnblindedOutput.range_proof)
|
||||
return _internal_range_proof();
|
||||
}
|
||||
inline void UnblindedOutput::unsafe_arena_set_allocated_range_proof(::tari::rpc::RangeProof* value) {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
if (GetArena() == nullptr) {
|
||||
delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.range_proof_);
|
||||
}
|
||||
_impl_.range_proof_ = reinterpret_cast<::tari::rpc::RangeProof*>(value);
|
||||
if (value != nullptr) {
|
||||
_impl_._has_bits_[0] |= 0x00000004u;
|
||||
} else {
|
||||
_impl_._has_bits_[0] &= ~0x00000004u;
|
||||
}
|
||||
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tari.rpc.UnblindedOutput.range_proof)
|
||||
}
|
||||
inline ::tari::rpc::RangeProof* UnblindedOutput::release_range_proof() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
|
||||
_impl_._has_bits_[0] &= ~0x00000004u;
|
||||
::tari::rpc::RangeProof* released = _impl_.range_proof_;
|
||||
_impl_.range_proof_ = nullptr;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released);
|
||||
released = ::google::protobuf::internal::DuplicateIfNonNull(released);
|
||||
if (GetArena() == nullptr) {
|
||||
delete old;
|
||||
}
|
||||
#else // PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
if (GetArena() != nullptr) {
|
||||
released = ::google::protobuf::internal::DuplicateIfNonNull(released);
|
||||
}
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
return released;
|
||||
}
|
||||
inline ::tari::rpc::RangeProof* UnblindedOutput::unsafe_arena_release_range_proof() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
// @@protoc_insertion_point(field_release:tari.rpc.UnblindedOutput.range_proof)
|
||||
|
||||
_impl_._has_bits_[0] &= ~0x00000004u;
|
||||
::tari::rpc::RangeProof* temp = _impl_.range_proof_;
|
||||
_impl_.range_proof_ = nullptr;
|
||||
return temp;
|
||||
}
|
||||
inline ::tari::rpc::RangeProof* UnblindedOutput::_internal_mutable_range_proof() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
if (_impl_.range_proof_ == nullptr) {
|
||||
auto* p = ::google::protobuf::Message::DefaultConstruct<::tari::rpc::RangeProof>(GetArena());
|
||||
_impl_.range_proof_ = reinterpret_cast<::tari::rpc::RangeProof*>(p);
|
||||
}
|
||||
return _impl_.range_proof_;
|
||||
}
|
||||
inline ::tari::rpc::RangeProof* UnblindedOutput::mutable_range_proof() ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
_impl_._has_bits_[0] |= 0x00000004u;
|
||||
::tari::rpc::RangeProof* _msg = _internal_mutable_range_proof();
|
||||
// @@protoc_insertion_point(field_mutable:tari.rpc.UnblindedOutput.range_proof)
|
||||
return _msg;
|
||||
}
|
||||
inline void UnblindedOutput::set_allocated_range_proof(::tari::rpc::RangeProof* value) {
|
||||
::google::protobuf::Arena* message_arena = GetArena();
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
if (message_arena == nullptr) {
|
||||
delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.range_proof_);
|
||||
}
|
||||
|
||||
if (value != nullptr) {
|
||||
::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(value)->GetArena();
|
||||
if (message_arena != submessage_arena) {
|
||||
value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena);
|
||||
}
|
||||
_impl_._has_bits_[0] |= 0x00000004u;
|
||||
} else {
|
||||
_impl_._has_bits_[0] &= ~0x00000004u;
|
||||
}
|
||||
|
||||
_impl_.range_proof_ = reinterpret_cast<::tari::rpc::RangeProof*>(value);
|
||||
// @@protoc_insertion_point(field_set_allocated:tari.rpc.UnblindedOutput.range_proof)
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
@@ -178,5 +178,7 @@ message UnblindedOutput {
|
||||
bytes encrypted_data = 12;
|
||||
// The minimum value of the commitment that is proven by the range proof (in MicroMinotari)
|
||||
uint64 minimum_value_promise = 13;
|
||||
// The range proof
|
||||
RangeProof range_proof = 14;
|
||||
}
|
||||
|
||||
|
||||
+72
-50
@@ -302,7 +302,7 @@ inline constexpr ConsensusConstants::Impl_::Impl_(
|
||||
block_weight_inputs_{::uint64_t{0u}},
|
||||
block_weight_outputs_{::uint64_t{0u}},
|
||||
block_weight_kernels_{::uint64_t{0u}},
|
||||
faucet_value_{::uint64_t{0u}},
|
||||
pre_mine_value_{::uint64_t{0u}},
|
||||
max_script_byte_size_{::uint64_t{0u}},
|
||||
validator_node_validity_period_{::uint64_t{0u}},
|
||||
effective_from_height_{::uint64_t{0u}},
|
||||
@@ -313,6 +313,7 @@ inline constexpr ConsensusConstants::Impl_::Impl_(
|
||||
validator_node_registration_shuffle_interval_epoch_{::uint64_t{0u}},
|
||||
inflation_bips_{::uint64_t{0u}},
|
||||
tail_epoch_length_{::uint64_t{0u}},
|
||||
max_block_coinbase_count_{::uint64_t{0u}},
|
||||
blockchain_version_{0u} {}
|
||||
|
||||
template <typename>
|
||||
@@ -486,7 +487,7 @@ const ::uint32_t
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.block_weight_inputs_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.block_weight_outputs_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.block_weight_kernels_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.faucet_value_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.pre_mine_value_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.max_script_byte_size_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.validator_node_validity_period_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.effective_from_height_),
|
||||
@@ -505,6 +506,7 @@ const ::uint32_t
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.permitted_range_proof_types_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.inflation_bips_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.tail_epoch_length_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::ConsensusConstants, _impl_.max_block_coinbase_count_),
|
||||
~0u,
|
||||
~0u,
|
||||
~0u,
|
||||
@@ -538,6 +540,7 @@ const ::uint32_t
|
||||
~0u,
|
||||
~0u,
|
||||
~0u,
|
||||
~0u,
|
||||
};
|
||||
|
||||
static const ::_pbi::MigrationSchema
|
||||
@@ -554,7 +557,7 @@ static const ::_pbi::MigrationSchema
|
||||
{96, -1, -1, sizeof(::tari::rpc::PermittedRangeProofs)},
|
||||
{106, -1, -1, sizeof(::tari::rpc::RangeProof)},
|
||||
{115, 125, -1, sizeof(::tari::rpc::ConsensusConstants_ProofOfWorkEntry_DoNotUse)},
|
||||
{127, 168, -1, sizeof(::tari::rpc::ConsensusConstants)},
|
||||
{127, 169, -1, sizeof(::tari::rpc::ConsensusConstants)},
|
||||
};
|
||||
static const ::_pb::Message* const file_default_instances[] = {
|
||||
&::tari::rpc::_Range_default_instance_._instance,
|
||||
@@ -593,7 +596,7 @@ const char descriptor_table_protodef_types_2eproto[] ABSL_ATTRIBUTE_SECTION_VARI
|
||||
"output_type\030\001 \001(\0162\024.tari.rpc.OutputType\022"
|
||||
"3\n\021range_proof_types\030\002 \003(\0162\030.tari.rpc.Ra"
|
||||
"ngeProofType\"!\n\nRangeProof\022\023\n\013proof_byte"
|
||||
"s\030\001 \001(\014\"\327\n\n\022ConsensusConstants\022\035\n\025coinba"
|
||||
"s\030\001 \001(\014\"\373\n\n\022ConsensusConstants\022\035\n\025coinba"
|
||||
"se_min_maturity\030\001 \001(\004\022\032\n\022blockchain_vers"
|
||||
"ion\030\002 \001(\r\022\031\n\021future_time_limit\030\003 \001(\004\022\037\n\027"
|
||||
"difficulty_block_window\030\005 \001(\004\022$\n\034max_blo"
|
||||
@@ -604,41 +607,41 @@ const char descriptor_table_protodef_types_2eproto[] ABSL_ATTRIBUTE_SECTION_VARI
|
||||
"\022 \n\030min_sha3x_pow_difficulty\030\r \001(\004\022\033\n\023bl"
|
||||
"ock_weight_inputs\030\016 \001(\004\022\034\n\024block_weight_"
|
||||
"outputs\030\017 \001(\004\022\034\n\024block_weight_kernels\030\020 "
|
||||
"\001(\004\022\024\n\014faucet_value\030\021 \001(\004\022\034\n\024max_script_"
|
||||
"byte_size\030\022 \001(\004\022&\n\036validator_node_validi"
|
||||
"ty_period\030\023 \001(\004\022\035\n\025effective_from_height"
|
||||
"\030\024 \001(\004\0227\n\036valid_blockchain_version_range"
|
||||
"\030\025 \001(\0132\017.tari.rpc.Range\022\037\n\027max_randomx_s"
|
||||
"eed_height\030\026 \001(\004\022D\n\rproof_of_work\030\027 \003(\0132"
|
||||
"-.tari.rpc.ConsensusConstants.ProofOfWor"
|
||||
"kEntry\0222\n\022transaction_weight\030\030 \001(\0132\026.tar"
|
||||
"i.rpc.WeightParams\022,\n\023input_version_rang"
|
||||
"e\030\032 \001(\0132\017.tari.rpc.Range\0226\n\024output_versi"
|
||||
"on_range\030\033 \001(\0132\030.tari.rpc.OutputsVersion"
|
||||
"\022-\n\024kernel_version_range\030\034 \001(\0132\017.tari.rp"
|
||||
"c.Range\0224\n\026permitted_output_types\030\035 \003(\0162"
|
||||
"\024.tari.rpc.OutputType\022\024\n\014epoch_length\030\036 "
|
||||
"\001(\004\0226\n.validator_node_registration_min_d"
|
||||
"eposit_amount\030\037 \001(\004\0223\n+validator_node_re"
|
||||
"gistration_min_lock_height\030 \001(\004\022:\n2vali"
|
||||
"dator_node_registration_shuffle_interval"
|
||||
"_epoch\030! \001(\004\022C\n\033permitted_range_proof_ty"
|
||||
"pes\030\" \003(\0132\036.tari.rpc.PermittedRangeProof"
|
||||
"s\022\026\n\016inflation_bips\030# \001(\004\022\031\n\021tail_epoch_"
|
||||
"length\030$ \001(\004\032S\n\020ProofOfWorkEntry\022\013\n\003key\030"
|
||||
"\001 \001(\r\022.\n\005value\030\002 \001(\0132\037.tari.rpc.PowAlgor"
|
||||
"ithmConstants:\0028\001*s\n\nOutputType\022\014\n\010STAND"
|
||||
"ARD\020\000\022\014\n\010COINBASE\020\001\022\010\n\004BURN\020\002\022\037\n\033VALIDAT"
|
||||
"OR_NODE_REGISTRATION\020\003\022\036\n\032CODE_TEMPLATE_"
|
||||
"REGISTRATION\020\004*:\n\016RangeProofType\022\024\n\020BULL"
|
||||
"ETPROOF_PLUS\020\000\022\022\n\016REVEALED_VALUE\020\001b\006prot"
|
||||
"o3"
|
||||
"\001(\004\022\026\n\016pre_mine_value\030\021 \001(\004\022\034\n\024max_scrip"
|
||||
"t_byte_size\030\022 \001(\004\022&\n\036validator_node_vali"
|
||||
"dity_period\030\023 \001(\004\022\035\n\025effective_from_heig"
|
||||
"ht\030\024 \001(\004\0227\n\036valid_blockchain_version_ran"
|
||||
"ge\030\025 \001(\0132\017.tari.rpc.Range\022\037\n\027max_randomx"
|
||||
"_seed_height\030\026 \001(\004\022D\n\rproof_of_work\030\027 \003("
|
||||
"\0132-.tari.rpc.ConsensusConstants.ProofOfW"
|
||||
"orkEntry\0222\n\022transaction_weight\030\030 \001(\0132\026.t"
|
||||
"ari.rpc.WeightParams\022,\n\023input_version_ra"
|
||||
"nge\030\032 \001(\0132\017.tari.rpc.Range\0226\n\024output_ver"
|
||||
"sion_range\030\033 \001(\0132\030.tari.rpc.OutputsVersi"
|
||||
"on\022-\n\024kernel_version_range\030\034 \001(\0132\017.tari."
|
||||
"rpc.Range\0224\n\026permitted_output_types\030\035 \003("
|
||||
"\0162\024.tari.rpc.OutputType\022\024\n\014epoch_length\030"
|
||||
"\036 \001(\004\0226\n.validator_node_registration_min"
|
||||
"_deposit_amount\030\037 \001(\004\0223\n+validator_node_"
|
||||
"registration_min_lock_height\030 \001(\004\022:\n2va"
|
||||
"lidator_node_registration_shuffle_interv"
|
||||
"al_epoch\030! \001(\004\022C\n\033permitted_range_proof_"
|
||||
"types\030\" \003(\0132\036.tari.rpc.PermittedRangePro"
|
||||
"ofs\022\026\n\016inflation_bips\030# \001(\004\022\031\n\021tail_epoc"
|
||||
"h_length\030$ \001(\004\022 \n\030max_block_coinbase_cou"
|
||||
"nt\030% \001(\004\032S\n\020ProofOfWorkEntry\022\013\n\003key\030\001 \001("
|
||||
"\r\022.\n\005value\030\002 \001(\0132\037.tari.rpc.PowAlgorithm"
|
||||
"Constants:\0028\001*s\n\nOutputType\022\014\n\010STANDARD\020"
|
||||
"\000\022\014\n\010COINBASE\020\001\022\010\n\004BURN\020\002\022\037\n\033VALIDATOR_N"
|
||||
"ODE_REGISTRATION\020\003\022\036\n\032CODE_TEMPLATE_REGI"
|
||||
"STRATION\020\004*:\n\016RangeProofType\022\024\n\020BULLETPR"
|
||||
"OOF_PLUS\020\000\022\022\n\016REVEALED_VALUE\020\001b\006proto3"
|
||||
};
|
||||
static ::absl::once_flag descriptor_table_types_2eproto_once;
|
||||
const ::_pbi::DescriptorTable descriptor_table_types_2eproto = {
|
||||
false,
|
||||
false,
|
||||
2362,
|
||||
2398,
|
||||
descriptor_table_protodef_types_2eproto,
|
||||
"types.proto",
|
||||
&descriptor_table_types_2eproto_once,
|
||||
@@ -3217,15 +3220,15 @@ const char* ConsensusConstants::_InternalParse(
|
||||
|
||||
|
||||
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
|
||||
const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
|
||||
const ::_pbi::TcParseTable<5, 34, 8, 0, 7> ConsensusConstants::_table_ = {
|
||||
{
|
||||
PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_._has_bits_),
|
||||
0, // no _extensions_
|
||||
36, 248, // max_field_number, fast_idx_mask
|
||||
37, 248, // max_field_number, fast_idx_mask
|
||||
offsetof(decltype(_table_), field_lookup_table),
|
||||
16777256, // skipmap
|
||||
offsetof(decltype(_table_), field_entries),
|
||||
33, // num_field_entries
|
||||
34, // num_field_entries
|
||||
8, // num_aux_entries
|
||||
offsetof(decltype(_table_), aux_entries),
|
||||
&_ConsensusConstants_default_instance_._instance,
|
||||
@@ -3279,9 +3282,9 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
|
||||
// uint64 block_weight_kernels = 16;
|
||||
{::_pbi::TcParser::FastV64S2,
|
||||
{384, 63, 0, PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.block_weight_kernels_)}},
|
||||
// uint64 faucet_value = 17;
|
||||
// uint64 pre_mine_value = 17;
|
||||
{::_pbi::TcParser::FastV64S2,
|
||||
{392, 63, 0, PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.faucet_value_)}},
|
||||
{392, 63, 0, PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.pre_mine_value_)}},
|
||||
// uint64 max_script_byte_size = 18;
|
||||
{::_pbi::TcParser::FastV64S2,
|
||||
{400, 63, 0, PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.max_script_byte_size_)}},
|
||||
@@ -3322,7 +3325,7 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
|
||||
{504, 63, 0, PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.validator_node_registration_min_deposit_amount_)}},
|
||||
}}, {{
|
||||
33, 0, 1,
|
||||
65520, 29,
|
||||
65504, 29,
|
||||
65535, 65535
|
||||
}}, {{
|
||||
// uint64 coinbase_min_maturity = 1;
|
||||
@@ -3367,8 +3370,8 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
|
||||
// uint64 block_weight_kernels = 16;
|
||||
{PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.block_weight_kernels_), -1, 0,
|
||||
(0 | ::_fl::kFcSingular | ::_fl::kUInt64)},
|
||||
// uint64 faucet_value = 17;
|
||||
{PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.faucet_value_), -1, 0,
|
||||
// uint64 pre_mine_value = 17;
|
||||
{PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.pre_mine_value_), -1, 0,
|
||||
(0 | ::_fl::kFcSingular | ::_fl::kUInt64)},
|
||||
// uint64 max_script_byte_size = 18;
|
||||
{PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.max_script_byte_size_), -1, 0,
|
||||
@@ -3424,6 +3427,9 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
|
||||
// uint64 tail_epoch_length = 36;
|
||||
{PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.tail_epoch_length_), -1, 0,
|
||||
(0 | ::_fl::kFcSingular | ::_fl::kUInt64)},
|
||||
// uint64 max_block_coinbase_count = 37;
|
||||
{PROTOBUF_FIELD_OFFSET(ConsensusConstants, _impl_.max_block_coinbase_count_), -1, 0,
|
||||
(0 | ::_fl::kFcSingular | ::_fl::kUInt64)},
|
||||
}}, {{
|
||||
{::_pbi::TcParser::GetTable<::tari::rpc::Range>()},
|
||||
{::_pbi::TcParser::GetMapAuxInfo<
|
||||
@@ -3547,11 +3553,11 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
|
||||
16, this->_internal_block_weight_kernels(), target);
|
||||
}
|
||||
|
||||
// uint64 faucet_value = 17;
|
||||
if (this->_internal_faucet_value() != 0) {
|
||||
// uint64 pre_mine_value = 17;
|
||||
if (this->_internal_pre_mine_value() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::_pbi::WireFormatLite::WriteUInt64ToArray(
|
||||
17, this->_internal_faucet_value(), target);
|
||||
17, this->_internal_pre_mine_value(), target);
|
||||
}
|
||||
|
||||
// uint64 max_script_byte_size = 18;
|
||||
@@ -3696,6 +3702,13 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
|
||||
36, this->_internal_tail_epoch_length(), target);
|
||||
}
|
||||
|
||||
// uint64 max_block_coinbase_count = 37;
|
||||
if (this->_internal_max_block_coinbase_count() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::_pbi::WireFormatLite::WriteUInt64ToArray(
|
||||
37, this->_internal_max_block_coinbase_count(), target);
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target =
|
||||
::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
@@ -3860,10 +3873,10 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
|
||||
this->_internal_block_weight_kernels());
|
||||
}
|
||||
|
||||
// uint64 faucet_value = 17;
|
||||
if (this->_internal_faucet_value() != 0) {
|
||||
// uint64 pre_mine_value = 17;
|
||||
if (this->_internal_pre_mine_value() != 0) {
|
||||
total_size += 2 + ::_pbi::WireFormatLite::UInt64Size(
|
||||
this->_internal_faucet_value());
|
||||
this->_internal_pre_mine_value());
|
||||
}
|
||||
|
||||
// uint64 max_script_byte_size = 18;
|
||||
@@ -3926,6 +3939,12 @@ const ::_pbi::TcParseTable<5, 33, 8, 0, 7> ConsensusConstants::_table_ = {
|
||||
this->_internal_tail_epoch_length());
|
||||
}
|
||||
|
||||
// uint64 max_block_coinbase_count = 37;
|
||||
if (this->_internal_max_block_coinbase_count() != 0) {
|
||||
total_size += 2 + ::_pbi::WireFormatLite::UInt64Size(
|
||||
this->_internal_max_block_coinbase_count());
|
||||
}
|
||||
|
||||
// uint32 blockchain_version = 2;
|
||||
if (this->_internal_blockchain_version() != 0) {
|
||||
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(
|
||||
@@ -4034,8 +4053,8 @@ void ConsensusConstants::MergeImpl(::google::protobuf::MessageLite& to_msg, cons
|
||||
if (from._internal_block_weight_kernels() != 0) {
|
||||
_this->_impl_.block_weight_kernels_ = from._impl_.block_weight_kernels_;
|
||||
}
|
||||
if (from._internal_faucet_value() != 0) {
|
||||
_this->_impl_.faucet_value_ = from._impl_.faucet_value_;
|
||||
if (from._internal_pre_mine_value() != 0) {
|
||||
_this->_impl_.pre_mine_value_ = from._impl_.pre_mine_value_;
|
||||
}
|
||||
if (from._internal_max_script_byte_size() != 0) {
|
||||
_this->_impl_.max_script_byte_size_ = from._impl_.max_script_byte_size_;
|
||||
@@ -4067,6 +4086,9 @@ void ConsensusConstants::MergeImpl(::google::protobuf::MessageLite& to_msg, cons
|
||||
if (from._internal_tail_epoch_length() != 0) {
|
||||
_this->_impl_.tail_epoch_length_ = from._impl_.tail_epoch_length_;
|
||||
}
|
||||
if (from._internal_max_block_coinbase_count() != 0) {
|
||||
_this->_impl_.max_block_coinbase_count_ = from._impl_.max_block_coinbase_count_;
|
||||
}
|
||||
if (from._internal_blockchain_version() != 0) {
|
||||
_this->_impl_.blockchain_version_ = from._impl_.blockchain_version_;
|
||||
}
|
||||
|
||||
+56
-22
@@ -2416,7 +2416,7 @@ class ConsensusConstants final : public ::google::protobuf::Message
|
||||
kBlockWeightInputsFieldNumber = 14,
|
||||
kBlockWeightOutputsFieldNumber = 15,
|
||||
kBlockWeightKernelsFieldNumber = 16,
|
||||
kFaucetValueFieldNumber = 17,
|
||||
kPreMineValueFieldNumber = 17,
|
||||
kMaxScriptByteSizeFieldNumber = 18,
|
||||
kValidatorNodeValidityPeriodFieldNumber = 19,
|
||||
kEffectiveFromHeightFieldNumber = 20,
|
||||
@@ -2427,6 +2427,7 @@ class ConsensusConstants final : public ::google::protobuf::Message
|
||||
kValidatorNodeRegistrationShuffleIntervalEpochFieldNumber = 33,
|
||||
kInflationBipsFieldNumber = 35,
|
||||
kTailEpochLengthFieldNumber = 36,
|
||||
kMaxBlockCoinbaseCountFieldNumber = 37,
|
||||
kBlockchainVersionFieldNumber = 2,
|
||||
};
|
||||
// repeated uint64 emission_decay = 11;
|
||||
@@ -2693,14 +2694,14 @@ class ConsensusConstants final : public ::google::protobuf::Message
|
||||
void _internal_set_block_weight_kernels(::uint64_t value);
|
||||
|
||||
public:
|
||||
// uint64 faucet_value = 17;
|
||||
void clear_faucet_value() ;
|
||||
::uint64_t faucet_value() const;
|
||||
void set_faucet_value(::uint64_t value);
|
||||
// uint64 pre_mine_value = 17;
|
||||
void clear_pre_mine_value() ;
|
||||
::uint64_t pre_mine_value() const;
|
||||
void set_pre_mine_value(::uint64_t value);
|
||||
|
||||
private:
|
||||
::uint64_t _internal_faucet_value() const;
|
||||
void _internal_set_faucet_value(::uint64_t value);
|
||||
::uint64_t _internal_pre_mine_value() const;
|
||||
void _internal_set_pre_mine_value(::uint64_t value);
|
||||
|
||||
public:
|
||||
// uint64 max_script_byte_size = 18;
|
||||
@@ -2802,6 +2803,16 @@ class ConsensusConstants final : public ::google::protobuf::Message
|
||||
::uint64_t _internal_tail_epoch_length() const;
|
||||
void _internal_set_tail_epoch_length(::uint64_t value);
|
||||
|
||||
public:
|
||||
// uint64 max_block_coinbase_count = 37;
|
||||
void clear_max_block_coinbase_count() ;
|
||||
::uint64_t max_block_coinbase_count() const;
|
||||
void set_max_block_coinbase_count(::uint64_t value);
|
||||
|
||||
private:
|
||||
::uint64_t _internal_max_block_coinbase_count() const;
|
||||
void _internal_set_max_block_coinbase_count(::uint64_t value);
|
||||
|
||||
public:
|
||||
// uint32 blockchain_version = 2;
|
||||
void clear_blockchain_version() ;
|
||||
@@ -2818,7 +2829,7 @@ class ConsensusConstants final : public ::google::protobuf::Message
|
||||
class _Internal;
|
||||
friend class ::google::protobuf::internal::TcParser;
|
||||
static const ::google::protobuf::internal::TcParseTable<
|
||||
5, 33, 8,
|
||||
5, 34, 8,
|
||||
0, 7>
|
||||
_table_;
|
||||
friend class ::google::protobuf::MessageLite;
|
||||
@@ -2862,7 +2873,7 @@ class ConsensusConstants final : public ::google::protobuf::Message
|
||||
::uint64_t block_weight_inputs_;
|
||||
::uint64_t block_weight_outputs_;
|
||||
::uint64_t block_weight_kernels_;
|
||||
::uint64_t faucet_value_;
|
||||
::uint64_t pre_mine_value_;
|
||||
::uint64_t max_script_byte_size_;
|
||||
::uint64_t validator_node_validity_period_;
|
||||
::uint64_t effective_from_height_;
|
||||
@@ -2873,6 +2884,7 @@ class ConsensusConstants final : public ::google::protobuf::Message
|
||||
::uint64_t validator_node_registration_shuffle_interval_epoch_;
|
||||
::uint64_t inflation_bips_;
|
||||
::uint64_t tail_epoch_length_;
|
||||
::uint64_t max_block_coinbase_count_;
|
||||
::uint32_t blockchain_version_;
|
||||
PROTOBUF_TSAN_DECLARE_MEMBER
|
||||
};
|
||||
@@ -4302,26 +4314,26 @@ inline void ConsensusConstants::_internal_set_block_weight_kernels(::uint64_t va
|
||||
_impl_.block_weight_kernels_ = value;
|
||||
}
|
||||
|
||||
// uint64 faucet_value = 17;
|
||||
inline void ConsensusConstants::clear_faucet_value() {
|
||||
// uint64 pre_mine_value = 17;
|
||||
inline void ConsensusConstants::clear_pre_mine_value() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
_impl_.faucet_value_ = ::uint64_t{0u};
|
||||
_impl_.pre_mine_value_ = ::uint64_t{0u};
|
||||
}
|
||||
inline ::uint64_t ConsensusConstants::faucet_value() const {
|
||||
// @@protoc_insertion_point(field_get:tari.rpc.ConsensusConstants.faucet_value)
|
||||
return _internal_faucet_value();
|
||||
inline ::uint64_t ConsensusConstants::pre_mine_value() const {
|
||||
// @@protoc_insertion_point(field_get:tari.rpc.ConsensusConstants.pre_mine_value)
|
||||
return _internal_pre_mine_value();
|
||||
}
|
||||
inline void ConsensusConstants::set_faucet_value(::uint64_t value) {
|
||||
_internal_set_faucet_value(value);
|
||||
// @@protoc_insertion_point(field_set:tari.rpc.ConsensusConstants.faucet_value)
|
||||
inline void ConsensusConstants::set_pre_mine_value(::uint64_t value) {
|
||||
_internal_set_pre_mine_value(value);
|
||||
// @@protoc_insertion_point(field_set:tari.rpc.ConsensusConstants.pre_mine_value)
|
||||
}
|
||||
inline ::uint64_t ConsensusConstants::_internal_faucet_value() const {
|
||||
inline ::uint64_t ConsensusConstants::_internal_pre_mine_value() const {
|
||||
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
|
||||
return _impl_.faucet_value_;
|
||||
return _impl_.pre_mine_value_;
|
||||
}
|
||||
inline void ConsensusConstants::_internal_set_faucet_value(::uint64_t value) {
|
||||
inline void ConsensusConstants::_internal_set_pre_mine_value(::uint64_t value) {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
_impl_.faucet_value_ = value;
|
||||
_impl_.pre_mine_value_ = value;
|
||||
}
|
||||
|
||||
// uint64 max_script_byte_size = 18;
|
||||
@@ -5146,6 +5158,28 @@ inline void ConsensusConstants::_internal_set_tail_epoch_length(::uint64_t value
|
||||
_impl_.tail_epoch_length_ = value;
|
||||
}
|
||||
|
||||
// uint64 max_block_coinbase_count = 37;
|
||||
inline void ConsensusConstants::clear_max_block_coinbase_count() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
_impl_.max_block_coinbase_count_ = ::uint64_t{0u};
|
||||
}
|
||||
inline ::uint64_t ConsensusConstants::max_block_coinbase_count() const {
|
||||
// @@protoc_insertion_point(field_get:tari.rpc.ConsensusConstants.max_block_coinbase_count)
|
||||
return _internal_max_block_coinbase_count();
|
||||
}
|
||||
inline void ConsensusConstants::set_max_block_coinbase_count(::uint64_t value) {
|
||||
_internal_set_max_block_coinbase_count(value);
|
||||
// @@protoc_insertion_point(field_set:tari.rpc.ConsensusConstants.max_block_coinbase_count)
|
||||
}
|
||||
inline ::uint64_t ConsensusConstants::_internal_max_block_coinbase_count() const {
|
||||
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
|
||||
return _impl_.max_block_coinbase_count_;
|
||||
}
|
||||
inline void ConsensusConstants::_internal_set_max_block_coinbase_count(::uint64_t value) {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
_impl_.max_block_coinbase_count_ = value;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
+2
-1
@@ -124,7 +124,7 @@ message ConsensusConstants {
|
||||
uint64 block_weight_inputs = 14;
|
||||
uint64 block_weight_outputs = 15;
|
||||
uint64 block_weight_kernels = 16;
|
||||
uint64 faucet_value = 17;
|
||||
uint64 pre_mine_value = 17;
|
||||
uint64 max_script_byte_size = 18;
|
||||
uint64 validator_node_validity_period = 19;
|
||||
uint64 effective_from_height = 20;
|
||||
@@ -143,4 +143,5 @@ message ConsensusConstants {
|
||||
repeated PermittedRangeProofs permitted_range_proof_types = 34;
|
||||
uint64 inflation_bips = 35;
|
||||
uint64 tail_epoch_length = 36;
|
||||
uint64 max_block_coinbase_count = 37;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
Submodule external/src/cppzmq updated: 6164cf7dbc...a371495a91
Vendored
+1
-1
Submodule external/src/curl updated: fd567d4f06...06c37f3218
Vendored
+1
-1
Submodule external/src/grpc updated: f92105c06e...9ffeba31cf
Vendored
+1
-1
Submodule external/src/libuv updated: 17a39892af...012b1e9698
Vendored
+1
-1
Submodule external/src/libzmq updated: c2fae81460...8a20bd6132
Vendored
+1
-1
Submodule external/src/miniupnp updated: 943ba89358...7e28c9f8af
Vendored
+1
-1
Submodule external/src/rapidjson updated: 5eb4b2335a...43a1db7dba
@@ -0,0 +1,58 @@
|
||||
diff --git a/src/crypto/rand_extra/windows.c b/src/crypto/rand_extra/windows.c
|
||||
index a44774d23..09cf10942 100644
|
||||
--- a/src/crypto/rand_extra/windows.c
|
||||
+++ b/src/crypto/rand_extra/windows.c
|
||||
@@ -26,6 +26,7 @@
|
||||
OPENSSL_MSVC_PRAGMA(warning(push, 3))
|
||||
|
||||
#include <windows.h>
|
||||
+#include <wincrypt.h>
|
||||
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
|
||||
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
@@ -61,16 +62,40 @@ void CRYPTO_sysrand(uint8_t *out, size_t requested) {
|
||||
// See: https://learn.microsoft.com/en-us/windows/win32/seccng/processprng
|
||||
typedef BOOL (WINAPI *ProcessPrngFunction)(PBYTE pbData, SIZE_T cbData);
|
||||
static ProcessPrngFunction g_processprng_fn = NULL;
|
||||
+static HCRYPTPROV g_hCryptProv = NULL;
|
||||
+
|
||||
+static BOOL WINAPI wrapper_CryptGenRandom(PBYTE pbData, SIZE_T cbData)
|
||||
+{
|
||||
+ return CryptGenRandom(g_hCryptProv, cbData, pbData);
|
||||
+}
|
||||
|
||||
static void init_processprng(void) {
|
||||
HMODULE hmod = LoadLibraryW(L"bcryptprimitives");
|
||||
- if (hmod == NULL) {
|
||||
- abort();
|
||||
+
|
||||
+ if (hmod) {
|
||||
+ g_processprng_fn = (ProcessPrngFunction)GetProcAddress(hmod, "ProcessPrng");
|
||||
+ if (g_processprng_fn) {
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
- g_processprng_fn = (ProcessPrngFunction)GetProcAddress(hmod, "ProcessPrng");
|
||||
- if (g_processprng_fn == NULL) {
|
||||
- abort();
|
||||
+
|
||||
+ if (CryptAcquireContext(&g_hCryptProv, NULL, NULL, PROV_RSA_FULL, 0)) {
|
||||
+ g_processprng_fn = &wrapper_CryptGenRandom;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ DWORD err = GetLastError();
|
||||
+ if (err == NTE_BAD_KEYSET) {
|
||||
+ if (CryptAcquireContext(&g_hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
|
||||
+ g_processprng_fn = &wrapper_CryptGenRandom;
|
||||
+ return;
|
||||
+ }
|
||||
+ else {
|
||||
+ err = GetLastError();
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ abort();
|
||||
}
|
||||
|
||||
void CRYPTO_init_sysrand(void) {
|
||||
@@ -1,14 +0,0 @@
|
||||
diff --git a/typeinfo b/typeinfo
|
||||
index 4cce6cb..323fbc1 100644
|
||||
--- a/typeinfo
|
||||
+++ b/typeinfo
|
||||
@@ -189,6 +189,9 @@ namespace std
|
||||
#endif
|
||||
|
||||
#if __GXX_TYPEINFO_EQUALITY_INLINE || __cplusplus > 202002L
|
||||
+#ifdef __clang__
|
||||
+ __attribute__((always_inline))
|
||||
+#endif
|
||||
_GLIBCXX23_CONSTEXPR inline bool
|
||||
type_info::operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
+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;
|
||||
|
||||
|
||||
+11
-36
@@ -324,15 +324,9 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||
parallel_run(uv_default_loop_checked(), Precalc(m_shares, m_poolBlockTemplate->m_txkeySec));
|
||||
}
|
||||
|
||||
if (m_poolBlockTemplate->merge_mining_enabled()) {
|
||||
m_poolBlockTemplate->m_merkleTreeData = PoolBlock::encode_merkle_tree_data(static_cast<uint32_t>(data.aux_chains.size() + 1), data.aux_nonce);
|
||||
m_poolBlockTemplate->m_merkleTreeDataSize = 0;
|
||||
writeVarint(m_poolBlockTemplate->m_merkleTreeData, [this](uint8_t) { ++m_poolBlockTemplate->m_merkleTreeDataSize; });
|
||||
}
|
||||
else {
|
||||
m_poolBlockTemplate->m_merkleTreeData = 0;
|
||||
m_poolBlockTemplate->m_merkleTreeDataSize = 0;
|
||||
}
|
||||
m_poolBlockTemplate->m_merkleTreeData = PoolBlock::encode_merkle_tree_data(static_cast<uint32_t>(data.aux_chains.size() + 1), data.aux_nonce);
|
||||
m_poolBlockTemplate->m_merkleTreeDataSize = 0;
|
||||
writeVarint(m_poolBlockTemplate->m_merkleTreeData, [this](uint8_t) { ++m_poolBlockTemplate->m_merkleTreeDataSize; });
|
||||
|
||||
select_mempool_transactions(mempool);
|
||||
|
||||
@@ -615,14 +609,8 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||
m_poolBlockTemplate->m_sidechainId = {};
|
||||
m_poolBlockTemplate->m_merkleRoot = {};
|
||||
|
||||
if (m_poolBlockTemplate->merge_mining_enabled()) {
|
||||
m_poolBlockTemplate->m_auxChains = data.aux_chains;
|
||||
m_poolBlockTemplate->m_auxNonce = data.aux_nonce;
|
||||
}
|
||||
else {
|
||||
m_poolBlockTemplate->m_auxChains.clear();
|
||||
m_poolBlockTemplate->m_auxNonce = 0;
|
||||
}
|
||||
m_poolBlockTemplate->m_auxChains = data.aux_chains;
|
||||
m_poolBlockTemplate->m_auxNonce = data.aux_nonce;
|
||||
|
||||
init_merge_mining_merkle_proof();
|
||||
|
||||
@@ -663,10 +651,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||
}
|
||||
|
||||
if (pool_block_debug()) {
|
||||
const size_t merkle_root_offset =
|
||||
m_poolBlockTemplate->merge_mining_enabled()
|
||||
? (m_extraNonceOffsetInTemplate + m_poolBlockTemplate->m_extraNonceSize + 2 + m_poolBlockTemplate->m_merkleTreeDataSize)
|
||||
: (m_extraNonceOffsetInTemplate + m_poolBlockTemplate->m_extraNonceSize + 2);
|
||||
const size_t merkle_root_offset = m_extraNonceOffsetInTemplate + m_poolBlockTemplate->m_extraNonceSize + 2 + m_poolBlockTemplate->m_merkleTreeDataSize;
|
||||
|
||||
memcpy(m_blockTemplateBlob.data() + merkle_root_offset, m_poolBlockTemplate->m_merkleRoot.h, HASH_SIZE);
|
||||
memcpy(m_fullDataBlob.data() + merkle_root_offset, m_poolBlockTemplate->m_merkleRoot.h, HASH_SIZE);
|
||||
@@ -965,15 +950,9 @@ int BlockTemplate::create_miner_tx(const MinerData& data, const std::vector<Mine
|
||||
|
||||
m_minerTxExtra.push_back(TX_EXTRA_MERGE_MINING_TAG);
|
||||
|
||||
if (!m_poolBlockTemplate->merge_mining_enabled()) {
|
||||
m_minerTxExtra.push_back(HASH_SIZE);
|
||||
m_minerTxExtra.insert(m_minerTxExtra.end(), HASH_SIZE, 0);
|
||||
}
|
||||
else {
|
||||
m_minerTxExtra.push_back(static_cast<uint8_t>(m_poolBlockTemplate->m_merkleTreeDataSize + HASH_SIZE));
|
||||
writeVarint(m_poolBlockTemplate->m_merkleTreeData, m_minerTxExtra);
|
||||
m_minerTxExtra.insert(m_minerTxExtra.end(), HASH_SIZE, 0);
|
||||
}
|
||||
m_minerTxExtra.push_back(static_cast<uint8_t>(m_poolBlockTemplate->m_merkleTreeDataSize + HASH_SIZE));
|
||||
writeVarint(m_poolBlockTemplate->m_merkleTreeData, m_minerTxExtra);
|
||||
m_minerTxExtra.insert(m_minerTxExtra.end(), HASH_SIZE, 0);
|
||||
// TX_EXTRA end
|
||||
|
||||
writeVarint(m_minerTxExtra.size(), m_minerTx);
|
||||
@@ -1064,9 +1043,7 @@ hash BlockTemplate::calc_miner_tx_hash(uint32_t extra_nonce) const
|
||||
merge_mining_root = get_root_from_proof(sidechain_id, m_poolBlockTemplate->m_merkleProof, aux_slot, n_aux_chains);
|
||||
}
|
||||
|
||||
const size_t merkle_root_offset = m_poolBlockTemplate->merge_mining_enabled()
|
||||
? (extra_nonce_offset + m_poolBlockTemplate->m_extraNonceSize + 2 + m_poolBlockTemplate->m_merkleTreeDataSize)
|
||||
: (extra_nonce_offset + m_poolBlockTemplate->m_extraNonceSize + 2);
|
||||
const size_t merkle_root_offset = extra_nonce_offset + m_poolBlockTemplate->m_extraNonceSize + 2 + m_poolBlockTemplate->m_merkleTreeDataSize;
|
||||
|
||||
// 1. Prefix (everything except vin_rct_type byte in the end)
|
||||
// Apply extra_nonce in-place because we can't write to the block template here
|
||||
@@ -1416,9 +1393,7 @@ std::vector<uint8_t> BlockTemplate::get_block_template_blob(uint32_t template_id
|
||||
const uint32_t aux_slot = get_aux_slot(m_sidechain->consensus_hash(), m_poolBlockTemplate->m_auxNonce, n_aux_chains);
|
||||
merge_mining_root = get_root_from_proof(sidechain_id, m_poolBlockTemplate->m_merkleProof, aux_slot, n_aux_chains);
|
||||
|
||||
merkle_root_offset = m_poolBlockTemplate->merge_mining_enabled()
|
||||
? (m_extraNonceOffsetInTemplate + m_poolBlockTemplate->m_extraNonceSize + 2 + m_poolBlockTemplate->m_merkleTreeDataSize)
|
||||
: (m_extraNonceOffsetInTemplate + m_poolBlockTemplate->m_extraNonceSize + 2);
|
||||
merkle_root_offset = m_extraNonceOffsetInTemplate + m_poolBlockTemplate->m_extraNonceSize + 2 + m_poolBlockTemplate->m_merkleTreeDataSize;
|
||||
|
||||
*pThis = this;
|
||||
|
||||
|
||||
+8
-1
@@ -52,6 +52,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
@@ -92,7 +93,7 @@
|
||||
#define __has_feature(x) 0
|
||||
#endif
|
||||
|
||||
#if defined(_DEBUG) || defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) || defined(__SANITIZE_THREAD__) || __has_feature(thread_sanitizer)
|
||||
#if defined(_DEBUG) || defined(DEV_DEBUG) || defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) || defined(__SANITIZE_THREAD__) || __has_feature(thread_sanitizer)
|
||||
#define P2POOL_DEBUGGING 1
|
||||
#endif
|
||||
|
||||
@@ -500,4 +501,10 @@ extern const char* BLOCK_FOUND;
|
||||
} // namespace p2pool
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#ifdef DEBUG_BUILD
|
||||
#undef FORCEINLINE
|
||||
#define FORCEINLINE NOINLINE
|
||||
#endif
|
||||
|
||||
#include "log.h"
|
||||
|
||||
@@ -85,9 +85,10 @@ ConsoleCommands::ConsoleCommands(p2pool* pool)
|
||||
}
|
||||
|
||||
std::random_device rd;
|
||||
std::mt19937_64 rng(rd());
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
if (start_listening(false, "127.0.0.1", 49152 + (rd() % 16384))) {
|
||||
if (start_listening(false, "127.0.0.1", 49152 + (rng() % 16384))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -209,7 +210,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 +314,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 +359,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,9 +40,9 @@ 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] = {};
|
||||
alignas(8) char m_consoleReadBuf[1024] = {};
|
||||
|
||||
std::string m_command;
|
||||
};
|
||||
@@ -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
|
||||
|
||||
+16
-9
@@ -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));
|
||||
|
||||
@@ -153,8 +151,7 @@ static FORCEINLINE void derivation_to_scalar(const hash& derivation, size_t outp
|
||||
uint8_t* p = buf.output_index;
|
||||
writeVarint(output_index, [&p](uint8_t b) { *(p++) = b; });
|
||||
|
||||
const uint8_t* data = buf.derivation;
|
||||
hash_to_scalar(data, static_cast<int>(p - data), res);
|
||||
hash_to_scalar(buf.derivation, static_cast<int>(sizeof(buf.derivation) + (p - buf.output_index)), res);
|
||||
}
|
||||
|
||||
class Cache : public nocopy_nomove
|
||||
@@ -472,6 +469,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 +480,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-4
@@ -38,10 +38,14 @@ struct parse_wrapper<T, out_type> \
|
||||
{ \
|
||||
static FORCEINLINE bool parse(T& v, const char* name, out_type& out_value) \
|
||||
{ \
|
||||
if (v.IsObject() && v.HasMember(name)) { \
|
||||
const auto& t = v[name]; \
|
||||
if (t.Is##type()) { \
|
||||
out_value = static_cast<out_type>(t.Get##type()); \
|
||||
if (!v.IsObject()) { \
|
||||
return false; \
|
||||
} \
|
||||
const auto t = v.FindMember(name); \
|
||||
if (t != v.MemberEnd()) { \
|
||||
const auto& value = t->value; \
|
||||
if (value.Is##type()) { \
|
||||
out_value = static_cast<out_type>(value.Get##type()); \
|
||||
return true; \
|
||||
} \
|
||||
} \
|
||||
|
||||
+38
-40
@@ -27,7 +27,7 @@ namespace JSONRPCRequest {
|
||||
|
||||
struct CurlContext
|
||||
{
|
||||
CurlContext(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop);
|
||||
CurlContext(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop);
|
||||
~CurlContext();
|
||||
|
||||
static int socket_func(CURL* easy, curl_socket_t s, int action, void* userp, void* socketp)
|
||||
@@ -67,7 +67,6 @@ struct CurlContext
|
||||
|
||||
uv_loop_t* m_loop;
|
||||
uv_timer_t m_timer;
|
||||
uv_async_t m_async;
|
||||
CURLM* m_multiHandle;
|
||||
CURL* m_handle;
|
||||
|
||||
@@ -83,12 +82,11 @@ struct CurlContext
|
||||
uint64_t m_connectedTime;
|
||||
};
|
||||
|
||||
CurlContext::CurlContext(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop)
|
||||
CurlContext::CurlContext(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop)
|
||||
: m_callback(cb)
|
||||
, m_closeCallback(close_cb)
|
||||
, m_loop(loop)
|
||||
, m_timer{}
|
||||
, m_async{}
|
||||
, m_multiHandle(nullptr)
|
||||
, m_handle(nullptr)
|
||||
, m_req(req)
|
||||
@@ -102,8 +100,19 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
|
||||
char buf[log::Stream::BUF_SIZE + 1];
|
||||
buf[0] = '\0';
|
||||
|
||||
const char* protocol = "http://";
|
||||
|
||||
#ifdef WITH_TLS
|
||||
if (ssl) {
|
||||
protocol = "https://";
|
||||
}
|
||||
#else
|
||||
(void)ssl;
|
||||
(void)ssl_fingerprint;
|
||||
#endif
|
||||
|
||||
log::Stream s(buf);
|
||||
s << "http://" << address << ':' << port;
|
||||
s << protocol << address << ':' << port;
|
||||
|
||||
if (!m_req.empty() && (m_req.front() == '/')) {
|
||||
s << m_req.c_str() << '\0';
|
||||
@@ -123,19 +132,10 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
|
||||
}
|
||||
m_timer.data = this;
|
||||
|
||||
err = uv_async_init(m_loop, &m_async, reinterpret_cast<uv_async_cb>(on_timeout));
|
||||
if (err) {
|
||||
LOGERR(1, "uv_async_init failed, error " << uv_err_name(err));
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&m_timer), nullptr);
|
||||
throw std::runtime_error("uv_async_init failed");
|
||||
}
|
||||
m_async.data = this;
|
||||
|
||||
m_multiHandle = curl_multi_init();
|
||||
if (!m_multiHandle) {
|
||||
static constexpr char msg[] = "curl_multi_init() failed";
|
||||
LOGERR(1, msg);
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&m_async), nullptr);
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&m_timer), nullptr);
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
@@ -161,7 +161,6 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
|
||||
static constexpr char msg[] = "curl_easy_init() failed";
|
||||
LOGERR(1, msg);
|
||||
curl_multi_cleanup(m_multiHandle);
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&m_async), nullptr);
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&m_timer), nullptr);
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
@@ -212,12 +211,25 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_TLS
|
||||
curl_easy_setopt_checked(m_handle, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
curl_easy_setopt_checked(m_handle, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
|
||||
if (!ssl_fingerprint.empty()) {
|
||||
char buf[64] = {};
|
||||
|
||||
log::Stream s(buf);
|
||||
s << "sha256//" << ssl_fingerprint;
|
||||
|
||||
curl_easy_setopt_checked(m_handle, CURLOPT_PINNEDPUBLICKEY, buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
CURLMcode curl_err = curl_multi_add_handle(m_multiHandle, m_handle);
|
||||
if (curl_err != CURLM_OK) {
|
||||
LOGERR(1, "curl_multi_add_handle failed, error " << curl_multi_strerror(curl_err));
|
||||
LOGERR(1, "curl_multi_add_handle failed: " << curl_multi_strerror(curl_err));
|
||||
curl_easy_cleanup(m_handle);
|
||||
curl_multi_cleanup(m_multiHandle);
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&m_async), nullptr);
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&m_timer), nullptr);
|
||||
throw std::runtime_error("curl_multi_add_handle failed");
|
||||
}
|
||||
@@ -333,20 +345,6 @@ int CurlContext::on_timer(CURLM* /*multi*/, long timeout_ms)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((timeout_ms == 0) && !uv_is_closing(reinterpret_cast<uv_handle_t*>(&m_async))) {
|
||||
// 0 ms timeout, but we can't just call on_timeout() here - we have to kick the UV loop
|
||||
const int result = uv_async_send(&m_async);
|
||||
if (result < 0) {
|
||||
LOGERR(1, "uv_async_send failed with error " << uv_err_name(result));
|
||||
|
||||
// if async call didn't work, try to use the timer with 1 ms timeout
|
||||
timeout_ms = 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
const int result = uv_timer_start(&m_timer, reinterpret_cast<uv_timer_cb>(on_timeout), timeout_ms, 0);
|
||||
if (result < 0) {
|
||||
LOGERR(1, "uv_timer_start failed with error " << uv_err_name(result));
|
||||
@@ -363,7 +361,7 @@ void CurlContext::on_timeout(uv_handle_t* req)
|
||||
int running_handles = 0;
|
||||
const CURLMcode err = curl_multi_socket_action(ctx->m_multiHandle, CURL_SOCKET_TIMEOUT, 0, &running_handles);
|
||||
if (err != CURLM_OK) {
|
||||
LOGERR(1, "curl_multi_socket_action failed, error " << curl_multi_strerror(err));
|
||||
LOGERR(1, "curl_multi_socket_action failed: " << curl_multi_strerror(err));
|
||||
}
|
||||
|
||||
ctx->check_multi_info();
|
||||
@@ -409,7 +407,7 @@ void CurlContext::curl_perform(uv_poll_t* req, int status, int events)
|
||||
if (it != ctx->m_pollHandles.end()) {
|
||||
const CURLMcode err = curl_multi_socket_action(ctx->m_multiHandle, it->first, flags, &running_handles);
|
||||
if (err != CURLM_OK) {
|
||||
LOGERR(1, "curl_multi_socket_action failed, error " << curl_multi_strerror(err));
|
||||
LOGERR(1, "curl_multi_socket_action failed: " << curl_multi_strerror(err));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,7 +454,7 @@ void CurlContext::on_close(uv_handle_t* h)
|
||||
CurlContext* ctx = reinterpret_cast<CurlContext*>(h->data);
|
||||
h->data = nullptr;
|
||||
|
||||
if (ctx->m_timer.data || ctx->m_async.data) {
|
||||
if (ctx->m_timer.data) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -471,16 +469,12 @@ void CurlContext::shutdown()
|
||||
}
|
||||
m_pollHandles.clear();
|
||||
|
||||
if (m_async.data && !uv_is_closing(reinterpret_cast<uv_handle_t*>(&m_async))) {
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&m_async), on_close);
|
||||
}
|
||||
|
||||
if (m_timer.data && !uv_is_closing(reinterpret_cast<uv_handle_t*>(&m_timer))) {
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&m_timer), on_close);
|
||||
}
|
||||
}
|
||||
|
||||
void Call(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop)
|
||||
void Call(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop)
|
||||
{
|
||||
if (!loop) {
|
||||
loop = uv_default_loop();
|
||||
@@ -490,11 +484,13 @@ void Call(const std::string& address, int port, const std::string& req, const st
|
||||
[=]()
|
||||
{
|
||||
try {
|
||||
new CurlContext(address, port, req, auth, proxy, cb, close_cb, loop);
|
||||
new CurlContext(address, port, req, auth, proxy, ssl, ssl_fingerprint, cb, close_cb, loop);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
const char* msg = e.what();
|
||||
(*close_cb)(msg, strlen(msg), 0.0);
|
||||
delete cb;
|
||||
delete close_cb;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -502,6 +498,8 @@ void Call(const std::string& address, int port, const std::string& req, const st
|
||||
static constexpr char err[] = "CallOnLoop failed";
|
||||
LOGERR(1, err);
|
||||
(*close_cb)(err, sizeof(err) - 1, 0.0);
|
||||
delete cb;
|
||||
delete close_cb;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,15 +22,15 @@ namespace JSONRPCRequest {
|
||||
|
||||
typedef Callback<void, const char*, size_t, double>::Base CallbackBase;
|
||||
|
||||
void Call(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop);
|
||||
void Call(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop);
|
||||
|
||||
template<typename T, typename U>
|
||||
FORCEINLINE void call(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, T&& cb, U&& close_cb, uv_loop_t* loop = nullptr)
|
||||
FORCEINLINE void call(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, T&& cb, U&& close_cb, uv_loop_t* loop = nullptr)
|
||||
{
|
||||
typedef Callback<void, const char*, size_t, double>::Derived<T> CallbackT;
|
||||
typedef Callback<void, const char*, size_t, double>::Derived<U> CallbackU;
|
||||
|
||||
Call(address, port, req, auth, proxy, new CallbackT(std::move(cb)), new CallbackU(std::move(close_cb)), loop);
|
||||
Call(address, port, req, auth, proxy, ssl, ssl_fingerprint, new CallbackT(std::move(cb)), new CallbackU(std::move(close_cb)), loop);
|
||||
}
|
||||
|
||||
} // namespace JSONRPCRequest
|
||||
|
||||
+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);
|
||||
|
||||
+38
-43
@@ -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,8 @@ private:
|
||||
|
||||
NOINLINE void run()
|
||||
{
|
||||
m_started.exchange(true);
|
||||
|
||||
set_thread_name("Logger");
|
||||
|
||||
do {
|
||||
uv_mutex_lock(&m_mutex);
|
||||
if (m_readPos == m_writePos.load()) {
|
||||
@@ -346,9 +329,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,19 +369,19 @@ private:
|
||||
|
||||
std::vector<char> m_buf;
|
||||
std::atomic<uint32_t> m_writePos;
|
||||
uint32_t m_readPos;
|
||||
std::atomic<uint32_t> m_readPos;
|
||||
|
||||
uv_cond_t m_cond;
|
||||
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 +428,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();
|
||||
|
||||
|
||||
+107
-40
@@ -21,50 +21,67 @@
|
||||
#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"
|
||||
"\nUsage:\n\n" \
|
||||
"--wallet Wallet address to mine to. Subaddresses and integrated addresses are not supported!\n"
|
||||
"--host IP address of your Monero node, default is 127.0.0.1\n"
|
||||
"--rpc-port monerod RPC API port number, default is 18081\n"
|
||||
"--zmq-port monerod ZMQ pub port number, default is 18083 (same port as in monerod's \"--zmq-pub\" command line parameter)\n"
|
||||
"--stratum Comma-separated list of IP:port for stratum server to listen on\n"
|
||||
"--p2p Comma-separated list of IP:port for p2p server to listen on\n"
|
||||
"--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"
|
||||
"--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"
|
||||
"--no-color Disable colors in console output\n"
|
||||
"--wallet Wallet address to mine to. Subaddresses and integrated addresses are not supported!\n"
|
||||
"--host IP address of your Monero node, default is 127.0.0.1\n"
|
||||
"--rpc-port monerod RPC API port number, default is 18081\n"
|
||||
"--zmq-port monerod ZMQ pub port number, default is 18083 (same port as in monerod's \"--zmq-pub\" command line parameter)\n"
|
||||
"--stratum Comma-separated list of IP:port for stratum server to listen on\n"
|
||||
"--p2p Comma-separated list of IP:port for p2p server to listen on\n"
|
||||
"--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"
|
||||
"--data-dir Path to store general p2pool files (log, cache, peer data, etc.), default is current directory\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"
|
||||
"--no-color Disable colors in console output\n"
|
||||
#ifdef WITH_RANDOMX
|
||||
"--no-randomx Disable internal RandomX hasher: p2pool will use RPC calls to monerod to check PoW hashes\n"
|
||||
"--no-randomx Disable internal RandomX hasher: p2pool will use RPC calls to monerod to check PoW hashes\n"
|
||||
#endif
|
||||
"--out-peers N Maximum number of outgoing connections for p2p server (any value between 10 and 450)\n"
|
||||
"--in-peers N Maximum number of incoming connections for p2p server (any value between 10 and 450)\n"
|
||||
"--start-mining N Start built-in miner using N threads (any value between 1 and 64)\n"
|
||||
"--mini Connect to p2pool-mini sidechain. Note that it will also change default p2p port from %d to %d\n"
|
||||
"--no-autodiff Disable automatic difficulty adjustment for miners connected to stratum (WARNING: incompatible with Nicehash and MRR)\n"
|
||||
"--rpc-login Specify username[:password] required for Monero RPC server\n"
|
||||
"--socks5 Specify IP:port of a SOCKS5 proxy to use for outgoing connections\n"
|
||||
"--no-dns Disable DNS queries, use only IP addresses to connect to peers (seed node DNS will be unavailable too)\n"
|
||||
"--p2p-external-port Port number that your router uses for mapping to your local p2p port. Use it if you are behind a NAT and still want to accept incoming connections\n"
|
||||
"--out-peers N Maximum number of outgoing connections for p2p server (any value between 10 and 450)\n"
|
||||
"--in-peers N Maximum number of incoming connections for p2p server (any value between 10 and 450)\n"
|
||||
"--start-mining N Start built-in miner using N threads (any value between 1 and 64)\n"
|
||||
"--mini Connect to p2pool-mini sidechain. Note that it will also change default p2p port from %d to %d\n"
|
||||
"--no-autodiff Disable automatic difficulty adjustment for miners connected to stratum (WARNING: incompatible with Nicehash and MRR)\n"
|
||||
"--rpc-login Specify username[:password] required for Monero RPC server\n"
|
||||
"--socks5 Specify IP:port of a SOCKS5 proxy to use for outgoing connections\n"
|
||||
"--no-dns Disable DNS queries, use only IP addresses to connect to peers (seed node DNS will be unavailable too)\n"
|
||||
"--p2p-external-port Port number that your router uses for mapping to your local p2p port. Use it if you are behind a NAT and still want to accept incoming connections\n"
|
||||
#ifdef WITH_UPNP
|
||||
"--no-upnp Disable UPnP port forwarding\n"
|
||||
"--no-igd An alias for --no-upnp\n"
|
||||
"--upnp-stratum Port forward Stratum port (it's not forwarded by default)\n"
|
||||
"--no-upnp Disable UPnP port forwarding\n"
|
||||
"--no-igd An alias for --no-upnp\n"
|
||||
"--upnp-stratum Port forward Stratum port (it's not forwarded by default)\n"
|
||||
#endif
|
||||
"--merge-mine IP:port and wallet address for another blockchain to merge mine with\n"
|
||||
"--version Print p2pool's version and build details\n"
|
||||
"--help Show this help message\n\n"
|
||||
"--merge-mine IP:port and wallet address for another blockchain to merge mine with\n"
|
||||
"--version Print p2pool's version and build details\n"
|
||||
#ifdef WITH_TLS
|
||||
"--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"
|
||||
"--rpc-ssl Enable SSL on RPC connections to the Monero node\n"
|
||||
"--rpc-ssl-fingerprint base64-encoded fingerprint of the Monero node's certificate (optional, use it for certificate pinning)\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",
|
||||
p2pool::VERSION,
|
||||
@@ -94,17 +111,23 @@ int p2pool_test()
|
||||
char hash[RANDOMX_HASH_SIZE];
|
||||
|
||||
const randomx_flags flags = randomx_get_flags() | RANDOMX_FLAG_FULL_MEM;
|
||||
randomx_cache* myCache = randomx_alloc_cache(flags);
|
||||
randomx_cache* myCache = randomx_alloc_cache(flags | RANDOMX_FLAG_LARGE_PAGES);
|
||||
if (!myCache) {
|
||||
printf("Cache allocation failed\n");
|
||||
return 1;
|
||||
myCache = randomx_alloc_cache(flags);
|
||||
if (!myCache) {
|
||||
printf("Cache allocation failed\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
randomx_init_cache(myCache, myKey, sizeof(myKey) - 1);
|
||||
|
||||
randomx_dataset* myDataset = randomx_alloc_dataset(flags);
|
||||
randomx_dataset* myDataset = randomx_alloc_dataset(flags | RANDOMX_FLAG_LARGE_PAGES);
|
||||
if (!myDataset) {
|
||||
printf("Dataset allocation failed\n");
|
||||
return 1;
|
||||
myDataset = randomx_alloc_dataset(flags);
|
||||
if (!myDataset) {
|
||||
printf("Dataset allocation failed\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
@@ -129,10 +152,13 @@ int p2pool_test()
|
||||
|
||||
randomx_release_cache(myCache);
|
||||
|
||||
randomx_vm* myMachine = randomx_create_vm(flags, nullptr, myDataset);
|
||||
randomx_vm* myMachine = randomx_create_vm(flags | RANDOMX_FLAG_LARGE_PAGES, nullptr, myDataset);
|
||||
if (!myMachine) {
|
||||
printf("Failed to create a virtual machine");
|
||||
return 1;
|
||||
myMachine = randomx_create_vm(flags, nullptr, myDataset);
|
||||
if (!myMachine) {
|
||||
printf("Failed to create a virtual machine");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
memset(hash, 0, sizeof(hash));
|
||||
@@ -182,10 +208,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));
|
||||
@@ -205,9 +260,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) {
|
||||
@@ -137,6 +139,28 @@ void show_top_10_allocations()
|
||||
VirtualFree(buf, 0, MEM_RELEASE);
|
||||
}
|
||||
|
||||
static DWORD WINAPI minidump_and_crash_thread(LPVOID param)
|
||||
{
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||
|
||||
const size_t delay = reinterpret_cast<size_t>(param);
|
||||
Sleep(static_cast<DWORD>(delay));
|
||||
|
||||
HANDLE h = CreateFile(TEXT("p2pool.dmp"), GENERIC_ALL, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), h, MiniDumpWithHandleData, nullptr, nullptr, nullptr);
|
||||
CloseHandle(h);
|
||||
|
||||
TerminateProcess(GetCurrentProcess(), 123);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void minidump_and_crash(size_t delay)
|
||||
{
|
||||
HANDLE h = CreateThread(nullptr, 0, minidump_and_crash_thread, reinterpret_cast<LPVOID>(delay), 0, nullptr);
|
||||
CloseHandle(h);
|
||||
}
|
||||
|
||||
FORCEINLINE static void add_alocation(void* p, size_t size)
|
||||
{
|
||||
if (!track_memory) {
|
||||
@@ -151,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) {
|
||||
@@ -182,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;
|
||||
|
||||
@@ -270,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;
|
||||
}
|
||||
|
||||
@@ -282,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)
|
||||
|
||||
@@ -100,6 +100,10 @@ MergeMiningClientJSON_RPC::~MergeMiningClientJSON_RPC()
|
||||
|
||||
void MergeMiningClientJSON_RPC::on_timer()
|
||||
{
|
||||
if (m_pool->stopped()) {
|
||||
return;
|
||||
}
|
||||
|
||||
MinerData data = m_pool->miner_data();
|
||||
merge_mining_get_aux_block(data.height, data.prev_id, m_auxWallet);
|
||||
}
|
||||
@@ -108,7 +112,7 @@ void MergeMiningClientJSON_RPC::merge_mining_get_chain_id()
|
||||
{
|
||||
const std::string req = "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"merge_mining_get_chain_id\"}";
|
||||
|
||||
JSONRPCRequest::call(m_host, m_port, req, std::string(), m_pool->params().m_socks5Proxy,
|
||||
JSONRPCRequest::call(m_host, m_port, req, std::string(), m_pool->params().m_socks5Proxy, false, std::string(),
|
||||
[this](const char* data, size_t size, double ping) {
|
||||
WriteLock lock(m_lock);
|
||||
|
||||
@@ -197,7 +201,7 @@ void MergeMiningClientJSON_RPC::merge_mining_get_aux_block(uint64_t height, cons
|
||||
<< ",\"prev_id\":\"" << prev_id << '"'
|
||||
<< "}}";
|
||||
|
||||
JSONRPCRequest::call(m_host, m_port, std::string(buf, s.m_pos), std::string(), m_pool->params().m_socks5Proxy,
|
||||
JSONRPCRequest::call(m_host, m_port, std::string(buf, s.m_pos), std::string(), m_pool->params().m_socks5Proxy, false, std::string(),
|
||||
[this](const char* data, size_t size, double) {
|
||||
bool changed = false;
|
||||
hash chain_id;
|
||||
@@ -297,7 +301,7 @@ void MergeMiningClientJSON_RPC::submit_solution(const BlockTemplate* /*block_tpl
|
||||
<< ",\"merkle_proof\":[";
|
||||
|
||||
for (size_t i = 0, n = merkle_proof.size(); i < n; ++i) {
|
||||
if (i > 0) {
|
||||
if (i != 0) {
|
||||
s << ',';
|
||||
}
|
||||
s << '"' << merkle_proof[i] << '"';
|
||||
@@ -306,7 +310,7 @@ void MergeMiningClientJSON_RPC::submit_solution(const BlockTemplate* /*block_tpl
|
||||
s << "],\"path\":" << merkle_proof_path
|
||||
<< ",\"seed_hash\":\"" << seed_hash << "\"}}";
|
||||
|
||||
JSONRPCRequest::call(m_host, m_port, std::string(buf.data(), s.m_pos), std::string(), m_pool->params().m_socks5Proxy,
|
||||
JSONRPCRequest::call(m_host, m_port, std::string(buf.data(), s.m_pos), std::string(), m_pool->params().m_socks5Proxy, false, std::string(),
|
||||
[this](const char* data, size_t size, double) {
|
||||
parse_merge_mining_submit_solution(data, size);
|
||||
},
|
||||
@@ -400,6 +404,8 @@ void MergeMiningClientJSON_RPC::loop(void* data)
|
||||
{
|
||||
LOGINFO(1, "event loop started");
|
||||
|
||||
set_thread_name("MM JSON RPC");
|
||||
|
||||
MergeMiningClientJSON_RPC* client = static_cast<MergeMiningClientJSON_RPC*>(data);
|
||||
|
||||
int err = uv_run(&client->m_loop, UV_RUN_DEFAULT);
|
||||
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&client->m_shutdownAsync), nullptr);
|
||||
|
||||
delete GetLoopUserData(&client->m_loop, false);
|
||||
DeleteLoopUserData(&client->m_loop);
|
||||
}
|
||||
|
||||
void on_shutdown();
|
||||
|
||||
@@ -334,6 +334,8 @@ void MergeMiningClientTari::run()
|
||||
{
|
||||
LOGINFO(1, "worker thread ready");
|
||||
|
||||
set_thread_name("MM Tari poll");
|
||||
|
||||
using namespace std::chrono;
|
||||
|
||||
for (;;) {
|
||||
@@ -451,9 +453,10 @@ MergeMiningClientTari::TariServer::TariServer(const std::string& socks5Proxy)
|
||||
bool MergeMiningClientTari::TariServer::start()
|
||||
{
|
||||
std::random_device rd;
|
||||
std::mt19937_64 rng(rd());
|
||||
|
||||
for (size_t i = 0; i < 10; ++i) {
|
||||
if (start_listening(false, "127.0.0.1", 49152 + (rd() % 16384))) {
|
||||
if (start_listening(false, "127.0.0.1", 49152 + (rng() % 16384))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -574,7 +577,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,9 +98,9 @@ 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];
|
||||
alignas(8) char m_buf[BUF_SIZE];
|
||||
std::vector<uint8_t> m_pendingData;
|
||||
|
||||
bool is_paired() const { return m_pairedClient && (m_pairedClient->m_resetCounter == m_pairedClientSavedResetCounter); }
|
||||
|
||||
@@ -152,8 +152,16 @@ void Miner::run(void* data)
|
||||
{
|
||||
WorkerData* d = static_cast<WorkerData*>(data);
|
||||
LOGINFO(1, "worker thread " << d->m_index << '/' << d->m_count << " started");
|
||||
|
||||
char buf[16] = {};
|
||||
log::Stream s(buf);
|
||||
s << "Miner " << d->m_index << '/' << d->m_count;
|
||||
|
||||
set_thread_name(buf);
|
||||
|
||||
make_thread_background();
|
||||
d->m_miner->run(d);
|
||||
|
||||
LOGINFO(1, "worker thread " << d->m_index << '/' << d->m_count << " stopped");
|
||||
}
|
||||
|
||||
|
||||
+27
-16
@@ -27,7 +27,8 @@
|
||||
#include "json_parsers.h"
|
||||
#include "block_template.h"
|
||||
#include "p2pool_api.h"
|
||||
#include <rapidjson/document.h>
|
||||
#include "stratum_server.h"
|
||||
#include "rapidjson_wrapper.h"
|
||||
#include <fstream>
|
||||
#include <numeric>
|
||||
|
||||
@@ -56,6 +57,7 @@ P2PServer::P2PServer(p2pool* pool)
|
||||
, m_timer{}
|
||||
, m_timerCounter(0)
|
||||
, m_timerInterval(2)
|
||||
, m_seenGoodPeers(false)
|
||||
, m_peerListLastSaved(0)
|
||||
, m_lookForMissingBlocks(true)
|
||||
, m_fastestPeer(nullptr)
|
||||
@@ -329,7 +331,10 @@ void P2PServer::update_peer_connections()
|
||||
uint32_t N = m_maxOutgoingPeers;
|
||||
|
||||
// Special case: when we can't find p2pool peers, scan through monerod peers (try 25 peers at a time)
|
||||
if (!has_good_peers && !m_peerListMonero.empty()) {
|
||||
if (has_good_peers) {
|
||||
m_seenGoodPeers = true;
|
||||
}
|
||||
else if (!m_peerListMonero.empty()) {
|
||||
LOGINFO(3, "Scanning monerod peers, " << m_peerListMonero.size() << " left");
|
||||
for (uint32_t i = 0; (i < 25) && !m_peerListMonero.empty(); ++i) {
|
||||
peer_list.push_back(m_peerListMonero.back());
|
||||
@@ -360,6 +365,13 @@ void P2PServer::update_peer_connections()
|
||||
load_monerod_peer_list();
|
||||
}
|
||||
}
|
||||
|
||||
if (disconnected()) {
|
||||
StratumServer* stratum_server = m_pool->stratum_server();
|
||||
if (stratum_server) {
|
||||
stratum_server->drop_connections_async();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void P2PServer::update_peer_list()
|
||||
@@ -435,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");
|
||||
LOGERR(1, "failed to save peer list " << path << ": error " << errno);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -567,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()) {
|
||||
@@ -622,7 +638,7 @@ void P2PServer::load_monerod_peer_list()
|
||||
{
|
||||
const Params::Host& host = m_pool->current_host();
|
||||
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "/get_peer_list", host.m_rpcLogin, m_socks5Proxy,
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "/get_peer_list", host.m_rpcLogin, m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
[this](const char* data, size_t size, double)
|
||||
{
|
||||
#define ERR_STR "/get_peer_list RPC request returned invalid JSON "
|
||||
@@ -805,10 +821,7 @@ void P2PServer::broadcast(const PoolBlock& block, const PoolBlock* parent)
|
||||
writeVarint(total_reward, data->pruned_blob);
|
||||
writeVarint(outputs_blob_size, data->pruned_blob);
|
||||
|
||||
if (block.merge_mining_enabled()) {
|
||||
data->pruned_blob.insert(data->pruned_blob.end(), block.m_sidechainId.h, block.m_sidechainId.h + HASH_SIZE);
|
||||
}
|
||||
|
||||
data->pruned_blob.insert(data->pruned_blob.end(), block.m_sidechainId.h, block.m_sidechainId.h + HASH_SIZE);
|
||||
data->pruned_blob.insert(data->pruned_blob.end(), mainchain_data.begin() + outputs_offset + outputs_blob_size, mainchain_data.end());
|
||||
|
||||
const size_t N = block.m_transactions.size();
|
||||
@@ -1412,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()) << '}';
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1487,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) {
|
||||
@@ -1931,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];
|
||||
|
||||
+6
-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); }
|
||||
@@ -186,6 +186,8 @@ public:
|
||||
|
||||
void check_for_updates(bool forced = false) const;
|
||||
|
||||
bool disconnected() const { return m_seenGoodPeers && (m_numConnections == 0); };
|
||||
|
||||
private:
|
||||
[[nodiscard]] const char* get_log_category() const override;
|
||||
|
||||
@@ -244,6 +246,7 @@ private:
|
||||
uint64_t m_lastSeen;
|
||||
};
|
||||
|
||||
std::atomic<bool> m_seenGoodPeers;
|
||||
std::vector<Peer> m_peerList;
|
||||
std::vector<Peer> m_peerListMonero;
|
||||
std::atomic<uint64_t> m_peerListLastSaved;
|
||||
|
||||
+102
-46
@@ -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();
|
||||
|
||||
@@ -204,13 +208,14 @@ p2pool::~p2pool()
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<IMergeMiningClient*> merge_mining_clients;
|
||||
{
|
||||
WriteLock lock(m_mergeMiningClientsLock);
|
||||
merge_mining_clients.swap(m_mergeMiningClients);
|
||||
}
|
||||
|
||||
for (const IMergeMiningClient* c : m_mergeMiningClients) {
|
||||
delete c;
|
||||
}
|
||||
m_mergeMiningClients.clear();
|
||||
for (const IMergeMiningClient* c : merge_mining_clients) {
|
||||
delete c;
|
||||
}
|
||||
|
||||
uv_rwlock_destroy(&m_mainchainLock);
|
||||
@@ -231,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)
|
||||
@@ -420,24 +436,41 @@ 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";
|
||||
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy,
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
[this, h](const char* data, size_t size, double)
|
||||
{
|
||||
ChainMain block;
|
||||
@@ -520,7 +553,7 @@ void p2pool::handle_chain_main(ChainMain& data, const char* extra)
|
||||
LOGINFO(0, log::LightCyan() << "Your wallet " << log::LightYellow() << w << log::LightCyan() << " didn't get a payout in block " << log::LightYellow() << data.height << log::LightCyan() << " because you had no shares in PPLNS window");
|
||||
}
|
||||
|
||||
api_update_block_found(&data, block);
|
||||
api_update_block_found(&data, block, false);
|
||||
}
|
||||
else {
|
||||
side_chain().watch_mainchain_block(data, merkle_root);
|
||||
@@ -534,6 +567,10 @@ void p2pool::handle_chain_main(ChainMain& data, const char* extra)
|
||||
|
||||
void p2pool::update_aux_data(const hash& chain_id)
|
||||
{
|
||||
if (m_stopped) {
|
||||
return;
|
||||
}
|
||||
|
||||
MinerData data;
|
||||
std::vector<hash> aux_id;
|
||||
|
||||
@@ -545,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());
|
||||
@@ -653,7 +690,7 @@ void p2pool::submit_aux_block_async(const std::vector<SubmitAuxBlockData>& aux_b
|
||||
|
||||
// If p2pool is stopped, m_submitAuxBlockAsync is most likely already closed
|
||||
if (m_stopped) {
|
||||
LOGWARN(0, "p2pool is shutting down, but a block was found. Trying to submit it anyway!");
|
||||
LOGWARN(0, "p2pool is shutting down, but an aux block was found. Trying to submit it anyway!");
|
||||
submit_aux_block();
|
||||
return;
|
||||
}
|
||||
@@ -764,9 +801,7 @@ void p2pool::on_stop(uv_async_t* async)
|
||||
|
||||
init_signals(pool, false);
|
||||
|
||||
uv_loop_t* loop = uv_default_loop_checked();
|
||||
delete GetLoopUserData(loop, false);
|
||||
loop->data = nullptr;
|
||||
DeleteLoopUserData(uv_default_loop_checked());
|
||||
}
|
||||
|
||||
void p2pool::submit_block() const
|
||||
@@ -839,7 +874,7 @@ void p2pool::submit_block() const
|
||||
|
||||
const Params::Host& host = current_host();
|
||||
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, request, host.m_rpcLogin, m_params->m_socks5Proxy,
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, request, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
[height, diff, template_id, nonce, extra_nonce, merge_mining_root, is_external](const char* data, size_t size, double)
|
||||
{
|
||||
rapidjson::Document doc;
|
||||
@@ -958,7 +993,7 @@ void p2pool::download_block_headers(uint64_t current_height)
|
||||
s.m_pos = 0;
|
||||
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_header_by_height\",\"params\":{\"height\":" << height << "}}\0";
|
||||
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy,
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
[this, prev_seed_height, height](const char* data, size_t size, double)
|
||||
{
|
||||
ChainMain block;
|
||||
@@ -987,14 +1022,14 @@ void p2pool::download_block_headers(uint64_t current_height)
|
||||
s.m_pos = 0;
|
||||
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_headers_range\",\"params\":{\"start_height\":" << start_height << ",\"end_height\":" << current_height - 1 << "}}\0";
|
||||
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy,
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
[this, start_height, current_height, host](const char* data, size_t size, double)
|
||||
{
|
||||
if (parse_block_headers_range(data, size) == current_height - start_height) {
|
||||
update_median_timestamp();
|
||||
if (m_serversStarted.exchange(1) == 0) {
|
||||
m_stratumServer = new StratumServer(this);
|
||||
m_p2pServer = new P2PServer(this);
|
||||
m_stratumServer = new StratumServer(this);
|
||||
#ifdef WITH_RANDOMX
|
||||
if (m_params->m_minerThreads) {
|
||||
start_mining(m_params->m_minerThreads);
|
||||
@@ -1020,23 +1055,24 @@ void p2pool::download_block_headers(uint64_t current_height)
|
||||
for (const Params::Host& h : m_params->m_hosts) {
|
||||
const std::string& name = h.m_displayName;
|
||||
if (name != host.m_displayName) {
|
||||
JSONRPCRequest::call(h.m_address, h.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_version\"}", h.m_rpcLogin, m_params->m_socks5Proxy,
|
||||
JSONRPCRequest::call(h.m_address, h.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_version\"}", h.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
[this, name](const char*, size_t, double tcp_ping) { update_host_ping(name, tcp_ping); },
|
||||
[](const char*, size_t, double) {});
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<IMergeMiningClient*> merge_mining_clients;
|
||||
|
||||
for (const auto& h : m_params->m_mergeMiningHosts) {
|
||||
IMergeMiningClient* c = IMergeMiningClient::create(this, h.m_host, h.m_wallet);
|
||||
if (c) {
|
||||
merge_mining_clients.push_back(c);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
WriteLock lock(m_mergeMiningClientsLock);
|
||||
|
||||
m_mergeMiningClients.clear();
|
||||
|
||||
for (const auto& h : m_params->m_mergeMiningHosts) {
|
||||
IMergeMiningClient* c = IMergeMiningClient::create(this, h.m_host, h.m_wallet);
|
||||
if (c) {
|
||||
m_mergeMiningClients.push_back(c);
|
||||
}
|
||||
}
|
||||
m_mergeMiningClients = std::move(merge_mining_clients);
|
||||
}
|
||||
|
||||
m_startupFinished = true;
|
||||
@@ -1128,7 +1164,7 @@ void p2pool::get_info()
|
||||
{
|
||||
const Params::Host& host = current_host();
|
||||
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_info\"}", host.m_rpcLogin, m_params->m_socks5Proxy,
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_info\"}", host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
[this](const char* data, size_t size, double)
|
||||
{
|
||||
parse_get_info_rpc(data, size);
|
||||
@@ -1136,7 +1172,7 @@ void p2pool::get_info()
|
||||
[this, host](const char* data, size_t size, double)
|
||||
{
|
||||
if (size > 0) {
|
||||
LOGWARN(1, "get_info RPC request to host " << host.m_displayName << " failed: error " << log::const_buf(data, size) << ", trying again in 1 second");
|
||||
LOGWARN(1, "get_info RPC request to host " << host.m_displayName << " failed: " << log::const_buf(data, size) << ", trying again in 1 second");
|
||||
if (!m_stopped) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
switch_host();
|
||||
@@ -1152,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;
|
||||
}
|
||||
@@ -1196,6 +1232,7 @@ void p2pool::parse_get_info_rpc(const char* data, size_t size)
|
||||
if (doc.HasParseError() || !doc.IsObject() || !doc.HasMember("result")) {
|
||||
LOGWARN(1, "get_info RPC response is invalid (\"result\" not found), trying again in 1 second");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
switch_host();
|
||||
get_info();
|
||||
return;
|
||||
}
|
||||
@@ -1213,6 +1250,7 @@ void p2pool::parse_get_info_rpc(const char* data, size_t size)
|
||||
!PARSE(result, info, stagenet)) {
|
||||
LOGWARN(1, "get_info RPC response is invalid, trying again in 1 second");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
switch_host();
|
||||
get_info();
|
||||
return;
|
||||
}
|
||||
@@ -1220,6 +1258,7 @@ void p2pool::parse_get_info_rpc(const char* data, size_t size)
|
||||
if (info.busy_syncing || !info.synchronized) {
|
||||
LOGINFO(1, "monerod is " << (info.busy_syncing ? "busy syncing" : "not synchronized") << ", trying again in 1 second");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
switch_host();
|
||||
get_info();
|
||||
return;
|
||||
}
|
||||
@@ -1244,7 +1283,7 @@ void p2pool::get_version()
|
||||
{
|
||||
const Params::Host& host = current_host();
|
||||
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_version\"}", host.m_rpcLogin, m_params->m_socks5Proxy,
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_version\"}", host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
[this](const char* data, size_t size, double)
|
||||
{
|
||||
parse_get_version_rpc(data, size);
|
||||
@@ -1252,7 +1291,7 @@ void p2pool::get_version()
|
||||
[this](const char* data, size_t size, double)
|
||||
{
|
||||
if (size > 0) {
|
||||
LOGWARN(1, "get_version RPC request failed: error " << log::const_buf(data, size) << ", trying again in 1 second");
|
||||
LOGWARN(1, "get_version RPC request failed: " << log::const_buf(data, size) << ", trying again in 1 second");
|
||||
if (!m_stopped) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
get_version();
|
||||
@@ -1321,7 +1360,7 @@ void p2pool::get_miner_data(bool retry)
|
||||
|
||||
const Params::Host& host = current_host();
|
||||
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_miner_data\"}", host.m_rpcLogin, m_params->m_socks5Proxy,
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_miner_data\"}", host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
[this, host](const char* data, size_t size, double tcp_ping)
|
||||
{
|
||||
parse_get_miner_data_rpc(data, size);
|
||||
@@ -1330,7 +1369,7 @@ void p2pool::get_miner_data(bool retry)
|
||||
[this, host, retry](const char* data, size_t size, double)
|
||||
{
|
||||
if (size > 0) {
|
||||
LOGWARN(1, "get_miner_data RPC request to host " << host.m_displayName << " failed: error " << log::const_buf(data, size) << (retry ? ", trying again in 1 second" : ""));
|
||||
LOGWARN(1, "get_miner_data RPC request to host " << host.m_displayName << " failed: " << log::const_buf(data, size) << (retry ? ", trying again in 1 second" : ""));
|
||||
if (!m_stopped && retry) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
m_getMinerDataPending = false;
|
||||
@@ -1674,7 +1713,7 @@ void p2pool::cleanup_mainchain_data(uint64_t height)
|
||||
}
|
||||
}
|
||||
|
||||
void p2pool::api_update_block_found(const ChainMain* data, const PoolBlock* block)
|
||||
void p2pool::api_update_block_found(const ChainMain* data, const PoolBlock* block, bool update_stats_mod)
|
||||
{
|
||||
if (!m_api || m_stopped) {
|
||||
return;
|
||||
@@ -1685,12 +1724,16 @@ 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 " << path << ": error " << errno);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<FoundBlock> found_blocks;
|
||||
@@ -1721,7 +1764,9 @@ void p2pool::api_update_block_found(const ChainMain* data, const PoolBlock* bloc
|
||||
s << ']';
|
||||
});
|
||||
|
||||
api_update_stats_mod();
|
||||
if (update_stats_mod) {
|
||||
api_update_stats_mod();
|
||||
}
|
||||
}
|
||||
|
||||
bool p2pool::get_difficulty_at_height(uint64_t height, difficulty_type& diff)
|
||||
@@ -1897,11 +1942,22 @@ int p2pool::run()
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef WITH_TLS
|
||||
if (!m_params->m_tlsCert.empty() && !m_params->m_tlsCertKey.empty()) {
|
||||
if (!ServerTls::load_from_files(m_params->m_tlsCert.c_str(), m_params->m_tlsCertKey.c_str())) {
|
||||
LOGERR(1, "Failed to load TLS files");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Init default loop user data before running it
|
||||
uv_loop_t* loop = uv_default_loop_checked();
|
||||
loop->data = nullptr;
|
||||
GetLoopUserData(loop);
|
||||
|
||||
set_thread_name("Main");
|
||||
|
||||
try {
|
||||
get_info();
|
||||
load_found_blocks();
|
||||
@@ -1920,7 +1976,7 @@ int p2pool::run()
|
||||
|
||||
m_stopped = true;
|
||||
|
||||
bkg_jobs_tracker.wait();
|
||||
bkg_jobs_tracker->wait();
|
||||
|
||||
#ifdef WITH_RANDOMX
|
||||
delete m_miner;
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ public:
|
||||
|
||||
bool chainmain_get_by_hash(const hash& id, ChainMain& data) const;
|
||||
|
||||
void api_update_block_found(const ChainMain* data, const PoolBlock* block);
|
||||
void api_update_block_found(const ChainMain* data, const PoolBlock* block, bool update_stats_mod = true);
|
||||
|
||||
bool get_difficulty_at_height(uint64_t height, difficulty_type& diff);
|
||||
|
||||
|
||||
+17
-10
@@ -130,29 +130,36 @@ void p2pool_api::dump_to_file_async_internal(Category category, const char* file
|
||||
}
|
||||
|
||||
MutexLock lock(m_dumpDataLock);
|
||||
m_dumpData[path] = std::move(buf);
|
||||
|
||||
if (!uv_is_closing(reinterpret_cast<uv_handle_t*>(&m_dumpToFileAsync))) {
|
||||
uv_async_send(&m_dumpToFileAsync);
|
||||
std::pair<std::vector<char>, bool>& data = m_dumpData[path];
|
||||
|
||||
if (data.first != buf) {
|
||||
data.first = buf;
|
||||
data.second = true;
|
||||
|
||||
if (!uv_is_closing(reinterpret_cast<uv_handle_t*>(&m_dumpToFileAsync))) {
|
||||
uv_async_send(&m_dumpToFileAsync);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void p2pool_api::dump_to_file()
|
||||
{
|
||||
unordered_map<std::string, std::vector<char>> data;
|
||||
{
|
||||
MutexLock lock(m_dumpDataLock);
|
||||
data = std::move(m_dumpData);
|
||||
}
|
||||
MutexLock lock(m_dumpDataLock);
|
||||
|
||||
char buf[log::Stream::BUF_SIZE + 1];
|
||||
buf[0] = '\0';
|
||||
|
||||
for (auto& it : data) {
|
||||
for (auto& it : m_dumpData) {
|
||||
if (!it.second.second) {
|
||||
continue;
|
||||
}
|
||||
it.second.second = false;
|
||||
|
||||
log::Stream s(buf);
|
||||
s << it.first << m_counter << '\0';
|
||||
|
||||
DumpFileWork* work = new DumpFileWork{ {}, 0, it.first, buf, std::move(it.second) };
|
||||
DumpFileWork* work = new DumpFileWork{ {}, 0, it.first, buf, it.second.first };
|
||||
work->req.data = work;
|
||||
++m_counter;
|
||||
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ private:
|
||||
std::string m_localPath;
|
||||
|
||||
uv_mutex_t m_dumpDataLock;
|
||||
unordered_map<std::string, std::vector<char>> m_dumpData;
|
||||
unordered_map<std::string, std::pair<std::vector<char>, bool>> m_dumpData;
|
||||
|
||||
uv_async_t m_dumpToFileAsync;
|
||||
|
||||
|
||||
+56
-3
@@ -95,8 +95,14 @@ Params::Params(int argc, char* const argv[])
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if ((strcmp(argv[i], "--config") == 0) && (i + 1 < argc)) {
|
||||
m_config = argv[++i];
|
||||
if ((strcmp(argv[i], "--data-dir") == 0) && (i + 1 < argc)) {
|
||||
// Processed in main.cpp
|
||||
++i;
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if ((strcmp(argv[i], "--sidechain-config") == 0) && (i + 1 < argc)) {
|
||||
m_sidechainConfig = argv[++i];
|
||||
ok = true;
|
||||
}
|
||||
|
||||
@@ -161,6 +167,26 @@ Params::Params(int argc, char* const argv[])
|
||||
ok = true;
|
||||
}
|
||||
|
||||
#ifdef WITH_TLS
|
||||
if (strcmp(argv[i], "--rpc-ssl") == 0) {
|
||||
if (m_hosts.empty()) {
|
||||
m_hosts.emplace_back(Host());
|
||||
}
|
||||
|
||||
m_hosts.back().m_rpcSSL = true;
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if ((strcmp(argv[i], "--rpc-ssl-fingerprint") == 0) && (i + 1 < argc)) {
|
||||
if (m_hosts.empty()) {
|
||||
m_hosts.emplace_back(Host());
|
||||
}
|
||||
|
||||
m_hosts.back().m_rpcSSL_Fingerprint = argv[++i];
|
||||
ok = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((strcmp(argv[i], "--socks5") == 0) && (i + 1 < argc)) {
|
||||
m_socks5Proxy = argv[++i];
|
||||
ok = true;
|
||||
@@ -195,7 +221,27 @@ Params::Params(int argc, char* const argv[])
|
||||
ok = true;
|
||||
}
|
||||
|
||||
#ifdef WITH_TLS
|
||||
if ((strcmp(argv[i], "--tls-cert") == 0) && (i + 1 < argc)) {
|
||||
m_tlsCert = argv[++i];
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if ((strcmp(argv[i], "--tls-cert-key") == 0) && (i + 1 < argc)) {
|
||||
m_tlsCertKey = argv[++i];
|
||||
ok = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strcmp(argv[i], "--no-stratum-http") == 0) {
|
||||
m_enableStratumHTTP = false;
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
// Wait to avoid log messages overlapping with printf() calls and making a mess on screen
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
|
||||
fprintf(stderr, "Unknown command line parameter %s\n\n", argv[i]);
|
||||
p2pool_usage();
|
||||
throw std::exception();
|
||||
@@ -240,6 +286,13 @@ bool Params::valid() const
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef WITH_TLS
|
||||
if (m_tlsCert.empty() != m_tlsCertKey.empty()) {
|
||||
LOGERR(1, "Both --tls-cert and --tls-cert-key files must be specified");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -265,7 +318,7 @@ bool Params::Host::init_display_name(const Params& p)
|
||||
buf[0] = '\0';
|
||||
log::Stream s(buf);
|
||||
|
||||
s << m_displayName << ':' << m_rpcPort << ":ZMQ:" << m_zmqPort;
|
||||
s << m_displayName << (m_rpcSSL ? ":RPC-SSL " : ":RPC ") << m_rpcPort << ":ZMQ " << m_zmqPort;
|
||||
if (m_address != m_displayName) {
|
||||
s << " (" << m_address << ')';
|
||||
}
|
||||
|
||||
+11
-2
@@ -29,13 +29,14 @@ struct Params
|
||||
|
||||
struct Host
|
||||
{
|
||||
Host() : m_address("127.0.0.1"), m_rpcPort(18081), m_zmqPort(18083) {}
|
||||
Host() : m_address("127.0.0.1"), m_rpcPort(18081), m_zmqPort(18083), m_rpcSSL(false) {}
|
||||
|
||||
Host(const char* address, uint32_t rpcPort, uint32_t zmqPort, const char* rpcLogin)
|
||||
: m_address(address)
|
||||
, m_rpcPort(rpcPort)
|
||||
, m_zmqPort(zmqPort)
|
||||
, m_rpcLogin(rpcLogin)
|
||||
, m_rpcSSL(false)
|
||||
{}
|
||||
|
||||
bool valid() const { return !m_address.empty() && m_rpcPort && m_zmqPort && (m_rpcPort != m_zmqPort); }
|
||||
@@ -48,6 +49,9 @@ struct Params
|
||||
|
||||
std::string m_rpcLogin;
|
||||
|
||||
bool m_rpcSSL;
|
||||
std::string m_rpcSSL_Fingerprint;
|
||||
|
||||
std::string m_displayName;
|
||||
};
|
||||
|
||||
@@ -68,7 +72,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;
|
||||
@@ -92,6 +96,11 @@ struct Params
|
||||
bool m_upnp = false;
|
||||
bool m_upnpStratum = false;
|
||||
#endif
|
||||
#ifdef WITH_TLS
|
||||
std::string m_tlsCert;
|
||||
std::string m_tlsCertKey;
|
||||
#endif
|
||||
bool m_enableStratumHTTP = true;
|
||||
};
|
||||
|
||||
} // namespace p2pool
|
||||
|
||||
+26
-40
@@ -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;
|
||||
@@ -204,17 +210,10 @@ std::vector<uint8_t> PoolBlock::serialize_mainchain_data(size_t* header_size, si
|
||||
|
||||
*(p++) = TX_EXTRA_MERGE_MINING_TAG;
|
||||
|
||||
if (!merge_mining_enabled()) {
|
||||
*(p++) = HASH_SIZE;
|
||||
memcpy(p, m_sidechainId.h, HASH_SIZE);
|
||||
p += HASH_SIZE;
|
||||
}
|
||||
else {
|
||||
*(p++) = static_cast<uint8_t>(m_merkleTreeDataSize + HASH_SIZE);
|
||||
writeVarint(m_merkleTreeData, [&p](const uint8_t b) { *(p++) = b; });
|
||||
memcpy(p, m_merkleRoot.h, HASH_SIZE);
|
||||
p += HASH_SIZE;
|
||||
}
|
||||
*(p++) = static_cast<uint8_t>(m_merkleTreeDataSize + HASH_SIZE);
|
||||
writeVarint(m_merkleTreeData, [&p](const uint8_t b) { *(p++) = b; });
|
||||
memcpy(p, m_merkleRoot.h, HASH_SIZE);
|
||||
p += HASH_SIZE;
|
||||
|
||||
writeVarint(static_cast<size_t>(p - tx_extra), data);
|
||||
data.insert(data.end(), tx_extra, p);
|
||||
@@ -267,23 +266,21 @@ std::vector<uint8_t> PoolBlock::serialize_sidechain_data() const
|
||||
writeVarint(m_cumulativeDifficulty.lo, data);
|
||||
writeVarint(m_cumulativeDifficulty.hi, data);
|
||||
|
||||
if (merge_mining_enabled()) {
|
||||
const uint8_t n = static_cast<uint8_t>(m_merkleProof.size());
|
||||
data.push_back(n);
|
||||
const uint8_t n = static_cast<uint8_t>(m_merkleProof.size());
|
||||
data.push_back(n);
|
||||
|
||||
for (uint8_t i = 0; i < n; ++i) {
|
||||
const hash& h = m_merkleProof[i];
|
||||
data.insert(data.end(), h.h, h.h + HASH_SIZE);
|
||||
}
|
||||
for (uint8_t i = 0; i < n; ++i) {
|
||||
const hash& h = m_merkleProof[i];
|
||||
data.insert(data.end(), h.h, h.h + HASH_SIZE);
|
||||
}
|
||||
|
||||
writeVarint(m_mergeMiningExtra.size(), data);
|
||||
writeVarint(m_mergeMiningExtra.size(), data);
|
||||
|
||||
for (const auto& mm_extra_data : m_mergeMiningExtra) {
|
||||
data.insert(data.end(), mm_extra_data.first.h, mm_extra_data.first.h + HASH_SIZE);
|
||||
for (const auto& mm_extra_data : m_mergeMiningExtra) {
|
||||
data.insert(data.end(), mm_extra_data.first.h, mm_extra_data.first.h + HASH_SIZE);
|
||||
|
||||
writeVarint(mm_extra_data.second.size(), data);
|
||||
data.insert(data.end(), mm_extra_data.second.begin(), mm_extra_data.second.end());
|
||||
}
|
||||
writeVarint(mm_extra_data.second.size(), data);
|
||||
data.insert(data.end(), mm_extra_data.second.begin(), mm_extra_data.second.end());
|
||||
}
|
||||
|
||||
const uint8_t* p = reinterpret_cast<const uint8_t*>(m_sidechainExtraBuf);
|
||||
@@ -311,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;
|
||||
@@ -422,20 +424,4 @@ hash PoolBlock::calculate_tx_key_seed() const
|
||||
return result;
|
||||
}
|
||||
|
||||
bool PoolBlock::merge_mining_enabled() const
|
||||
{
|
||||
#ifdef P2POOL_UNIT_TESTS
|
||||
return false;
|
||||
#else
|
||||
switch (SideChain::network_type()) {
|
||||
case NetworkType::Mainnet:
|
||||
return m_timestamp >= MERGE_MINING_FORK_TIME;
|
||||
case NetworkType::Testnet:
|
||||
return m_timestamp >= MERGE_MINING_TESTNET_FORK_TIME;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace p2pool
|
||||
|
||||
+9
-11
@@ -20,7 +20,9 @@
|
||||
#include "uv_util.h"
|
||||
#include "wallet.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include <map>
|
||||
|
||||
#if defined(_DEBUG) || defined(DEV_DEBUG)
|
||||
#define POOL_BLOCK_DEBUG 1
|
||||
#else
|
||||
#define POOL_BLOCK_DEBUG 0
|
||||
@@ -32,6 +34,7 @@ static FORCEINLINE constexpr int pool_block_debug() { return POOL_BLOCK_DEBUG; }
|
||||
|
||||
class RandomX_Hasher_Base;
|
||||
class SideChain;
|
||||
struct MinerShare;
|
||||
|
||||
/*
|
||||
* --------------------------------------------------
|
||||
@@ -42,7 +45,7 @@ class SideChain;
|
||||
* |xxxNONCExxxEXTRA_NONCExHASHxxx|xxxxxxxxxxxxxxxxx|
|
||||
* --------------------------------------------------
|
||||
*
|
||||
* HASH comes in TX_EXTRA_MERGE_MINING_TAG directly after EXTRA_NONCE
|
||||
* HASH (or Merkle tree root hash) comes in TX_EXTRA_MERGE_MINING_TAG directly after EXTRA_NONCE
|
||||
* HASH is calculated from all pool block's bytes and consensus ID (NONCE, EXTRA_NONCE and HASH itself are replaced with 0's when calculating HASH)
|
||||
* Pool block's PoW hash is calculated from the Monero block template part using Monero's consensus rules
|
||||
*/
|
||||
@@ -63,12 +66,6 @@ static constexpr uint64_t MAX_SIDECHAIN_HEIGHT = 31556952000ULL;
|
||||
static constexpr uint64_t MERGE_MINING_MAX_CHAINS = 256;
|
||||
static constexpr uint64_t LOG2_MERGE_MINING_MAX_CHAINS = 8;
|
||||
|
||||
// Oct 12 2024 20:00:00 GMT+0000
|
||||
static constexpr uint64_t MERGE_MINING_FORK_TIME = 1728763200;
|
||||
|
||||
// Jun 18 2024 20:00:00 GMT+0000
|
||||
static constexpr uint64_t MERGE_MINING_TESTNET_FORK_TIME = 1718740800;
|
||||
|
||||
struct DifficultyData
|
||||
{
|
||||
FORCEINLINE DifficultyData(uint64_t t, const difficulty_type& d) : m_timestamp(t), m_cumulativeDifficulty(d) {}
|
||||
@@ -148,7 +145,7 @@ struct PoolBlock
|
||||
// Merge mining extra data
|
||||
// Format: vector of (chain ID, chain data) pairs
|
||||
// Chain data format is arbitrary and depends on the merge mined chain's requirements
|
||||
std::vector<std::pair<hash, std::vector<uint8_t>>> m_mergeMiningExtra;
|
||||
std::map<hash, std::vector<uint8_t>> m_mergeMiningExtra;
|
||||
|
||||
// Arbitrary extra data
|
||||
uint32_t m_sidechainExtraBuf[4];
|
||||
@@ -167,6 +164,9 @@ struct PoolBlock
|
||||
|
||||
bool m_precalculated;
|
||||
|
||||
static ReadWriteLock* s_precalculatedSharesLock;
|
||||
std::vector<MinerShare> m_precalculatedShares;
|
||||
|
||||
uint64_t m_localTimestamp;
|
||||
uint64_t m_receivedTimestamp;
|
||||
|
||||
@@ -217,8 +217,6 @@ struct PoolBlock
|
||||
mm_n_aux_chains = 1U + ((k >> 3U) & ((1U << n) - 1U));
|
||||
mm_nonce = static_cast<uint32_t>(m_merkleTreeData >> (3U + n));
|
||||
}
|
||||
|
||||
bool merge_mining_enabled() const;
|
||||
};
|
||||
|
||||
} // namespace p2pool
|
||||
|
||||
+48
-65
@@ -70,7 +70,7 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
|
||||
READ_VARINT(m_timestamp);
|
||||
READ_BUF(m_prevId.h, HASH_SIZE);
|
||||
|
||||
if (merge_mining_enabled() && (m_minorVersion > 127)) return __LINE__;
|
||||
if (m_minorVersion > 127) return __LINE__;
|
||||
|
||||
const int nonce_offset = static_cast<int>(data - data_begin);
|
||||
READ_BUF(&m_nonce, NONCE_SIZE);
|
||||
@@ -150,9 +150,7 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
|
||||
outputs_blob_size = static_cast<int>(tmp);
|
||||
|
||||
// Required by sidechain.get_outputs_blob() to speed up repeated broadcasts from different peers
|
||||
if (merge_mining_enabled()) {
|
||||
READ_BUF(m_sidechainId.h, HASH_SIZE);
|
||||
}
|
||||
READ_BUF(m_sidechainId.h, HASH_SIZE);
|
||||
}
|
||||
|
||||
// Technically some p2pool node could keep stuffing block with transactions until reward is less than 0.6 XMR
|
||||
@@ -193,36 +191,22 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
|
||||
int mm_root_hash_offset;
|
||||
uint32_t mm_n_aux_chains, mm_nonce;
|
||||
|
||||
if (!merge_mining_enabled()) {
|
||||
EXPECT_BYTE(HASH_SIZE);
|
||||
uint64_t mm_field_size;
|
||||
READ_VARINT(mm_field_size);
|
||||
|
||||
mm_root_hash_offset = static_cast<int>((data - data_begin) + outputs_blob_size_diff);
|
||||
READ_BUF(m_sidechainId.h, HASH_SIZE);
|
||||
const uint8_t* const mm_field_begin = data;
|
||||
|
||||
mm_n_aux_chains = 1;
|
||||
mm_nonce = 0;
|
||||
READ_VARINT(m_merkleTreeData);
|
||||
|
||||
m_merkleRoot = static_cast<root_hash&>(m_sidechainId);
|
||||
m_merkleTreeDataSize = 0;
|
||||
}
|
||||
else {
|
||||
uint64_t mm_field_size;
|
||||
READ_VARINT(mm_field_size);
|
||||
m_merkleTreeDataSize = static_cast<uint32_t>(data - mm_field_begin);
|
||||
|
||||
const uint8_t* const mm_field_begin = data;
|
||||
decode_merkle_tree_data(mm_n_aux_chains, mm_nonce);
|
||||
|
||||
READ_VARINT(m_merkleTreeData);
|
||||
mm_root_hash_offset = static_cast<int>((data - data_begin) + outputs_blob_size_diff);
|
||||
READ_BUF(m_merkleRoot.h, HASH_SIZE);
|
||||
|
||||
m_merkleTreeDataSize = static_cast<uint32_t>(data - mm_field_begin);
|
||||
|
||||
decode_merkle_tree_data(mm_n_aux_chains, mm_nonce);
|
||||
|
||||
mm_root_hash_offset = static_cast<int>((data - data_begin) + outputs_blob_size_diff);
|
||||
READ_BUF(m_merkleRoot.h, HASH_SIZE);
|
||||
|
||||
if (static_cast<uint64_t>(data - mm_field_begin) != mm_field_size) {
|
||||
return __LINE__;
|
||||
}
|
||||
if (static_cast<uint64_t>(data - mm_field_begin) != mm_field_size) {
|
||||
return __LINE__;
|
||||
}
|
||||
|
||||
if (static_cast<uint64_t>(data - tx_extra_begin) != tx_extra_size) return __LINE__;
|
||||
@@ -363,52 +347,51 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
|
||||
m_merkleProof.clear();
|
||||
m_mergeMiningExtra.clear();
|
||||
|
||||
if (merge_mining_enabled()) {
|
||||
uint8_t merkle_proof_size;
|
||||
READ_BYTE(merkle_proof_size);
|
||||
uint8_t merkle_proof_size;
|
||||
READ_BYTE(merkle_proof_size);
|
||||
|
||||
if (merkle_proof_size > LOG2_MERGE_MINING_MAX_CHAINS) {
|
||||
return __LINE__;
|
||||
}
|
||||
if (merkle_proof_size > LOG2_MERGE_MINING_MAX_CHAINS) {
|
||||
return __LINE__;
|
||||
}
|
||||
|
||||
m_merkleProof.reserve(merkle_proof_size);
|
||||
m_merkleProof.reserve(merkle_proof_size);
|
||||
|
||||
for (uint8_t i = 0; i < merkle_proof_size; ++i) {
|
||||
hash h;
|
||||
READ_BUF(h.h, HASH_SIZE);
|
||||
m_merkleProof.emplace_back(h);
|
||||
}
|
||||
for (uint8_t i = 0; i < merkle_proof_size; ++i) {
|
||||
hash h;
|
||||
READ_BUF(h.h, HASH_SIZE);
|
||||
m_merkleProof.emplace_back(h);
|
||||
}
|
||||
|
||||
uint64_t mm_extra_data_count;
|
||||
READ_VARINT(mm_extra_data_count);
|
||||
uint64_t mm_extra_data_count;
|
||||
READ_VARINT(mm_extra_data_count);
|
||||
|
||||
if (mm_extra_data_count) {
|
||||
// Sanity check
|
||||
if (mm_extra_data_count > MERGE_MINING_MAX_CHAINS) return __LINE__;
|
||||
if (static_cast<uint64_t>(data_end - data) < mm_extra_data_count * (HASH_SIZE + 1)) return __LINE__;
|
||||
|
||||
hash prev_chain_id;
|
||||
|
||||
for (uint64_t i = 0; i < mm_extra_data_count; ++i) {
|
||||
hash chain_id;
|
||||
READ_BUF(chain_id.h, HASH_SIZE);
|
||||
|
||||
// IDs must be ordered to avoid duplicates
|
||||
if (i && !(prev_chain_id < chain_id)) return __LINE__;
|
||||
prev_chain_id = chain_id;
|
||||
|
||||
uint64_t n;
|
||||
READ_VARINT(n);
|
||||
|
||||
if (mm_extra_data_count) {
|
||||
// Sanity check
|
||||
if (mm_extra_data_count > MERGE_MINING_MAX_CHAINS) return __LINE__;
|
||||
if (static_cast<uint64_t>(data_end - data) < mm_extra_data_count * (HASH_SIZE + 1)) return __LINE__;
|
||||
if (static_cast<uint64_t>(data_end - data) < n) return __LINE__;
|
||||
|
||||
m_mergeMiningExtra.reserve(mm_extra_data_count);
|
||||
std::vector<uint8_t> t;
|
||||
t.resize(n);
|
||||
|
||||
for (uint64_t i = 0; i < mm_extra_data_count; ++i) {
|
||||
hash chain_id;
|
||||
READ_BUF(chain_id.h, HASH_SIZE);
|
||||
READ_BUF(t.data(), n);
|
||||
|
||||
// IDs must be ordered to avoid duplicates
|
||||
if (i && !(m_mergeMiningExtra[i - 1].first < chain_id)) return __LINE__;
|
||||
|
||||
uint64_t n;
|
||||
READ_VARINT(n);
|
||||
|
||||
// Sanity check
|
||||
if (static_cast<uint64_t>(data_end - data) < n) return __LINE__;
|
||||
|
||||
std::vector<uint8_t> t;
|
||||
t.resize(n);
|
||||
|
||||
READ_BUF(t.data(), n);
|
||||
|
||||
m_mergeMiningExtra.emplace_back(chain_id, std::move(t));
|
||||
}
|
||||
m_mergeMiningExtra.emplace(chain_id, std::move(t));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -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)
|
||||
@@ -244,6 +244,7 @@ void RandomX_Hasher::set_seed(const hash& seed)
|
||||
{
|
||||
// Background doesn't work very well with xmrig mining on all cores
|
||||
//make_thread_background();
|
||||
set_thread_name("Dataset init");
|
||||
randomx_init_dataset(m_dataset, m_cache[m_index], a, b - a);
|
||||
});
|
||||
}
|
||||
@@ -426,6 +427,8 @@ void RandomX_Hasher_RPC::loop(void* data)
|
||||
{
|
||||
LOGINFO(1, "event loop started");
|
||||
|
||||
set_thread_name("RX hash RPC");
|
||||
|
||||
RandomX_Hasher_RPC* hasher = static_cast<RandomX_Hasher_RPC*>(data);
|
||||
|
||||
int err = uv_run(&hasher->m_loop, UV_RUN_DEFAULT);
|
||||
@@ -461,7 +464,7 @@ bool RandomX_Hasher_RPC::calculate(const void* data_ptr, size_t size, uint64_t h
|
||||
const Params& params = m_pool->params();
|
||||
const Params::Host& host = m_pool->current_host();
|
||||
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, params.m_socks5Proxy,
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, params.m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
[&result, &h](const char* data, size_t size, double)
|
||||
{
|
||||
rapidjson::Document doc;
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ private:
|
||||
RandomX_Hasher_RPC* server = reinterpret_cast<RandomX_Hasher_RPC*>(async->data);
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&server->m_shutdownAsync), nullptr);
|
||||
|
||||
delete GetLoopUserData(&server->m_loop, false);
|
||||
DeleteLoopUserData(&server->m_loop);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#if defined(_MSC_VER) && defined(__cppcheck__)
|
||||
// cppcheck chokes on rapidjson headers in Windows
|
||||
#else
|
||||
#include <rapidjson/document.h>
|
||||
#endif
|
||||
+51
-29
@@ -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();
|
||||
}
|
||||
|
||||
@@ -94,6 +98,7 @@ SideChain::SideChain(p2pool* pool, NetworkType type, const char* pool_name)
|
||||
uv_mutex_init_checked(&m_seenWalletsLock);
|
||||
uv_mutex_init_checked(&m_incomingBlocksLock);
|
||||
uv_rwlock_init_checked(&m_curDifficultyLock);
|
||||
uv_rwlock_init_checked(&m_watchBlockLock);
|
||||
|
||||
m_difficultyData.reserve(m_chainWindowSize);
|
||||
|
||||
@@ -213,6 +218,7 @@ SideChain::~SideChain()
|
||||
uv_mutex_destroy(&m_seenWalletsLock);
|
||||
uv_mutex_destroy(&m_incomingBlocksLock);
|
||||
uv_rwlock_destroy(&m_curDifficultyLock);
|
||||
uv_rwlock_destroy(&m_watchBlockLock);
|
||||
|
||||
for (const auto& it : m_blocksById) {
|
||||
delete it.second;
|
||||
@@ -505,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;
|
||||
@@ -629,7 +634,8 @@ bool SideChain::add_external_block(PoolBlock& block, std::vector<hash>& missing_
|
||||
|
||||
missing_blocks.clear();
|
||||
{
|
||||
WriteLock lock(m_sidechainLock);
|
||||
ReadLock lock(m_sidechainLock);
|
||||
|
||||
if (!block.m_parent.empty() && (m_blocksById.find(block.m_parent) == m_blocksById.end())) {
|
||||
missing_blocks.push_back(block.m_parent);
|
||||
}
|
||||
@@ -639,6 +645,10 @@ bool SideChain::add_external_block(PoolBlock& block, std::vector<hash>& missing_
|
||||
missing_blocks.push_back(h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
WriteLock lock(m_watchBlockLock);
|
||||
|
||||
if (block.m_merkleRoot == m_watchBlockMerkleRoot) {
|
||||
const Wallet& w = m_pool->params().m_wallet;
|
||||
@@ -752,7 +762,7 @@ PoolBlock* SideChain::find_block_by_merkle_root(const root_hash& merkle_root) co
|
||||
|
||||
void SideChain::watch_mainchain_block(const ChainMain& data, const hash& possible_merkle_root)
|
||||
{
|
||||
WriteLock lock(m_sidechainLock);
|
||||
WriteLock lock(m_watchBlockLock);
|
||||
m_watchBlock = data;
|
||||
m_watchBlockMerkleRoot = possible_merkle_root;
|
||||
}
|
||||
@@ -1670,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;
|
||||
}
|
||||
@@ -2185,6 +2201,11 @@ void SideChain::prune_old_blocks()
|
||||
|
||||
m_pool->print_hosts();
|
||||
m_pool->stop();
|
||||
|
||||
#ifdef DEV_TRACK_MEMORY
|
||||
// Give it 1 minute to shut down, otherwise save a minidump
|
||||
minidump_and_crash(60 * 1000);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -2333,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);
|
||||
}
|
||||
}
|
||||
@@ -2346,9 +2370,14 @@ void SideChain::launch_precalc(const PoolBlock* block)
|
||||
|
||||
void SideChain::precalc_worker()
|
||||
{
|
||||
set_thread_name("Precalc");
|
||||
|
||||
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);
|
||||
|
||||
@@ -2369,32 +2398,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);
|
||||
}
|
||||
|
||||
@@ -2408,9 +2433,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);
|
||||
|
||||
+2
-7
@@ -143,19 +143,14 @@ private:
|
||||
mutable uv_rwlock_t m_curDifficultyLock;
|
||||
difficulty_type m_curDifficulty;
|
||||
|
||||
uv_rwlock_t m_watchBlockLock;
|
||||
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;
|
||||
|
||||
|
||||
+290
-143
@@ -22,6 +22,9 @@
|
||||
#include "side_chain.h"
|
||||
#include "params.h"
|
||||
#include "p2pool_api.h"
|
||||
#include "p2p_server.h"
|
||||
|
||||
#include "rapidjson_wrapper.h"
|
||||
|
||||
LOG_CATEGORY(StratumServer)
|
||||
|
||||
@@ -53,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);
|
||||
@@ -71,13 +76,6 @@ StratumServer::StratumServer(p2pool* pool)
|
||||
|
||||
m_extraNonce = get_random32();
|
||||
|
||||
m_submittedSharesPool.resize(10);
|
||||
for (size_t i = 0; i < m_submittedSharesPool.size(); ++i) {
|
||||
SubmittedShare* share = new SubmittedShare{};
|
||||
ASAN_POISON_MEMORY_REGION(share, sizeof(SubmittedShare));
|
||||
m_submittedSharesPool[i] = share;
|
||||
}
|
||||
|
||||
uv_async_init_checked(&m_loop, &m_blobsAsync, on_blobs_ready);
|
||||
m_blobsAsync.data = this;
|
||||
m_blobsQueue.reserve(2);
|
||||
@@ -105,11 +103,6 @@ StratumServer::~StratumServer()
|
||||
uv_mutex_destroy(&m_showWorkersLock);
|
||||
uv_mutex_destroy(&m_rngLock);
|
||||
uv_rwlock_destroy(&m_hashrateDataLock);
|
||||
|
||||
for (SubmittedShare* share : m_submittedSharesPool) {
|
||||
ASAN_UNPOISON_MEMORY_REGION(share, sizeof(SubmittedShare));
|
||||
delete share;
|
||||
}
|
||||
}
|
||||
|
||||
void StratumServer::on_block(const BlockTemplate& block)
|
||||
@@ -250,6 +243,24 @@ static bool get_custom_diff(const char* s, difficulty_type& diff)
|
||||
|
||||
bool StratumServer::on_login(StratumClient* client, uint32_t id, const char* login)
|
||||
{
|
||||
const P2PServer* p2p_server = m_pool->p2p_server();
|
||||
|
||||
// If there are no connections to other P2Pool peers, don't let Stratum clients connect
|
||||
if (p2p_server && p2p_server->disconnected()) {
|
||||
const bool result = send(client, [id](uint8_t* buf, size_t buf_size) {
|
||||
log::Stream s(buf, buf_size);
|
||||
s << "{\"id\":" << id << ",\"jsonrpc\":\"2.0\",\"error\":{\"message\":\"Disconnected from P2Pool network\"}}\n";
|
||||
return s.m_pos;
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
client->close();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (client->m_rpcId) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(client->m_addrString) << " tried to login, but it's already logged in");
|
||||
return false;
|
||||
@@ -272,17 +283,17 @@ bool StratumServer::on_login(StratumClient* client, uint32_t id, const char* log
|
||||
target = std::max(target, aux_diff.target());
|
||||
|
||||
if (get_custom_diff(login, client->m_customDiff)) {
|
||||
LOGINFO(5, "client " << log::Gray() << static_cast<char*>(client->m_addrString) << " set custom difficulty " << client->m_customDiff);
|
||||
LOGINFO(5, "client " << log::Gray() << static_cast<char*>(client->m_addrString) << log::NoColor() << " set custom difficulty " << client->m_customDiff);
|
||||
target = std::max(target, client->m_customDiff.target());
|
||||
}
|
||||
else if (m_autoDiff) {
|
||||
// Limit autodiff to 4000000 for maximum compatibility
|
||||
target = std::max(std::max(target, AUTODIFF_START), TARGET_4_BYTES_LIMIT);
|
||||
target = std::max(target, std::max(AUTODIFF_START, TARGET_4_BYTES_LIMIT));
|
||||
}
|
||||
|
||||
if (get_custom_user(login, client->m_customUser)) {
|
||||
const char* s = client->m_customUser;
|
||||
LOGINFO(5, "client " << log::Gray() << static_cast<char*>(client->m_addrString) << " set custom user " << s);
|
||||
LOGINFO(5, "client " << log::Gray() << static_cast<char*>(client->m_addrString) << log::NoColor() << " set custom user " << s);
|
||||
}
|
||||
|
||||
uint32_t job_id;
|
||||
@@ -421,72 +432,77 @@ bool StratumServer::on_submit(StratumClient* client, uint32_t id, const char* jo
|
||||
}
|
||||
}
|
||||
|
||||
SubmittedShare* share;
|
||||
|
||||
if (!m_submittedSharesPool.empty()) {
|
||||
share = m_submittedSharesPool.back();
|
||||
m_submittedSharesPool.pop_back();
|
||||
ASAN_UNPOISON_MEMORY_REGION(share, sizeof(SubmittedShare));
|
||||
}
|
||||
else {
|
||||
share = new SubmittedShare{};
|
||||
}
|
||||
|
||||
if (target >= TARGET_4_BYTES_LIMIT) {
|
||||
// "Low diff share" fix: adjust target to the same value as XMRig would use
|
||||
target = std::numeric_limits<uint64_t>::max() / (std::numeric_limits<uint32_t>::max() / (target >> 32));
|
||||
}
|
||||
|
||||
share->m_req.data = share;
|
||||
share->m_server = this;
|
||||
share->m_client = client;
|
||||
share->m_clientIPv6 = client->m_isV6;
|
||||
share->m_clientAddr = client->m_addr;
|
||||
memcpy(share->m_clientAddrString, client->m_addrString, sizeof(share->m_clientAddrString));
|
||||
memcpy(share->m_clientCustomUser, client->m_customUser, sizeof(share->m_clientCustomUser));
|
||||
share->m_clientResetCounter = client->m_resetCounter.load();
|
||||
share->m_rpcId = client->m_rpcId;
|
||||
share->m_id = id;
|
||||
share->m_templateId = template_id;
|
||||
share->m_nonce = nonce;
|
||||
share->m_extraNonce = extra_nonce;
|
||||
share->m_target = target;
|
||||
share->m_resultHash = resultHash;
|
||||
share->m_sidechainDifficulty = sidechain_diff;
|
||||
share->m_mainchainHeight = height;
|
||||
share->m_sidechainHeight = sidechain_height;
|
||||
share->m_effort = -1.0;
|
||||
share->m_timestamp = seconds_since_epoch();
|
||||
SubmittedShare share{};
|
||||
|
||||
share.m_req.data = &share;
|
||||
share.m_allocated = false;
|
||||
|
||||
share.m_server = this;
|
||||
share.m_client = client;
|
||||
share.m_clientIPv6 = client->m_isV6;
|
||||
share.m_clientAddr = client->m_addr;
|
||||
memcpy(share.m_clientAddrString, client->m_addrString, sizeof(share.m_clientAddrString));
|
||||
memcpy(share.m_clientCustomUser, client->m_customUser, sizeof(share.m_clientCustomUser));
|
||||
share.m_clientResetCounter = client->m_resetCounter.load();
|
||||
share.m_rpcId = client->m_rpcId;
|
||||
share.m_id = id;
|
||||
share.m_templateId = template_id;
|
||||
share.m_nonce = nonce;
|
||||
share.m_extraNonce = extra_nonce;
|
||||
share.m_target = target;
|
||||
share.m_resultHash = resultHash;
|
||||
share.m_sidechainDifficulty = sidechain_diff;
|
||||
share.m_mainchainHeight = height;
|
||||
share.m_sidechainHeight = sidechain_height;
|
||||
share.m_effort = -1.0;
|
||||
share.m_timestamp = seconds_since_epoch();
|
||||
|
||||
uint64_t rem;
|
||||
share->m_hashes = (target > 1) ? udiv128(1, 0, target, &rem) : 1;
|
||||
share->m_highEnoughDifficulty = sidechain_diff.check_pow(resultHash);
|
||||
share->m_score = 0;
|
||||
share.m_hashes = (target > 1) ? udiv128(1, 0, target, &rem) : 1;
|
||||
share.m_highEnoughDifficulty = sidechain_diff.check_pow(resultHash);
|
||||
share.m_score = 0;
|
||||
|
||||
// Don't count shares that were found during sync
|
||||
const SideChain& side_chain = m_pool->side_chain();
|
||||
const PoolBlock* tip = side_chain.chainTip();
|
||||
if (tip && (sidechain_height + side_chain.chain_window_size() < tip->m_sidechainHeight)) {
|
||||
share->m_highEnoughDifficulty = false;
|
||||
share.m_highEnoughDifficulty = false;
|
||||
}
|
||||
|
||||
update_auto_diff(client, share->m_timestamp, share->m_hashes);
|
||||
update_auto_diff(client, share.m_timestamp, share.m_hashes);
|
||||
|
||||
// If this share is below sidechain difficulty, process it in this thread because it'll be quick
|
||||
if (!share->m_highEnoughDifficulty) {
|
||||
on_share_found(&share->m_req);
|
||||
on_after_share_found(&share->m_req, 0);
|
||||
if (!share.m_highEnoughDifficulty) {
|
||||
on_share_found(&share.m_req);
|
||||
on_after_share_found(&share.m_req, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Else switch to a worker thread to check PoW which can take a long time
|
||||
const int err = uv_queue_work(&m_loop, &share->m_req, on_share_found, on_after_share_found);
|
||||
if (err) {
|
||||
LOGERR(1, "uv_queue_work failed, error " << uv_err_name(err));
|
||||
SubmittedShare* share2 = new SubmittedShare(share);
|
||||
|
||||
// If uv_queue_work failed, process this share here anyway
|
||||
on_share_found(&share->m_req);
|
||||
on_after_share_found(&share->m_req, 0);
|
||||
share2->m_req.data = share2;
|
||||
share2->m_allocated = true;
|
||||
|
||||
m_pendingShareChecks.push_back(share2);
|
||||
LOGINFO(5, "on_submit: pending share checks count = " << m_pendingShareChecks.size());
|
||||
|
||||
// If there were no pending share checks, run on_share_found in background
|
||||
// on_after_share_found will pick the remaining share checks
|
||||
if (m_pendingShareChecks.size() == 1) {
|
||||
const int err = uv_queue_work(&m_loop, &share2->m_req, on_share_found, on_after_share_found);
|
||||
if (err) {
|
||||
LOGERR(1, "uv_queue_work failed, error " << uv_err_name(err));
|
||||
|
||||
// If uv_queue_work failed, process this share here anyway
|
||||
on_share_found(&share2->m_req);
|
||||
on_after_share_found(&share2->m_req, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -541,6 +557,7 @@ void StratumServer::show_workers()
|
||||
size_t n = 0;
|
||||
|
||||
LOGINFO(0, log::pad_right("IP:port", addr_len + 8)
|
||||
<< "TLS "
|
||||
<< log::pad_right("uptime", 20)
|
||||
<< log::pad_right("difficulty", 20)
|
||||
<< log::pad_right("hashrate", 15)
|
||||
@@ -557,7 +574,15 @@ void StratumServer::show_workers()
|
||||
++diff.lo;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_TLS
|
||||
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 ? "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)
|
||||
@@ -574,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
|
||||
@@ -590,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);
|
||||
@@ -619,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;
|
||||
@@ -628,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)"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -855,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];
|
||||
@@ -900,11 +936,11 @@ void StratumServer::on_share_found(uv_work_t* req)
|
||||
const uint64_t target = share->m_target;
|
||||
const uint64_t hashes = share->m_hashes;
|
||||
|
||||
if (pool->stopped()) {
|
||||
LOGWARN(0, "p2pool is shutting down, but a share was found. Trying to process it anyway!");
|
||||
}
|
||||
|
||||
if (share->m_highEnoughDifficulty) {
|
||||
if (pool->stopped()) {
|
||||
LOGWARN(0, "p2pool is shutting down, but a share was found. Trying to process it anyway!");
|
||||
}
|
||||
|
||||
uint8_t blob[128];
|
||||
uint64_t height;
|
||||
difficulty_type difficulty;
|
||||
@@ -957,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -989,6 +1025,9 @@ void StratumServer::on_share_found(uv_work_t* req)
|
||||
void StratumServer::on_after_share_found(uv_work_t* req, int /*status*/)
|
||||
{
|
||||
SubmittedShare* share = reinterpret_cast<SubmittedShare*>(req->data);
|
||||
StratumServer* server = share->m_server;
|
||||
|
||||
server->check_event_loop_thread(__func__);
|
||||
|
||||
if (share->m_highEnoughDifficulty) {
|
||||
const char* s = share->m_clientCustomUser;
|
||||
@@ -1012,14 +1051,6 @@ void StratumServer::on_after_share_found(uv_work_t* req, int /*status*/)
|
||||
BACKGROUND_JOB_STOP(StratumServer::on_share_found);
|
||||
}
|
||||
|
||||
StratumServer* server = share->m_server;
|
||||
|
||||
ON_SCOPE_LEAVE([share, server]()
|
||||
{
|
||||
ASAN_POISON_MEMORY_REGION(share, sizeof(SubmittedShare));
|
||||
server->m_submittedSharesPool.push_back(share);
|
||||
});
|
||||
|
||||
const bool bad_share = (share->m_result == SubmittedShare::Result::LOW_DIFF) || (share->m_result == SubmittedShare::Result::INVALID_POW);
|
||||
|
||||
StratumClient* client = share->m_client;
|
||||
@@ -1065,6 +1096,30 @@ void StratumServer::on_after_share_found(uv_work_t* req, int /*status*/)
|
||||
else if (bad_share) {
|
||||
server->ban(share->m_clientIPv6, share->m_clientAddr, DEFAULT_BAN_TIME);
|
||||
}
|
||||
|
||||
if (share->m_allocated) {
|
||||
auto it = std::find(server->m_pendingShareChecks.begin(), server->m_pendingShareChecks.end(), share);
|
||||
if (it != server->m_pendingShareChecks.end()) {
|
||||
server->m_pendingShareChecks.erase(it);
|
||||
}
|
||||
|
||||
delete share;
|
||||
|
||||
if (!server->m_pendingShareChecks.empty()) {
|
||||
SubmittedShare* share2 = server->m_pendingShareChecks.front();
|
||||
|
||||
const int err = uv_queue_work(&server->m_loop, &share2->m_req, on_share_found, on_after_share_found);
|
||||
if (err) {
|
||||
LOGERR(1, "uv_queue_work failed, error " << uv_err_name(err));
|
||||
|
||||
// If uv_queue_work failed, process this share here anyway
|
||||
server->on_share_found(&share2->m_req);
|
||||
server->on_after_share_found(&share2->m_req, 0);
|
||||
}
|
||||
}
|
||||
|
||||
LOGINFO(5, "on_after_share_found: pending share checks count = " << server->m_pendingShareChecks.size());
|
||||
}
|
||||
}
|
||||
|
||||
void StratumServer::on_shutdown()
|
||||
@@ -1080,7 +1135,8 @@ void StratumServer::on_shutdown()
|
||||
}
|
||||
|
||||
StratumServer::StratumClient::StratumClient()
|
||||
: Client(m_stratumReadBuf, sizeof(m_stratumReadBuf))
|
||||
: Client(m_rawReadBuf, sizeof(m_rawReadBuf))
|
||||
, m_stratumReadBufBytes(0)
|
||||
, m_rpcId(0)
|
||||
, m_perConnectionJobId(0)
|
||||
, m_connectedTime(0)
|
||||
@@ -1094,12 +1150,17 @@ StratumServer::StratumClient::StratumClient()
|
||||
, m_lastJobTarget(0)
|
||||
, m_score(0)
|
||||
{
|
||||
m_rawReadBuf[0] = '\0';
|
||||
m_stratumReadBuf[0] = '\0';
|
||||
}
|
||||
|
||||
void StratumServer::StratumClient::reset()
|
||||
{
|
||||
Client::reset();
|
||||
|
||||
m_stratumReadBuf[0] = '\0';
|
||||
m_stratumReadBufBytes = 0;
|
||||
|
||||
m_rpcId = 0;
|
||||
m_perConnectionJobId = 0;
|
||||
m_connectedTime = 0;
|
||||
@@ -1125,43 +1186,94 @@ 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)
|
||||
{
|
||||
if ((data != m_readBuf + m_numRead) || (data + size > m_readBuf + m_readBufSize)) {
|
||||
LOGERR(1, "client: invalid data pointer or size in on_read()");
|
||||
ban(DEFAULT_BAN_TIME);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_numRead += size;
|
||||
|
||||
char* line_start = m_readBuf;
|
||||
for (char* c = data; c < m_readBuf + m_numRead; ++c) {
|
||||
if (*c == '\n') {
|
||||
*c = '\0';
|
||||
if (!process_request(line_start, static_cast<uint32_t>(c - line_start))) {
|
||||
ban(DEFAULT_BAN_TIME);
|
||||
#ifdef WITH_TLS
|
||||
if (!m_tlsChecked) {
|
||||
if (data[0] == 0x16) {
|
||||
if (!m_tls.init()) {
|
||||
LOGWARN(5, "client " << static_cast<const char*>(m_addrString) << ": TLS init failed");
|
||||
return false;
|
||||
}
|
||||
line_start = c + 1;
|
||||
LOGINFO(5, "client " << log::Gray() << static_cast<const char*>(m_addrString) << log::NoColor() << " is using TLS");
|
||||
}
|
||||
m_tlsChecked = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Move the possible unfinished line to the beginning of m_readBuf to free up more space for reading
|
||||
if (line_start != m_readBuf) {
|
||||
m_numRead = static_cast<uint32_t>(m_readBuf + m_numRead - line_start);
|
||||
if (m_numRead > 0) {
|
||||
memmove(m_readBuf, line_start, m_numRead);
|
||||
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);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
memcpy(m_stratumReadBuf + m_stratumReadBufBytes, data, size);
|
||||
m_stratumReadBufBytes += size;
|
||||
|
||||
char* line_start = m_stratumReadBuf;
|
||||
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 (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);
|
||||
const bool is_http_head = (line_start_data == 0x44414548U);
|
||||
|
||||
if (is_http_get || is_http_head) {
|
||||
LOGINFO(5, "client " << log::Gray() << static_cast<const char*>(m_addrString) << log::NoColor() << " sent an HTTP " << (is_http_get ? "GET" : "HEAD") << " request");
|
||||
send_http_response(is_http_get);
|
||||
close();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
*c = '\0';
|
||||
if (!process_request(line_start, static_cast<uint32_t>(c - line_start))) {
|
||||
ban(DEFAULT_BAN_TIME);
|
||||
return false;
|
||||
}
|
||||
|
||||
line_start = c + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Move the possible unfinished line to the beginning of m_stratumReadBuf to free up more space for reading
|
||||
if (line_start != m_stratumReadBuf) {
|
||||
m_stratumReadBufBytes = static_cast<uint32_t>(m_stratumReadBuf + m_stratumReadBufBytes - line_start);
|
||||
if (m_stratumReadBufBytes > 0) {
|
||||
memmove(m_stratumReadBuf, line_start, m_stratumReadBufBytes);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
#ifdef WITH_TLS
|
||||
if (!m_tls.is_empty()) {
|
||||
auto on_write = [this](const uint8_t* data, size_t size) {
|
||||
return m_owner->send(this, [data, size](uint8_t* buf, size_t buf_size) -> size_t {
|
||||
if (buf_size < size) {
|
||||
return 0;
|
||||
}
|
||||
memcpy(buf, data, size);
|
||||
return size;
|
||||
}, true);
|
||||
};
|
||||
|
||||
return m_tls.on_read(data, size, std::move(on_parse), std::move(on_write));
|
||||
}
|
||||
#endif
|
||||
|
||||
return on_parse(data, size);
|
||||
}
|
||||
|
||||
bool StratumServer::StratumClient::process_request(char* data, uint32_t /*size*/)
|
||||
bool StratumServer::StratumClient::process_request(char* data, uint32_t size)
|
||||
{
|
||||
rapidjson::Document doc;
|
||||
if (doc.ParseInsitu(data).HasParseError()) {
|
||||
if (doc.Parse(data, size).HasParseError()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid JSON request (parse error)");
|
||||
return false;
|
||||
}
|
||||
@@ -1171,23 +1283,25 @@ bool StratumServer::StratumClient::process_request(char* data, uint32_t /*size*/
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!doc.HasMember("id")) {
|
||||
const auto id_it = doc.FindMember("id");
|
||||
if (id_it == doc.MemberEnd()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid JSON request ('id' field not found)");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto& id = doc["id"];
|
||||
const auto& id = id_it->value;
|
||||
if (!id.IsUint()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid JSON request ('id' field is not an integer)");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!doc.HasMember("method")) {
|
||||
const auto method_it = doc.FindMember("method");
|
||||
if (method_it == doc.MemberEnd()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid JSON request ('method' field not found)");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto& method = doc["method"];
|
||||
const auto& method = method_it->value;
|
||||
if (!method.IsString()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid JSON request ('method' field is not a string)");
|
||||
return false;
|
||||
@@ -1211,25 +1325,28 @@ 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)
|
||||
{
|
||||
if (!doc.HasMember("params")) {
|
||||
const auto params_it = doc.FindMember("params");
|
||||
if (params_it == doc.MemberEnd()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid JSON login request ('params' field not found)");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto& params = doc["params"];
|
||||
const auto& params = params_it->value;
|
||||
if (!params.IsObject()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid JSON login request ('params' field is not an object)");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!params.HasMember("login")) {
|
||||
const auto login_it = params.FindMember("login");
|
||||
if (login_it == params.MemberEnd()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid login params ('login' field not found)");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto& login = params["login"];
|
||||
const auto& login = login_it->value;
|
||||
if (!login.IsString()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid login params ('login' field is not a string)");
|
||||
return false;
|
||||
@@ -1238,47 +1355,52 @@ 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)
|
||||
{
|
||||
if (!doc.HasMember("params")) {
|
||||
const auto params_it = doc.FindMember("params");
|
||||
if (params_it == doc.MemberEnd()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid JSON submit request ('params' field not found)");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto& params = doc["params"];
|
||||
const auto& params = params_it->value;
|
||||
if (!params.IsObject()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid JSON submit request ('params' field is not an object)");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!params.HasMember("id")) {
|
||||
const auto rpcId_it = params.FindMember("id");
|
||||
if (rpcId_it == params.MemberEnd()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid submit params ('id' field not found)");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto& rpcId = params["id"];
|
||||
const auto& rpcId = rpcId_it->value;
|
||||
if (!rpcId.IsString()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid submit params ('id' field is not a string)");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!params.HasMember("job_id")) {
|
||||
const auto job_id_it = params.FindMember("job_id");
|
||||
if (job_id_it == params.MemberEnd()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid submit params ('job_id' field not found)");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto& job_id = params["job_id"];
|
||||
const auto& job_id = job_id_it->value;
|
||||
if (!job_id.IsString()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid submit params ('job_id' field is not a string)");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!params.HasMember("nonce")) {
|
||||
const auto nonce_it = params.FindMember("nonce");
|
||||
if (nonce_it == params.MemberEnd()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid submit params ('nonce' field not found)");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto& nonce = params["nonce"];
|
||||
const auto& nonce = nonce_it->value;
|
||||
if (!nonce.IsString()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid submit params ('nonce' field is not a string)");
|
||||
return false;
|
||||
@@ -1289,12 +1411,13 @@ bool StratumServer::StratumClient::process_submit(rapidjson::Document& doc, uint
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!params.HasMember("result")) {
|
||||
const auto result_it = params.FindMember("result");
|
||||
if (result_it == params.MemberEnd()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid submit params ('result' field not found)");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto& result = params["result"];
|
||||
const auto& result = result_it->value;
|
||||
if (!result.IsString()) {
|
||||
LOGWARN(4, "client " << static_cast<char*>(m_addrString) << " invalid submit params ('result' field is not a string)");
|
||||
return false;
|
||||
@@ -1308,6 +1431,27 @@ bool StratumServer::StratumClient::process_submit(rapidjson::Document& doc, uint
|
||||
return static_cast<StratumServer*>(m_owner)->on_submit(this, id, job_id.GetString(), nonce.GetString(), result.GetString());
|
||||
}
|
||||
|
||||
bool StratumServer::StratumClient::send_http_response(bool send_content)
|
||||
{
|
||||
return m_owner->send(this, [send_content](uint8_t *buf, size_t buf_size) -> size_t {
|
||||
static constexpr uint8_t data[] =
|
||||
"HTTP/1.1 200 OK\r\n"
|
||||
"Content-Length: 21\r\n"
|
||||
"Content-Type: text/plain\r\n"
|
||||
"Connection: Closed\r\n\r\n"
|
||||
"P2Pool Stratum online";
|
||||
|
||||
const size_t data_size = send_content ? (sizeof(data) - 1) : (sizeof(data) - 1 - 21);
|
||||
|
||||
if (buf_size < data_size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy(buf, data, data_size);
|
||||
return data_size;
|
||||
});
|
||||
}
|
||||
|
||||
void StratumServer::api_update_local_stats(uint64_t timestamp)
|
||||
{
|
||||
if (!m_pool->api() || !m_pool->params().m_localStats || m_pool->stopped()) {
|
||||
@@ -1330,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);
|
||||
@@ -1358,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;
|
||||
@@ -1379,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
-8
@@ -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,13 +46,18 @@ 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);
|
||||
|
||||
alignas(8) char m_rawReadBuf[STRATUM_BUF_SIZE];
|
||||
|
||||
alignas(8) char m_stratumReadBuf[STRATUM_BUF_SIZE];
|
||||
uint32_t m_stratumReadBufBytes;
|
||||
|
||||
uint32_t m_rpcId;
|
||||
uint32_t m_perConnectionJobId;
|
||||
@@ -97,6 +102,8 @@ public:
|
||||
|
||||
void reset_share_counters();
|
||||
|
||||
bool http_enabled() const;
|
||||
|
||||
private:
|
||||
[[nodiscard]] const char* get_log_category() const override;
|
||||
|
||||
@@ -142,6 +149,8 @@ private:
|
||||
struct SubmittedShare
|
||||
{
|
||||
uv_work_t m_req;
|
||||
bool m_allocated;
|
||||
|
||||
StratumServer* m_server;
|
||||
StratumClient* m_client;
|
||||
bool m_clientIPv6;
|
||||
@@ -175,8 +184,6 @@ private:
|
||||
} m_result;
|
||||
};
|
||||
|
||||
std::vector<SubmittedShare*> m_submittedSharesPool;
|
||||
|
||||
struct HashrateData
|
||||
{
|
||||
uint64_t m_timestamp;
|
||||
@@ -194,11 +201,14 @@ 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;
|
||||
|
||||
std::deque<SubmittedShare*> m_pendingShareChecks;
|
||||
|
||||
void update_hashrate_data(uint64_t hashes, uint64_t timestamp);
|
||||
void api_update_local_stats(uint64_t timestamp);
|
||||
|
||||
|
||||
+78
-26
@@ -538,7 +538,7 @@ void TCPServer::print_bans()
|
||||
}
|
||||
}
|
||||
|
||||
bool TCPServer::send_internal(Client* client, Callback<size_t, uint8_t*, size_t>::Base&& callback)
|
||||
bool TCPServer::send_internal(Client* client, Callback<size_t, uint8_t*, size_t>::Base&& callback, bool raw)
|
||||
{
|
||||
check_event_loop_thread(__func__);
|
||||
|
||||
@@ -559,34 +559,50 @@ bool TCPServer::send_internal(Client* client, Callback<size_t, uint8_t*, size_t>
|
||||
return false;
|
||||
}
|
||||
|
||||
WriteBuf* buf = get_write_buffer(bytes_written);
|
||||
auto on_write = [this, client](const uint8_t* data, size_t size) {
|
||||
WriteBuf* buf = get_write_buffer(size);
|
||||
|
||||
buf->m_write.data = buf;
|
||||
buf->m_client = client;
|
||||
buf->m_write.data = buf;
|
||||
buf->m_client = client;
|
||||
|
||||
if (buf->m_dataCapacity < bytes_written) {
|
||||
buf->m_dataCapacity = round_up(bytes_written, 64);
|
||||
buf->m_data = realloc_hook(buf->m_data, buf->m_dataCapacity);
|
||||
if (!buf->m_data) {
|
||||
LOGERR(0, "failed to allocate " << buf->m_dataCapacity << " bytes to send data");
|
||||
PANIC_STOP();
|
||||
if (buf->m_dataCapacity < size) {
|
||||
buf->m_dataCapacity = round_up(size, 64);
|
||||
buf->m_data = realloc_hook(buf->m_data, buf->m_dataCapacity);
|
||||
if (!buf->m_data) {
|
||||
LOGERR(0, "failed to allocate " << buf->m_dataCapacity << " bytes to send data");
|
||||
PANIC_STOP();
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(buf->m_data, data, size);
|
||||
|
||||
uv_buf_t bufs[1];
|
||||
bufs[0].base = reinterpret_cast<char*>(buf->m_data);
|
||||
bufs[0].len = static_cast<int>(size);
|
||||
|
||||
const int err = uv_write(&buf->m_write, reinterpret_cast<uv_stream_t*>(&client->m_socket), bufs, 1, Client::on_write);
|
||||
if (err) {
|
||||
LOGWARN(1, "failed to start writing data to client connection " << static_cast<const char*>(client->m_addrString) << ", error " << uv_err_name(err));
|
||||
return_write_buffer(buf);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
#ifdef WITH_TLS
|
||||
if (!client->m_tls.is_empty() && !raw) {
|
||||
if (!client->m_tls.on_write(m_callbackBuf.data(), bytes_written, std::move(on_write))) {
|
||||
LOGWARN(1, "TLS write failed to client connection " << static_cast<const char*>(client->m_addrString));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
(void)raw;
|
||||
#endif
|
||||
|
||||
memcpy(buf->m_data, m_callbackBuf.data(), bytes_written);
|
||||
|
||||
uv_buf_t bufs[1];
|
||||
bufs[0].base = reinterpret_cast<char*>(buf->m_data);
|
||||
bufs[0].len = static_cast<int>(bytes_written);
|
||||
|
||||
const int err = uv_write(&buf->m_write, reinterpret_cast<uv_stream_t*>(&client->m_socket), bufs, 1, Client::on_write);
|
||||
if (err) {
|
||||
LOGWARN(1, "failed to start writing data to client connection " << static_cast<const char*>(client->m_addrString) << ", error " << uv_err_name(err));
|
||||
return_write_buffer(buf);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return on_write(m_callbackBuf.data(), bytes_written);
|
||||
}
|
||||
|
||||
const char* TCPServer::get_log_category() const
|
||||
@@ -599,6 +615,34 @@ void TCPServer::loop(void* data)
|
||||
TCPServer* server = static_cast<TCPServer*>(data);
|
||||
|
||||
log_category_prefix = server->get_log_category();
|
||||
{
|
||||
size_t n = strlen(log_category_prefix);
|
||||
|
||||
if (n > 1) {
|
||||
// Discard the last character (space)
|
||||
--n;
|
||||
|
||||
char buf[16] = {};
|
||||
|
||||
if (n < sizeof(buf)) {
|
||||
// Set the thread name as is
|
||||
memcpy(buf, log_category_prefix, n);
|
||||
}
|
||||
else {
|
||||
// Thread name is too long, use the "first 7 characters - last 7 characters" format
|
||||
constexpr size_t k = sizeof(buf) / 2 - 1;
|
||||
|
||||
memcpy(buf, log_category_prefix, k);
|
||||
buf[k] = '-';
|
||||
memcpy(buf + k + 1, log_category_prefix + n - k, k);
|
||||
}
|
||||
|
||||
set_thread_name(buf);
|
||||
}
|
||||
else {
|
||||
set_thread_name("TCPServer");
|
||||
}
|
||||
}
|
||||
|
||||
LOGINFO(1, "event loop started");
|
||||
server_event_loop_thread = data;
|
||||
@@ -863,7 +907,7 @@ void TCPServer::on_shutdown(uv_async_t* async)
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&s->m_dropConnectionsAsync), nullptr);
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&s->m_shutdownAsync), nullptr);
|
||||
|
||||
delete GetLoopUserData(&s->m_loop, false);
|
||||
DeleteLoopUserData(&s->m_loop);
|
||||
|
||||
s->m_numHandles = 0;
|
||||
uv_walk(&s->m_loop, [](uv_handle_t*, void* n) { (*reinterpret_cast<uint32_t*>(n))++; }, &s->m_numHandles);
|
||||
@@ -999,6 +1043,9 @@ TCPServer::Client::Client(char* read_buf, size_t size)
|
||||
, m_addrString{}
|
||||
, m_socks5ProxyState(Socks5ProxyState::Default)
|
||||
, m_resetCounter{ 0 }
|
||||
#ifdef WITH_TLS
|
||||
, m_tlsChecked(false)
|
||||
#endif
|
||||
{
|
||||
m_readBuf[0] = '\0';
|
||||
m_readBuf[m_readBufSize - 1] = '\0';
|
||||
@@ -1023,6 +1070,11 @@ void TCPServer::Client::reset()
|
||||
m_socks5ProxyState = Socks5ProxyState::Default;
|
||||
m_readBuf[0] = '\0';
|
||||
m_readBuf[m_readBufSize - 1] = '\0';
|
||||
|
||||
#ifdef WITH_TLS
|
||||
m_tls.reset();
|
||||
m_tlsChecked = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void TCPServer::Client::on_alloc(uv_handle_t* handle, size_t /*suggested_size*/, uv_buf_t* buf)
|
||||
@@ -1083,7 +1135,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()");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user