Compare commits
150 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ca1beeb73 | |||
| 85750521bb | |||
| 0255b801e5 | |||
| fa53bdea55 | |||
| e1acf7b786 | |||
| 54e0d3f3eb | |||
| eaee503d05 | |||
| 35f97b999c | |||
| 44ea8e4557 | |||
| f3d97dc3d6 | |||
| a32b4a6336 | |||
| 34f21e6236 | |||
| 964e4a6163 | |||
| f1b2c3c51f | |||
| b05361653e | |||
| 0019d9ff0d | |||
| 941e5114d8 | |||
| bec1a56f7d | |||
| dcfc64da42 | |||
| 9fee040ce0 | |||
| ca39b36337 | |||
| 7923f84233 | |||
| 7667f9d21e | |||
| 0741ad1c07 | |||
| f05ce6f697 | |||
| 23d3a24bc4 | |||
| 2cc5ba2fb9 | |||
| 93e3c07a18 | |||
| 7f0be0bcf5 | |||
| f8310f27b8 | |||
| 160ebd4289 | |||
| 6d6c12c1e8 | |||
| cf1c88b907 | |||
| 6449a78863 | |||
| d966088470 | |||
| 5faec12678 | |||
| 1bcddc8329 | |||
| 0905b23123 | |||
| 64914566c0 | |||
| ab80f55698 | |||
| 31860f2e65 | |||
| 6e7311a83c | |||
| e0a6daa5c7 | |||
| 313fb64b41 | |||
| 096e2e086b | |||
| d8ddaf80c8 | |||
| 2dc091f3d4 | |||
| 55cd2c9ae1 | |||
| 53cecac65b | |||
| d9de512b92 | |||
| 1bdf562967 | |||
| d0daa6ec41 | |||
| 1eb93fcd6b | |||
| 1cb4940960 | |||
| d5025965b4 | |||
| 6aba1edaf8 | |||
| 1166f31d07 | |||
| 3d2c9910f8 | |||
| 3584910baa | |||
| 8230040b76 | |||
| de28201edc | |||
| d9cea1cfc3 | |||
| 321d698be5 | |||
| 44a668cb15 | |||
| 8151a5a537 | |||
| b81a582154 | |||
| ee931ee178 | |||
| dbf0e58ee5 | |||
| 86e9e90744 | |||
| dec45532f8 | |||
| 0a15afb3eb | |||
| fe85c2ff8e | |||
| 5187049b7f | |||
| ba20d3c9db | |||
| 9830987cf2 | |||
| c23d0e5024 | |||
| d8662ad41e | |||
| e7e623fbdd | |||
| 27fbf2fc93 | |||
| 25a5361777 | |||
| 0451aebb8a | |||
| 5dc0cc4861 | |||
| 8d9bac3b0c | |||
| c41018bc5a | |||
| 55d1ee982c | |||
| 801c131172 | |||
| f6353a6939 | |||
| cb9fc89b22 | |||
| d88790237d | |||
| d8e4a00a32 | |||
| baf13781e4 | |||
| 4e690feefb | |||
| e2f0ec7c69 | |||
| 52bcbda381 | |||
| c490fe556a | |||
| 977cd73bbd | |||
| f14e6fd08e | |||
| 8826a6c02c | |||
| 2ce8ce65e2 | |||
| dd9d5b03aa | |||
| 741aaf95a8 | |||
| 6fc51d5a31 | |||
| e3d680ec46 | |||
| 571a5d5410 | |||
| 6b4c39f4c9 | |||
| e1da9ff4d3 | |||
| 5d7dfa2466 | |||
| fbe30b8fb1 | |||
| e53f712eb5 | |||
| fd6549849c | |||
| 22cabb5ac9 | |||
| 7cb6a0dcc3 | |||
| e9c14ef3d0 | |||
| eb09178a1c | |||
| 458c7a3389 | |||
| 82f3982175 | |||
| 0184a3139c | |||
| 26357f44ec | |||
| 85931f564a | |||
| 1e8e6c1010 | |||
| f6a1612ff1 | |||
| 1eb22109b5 | |||
| c0b99ac6fd | |||
| cff1210761 | |||
| bae7c65126 | |||
| 04d195d5cd | |||
| a4e1f00993 | |||
| 0d101f0ae6 | |||
| 2ae77e5b71 | |||
| 2e32d14d5f | |||
| 415ad70e2f | |||
| 6380e204dd | |||
| 12993dfe19 | |||
| a64753ecd0 | |||
| e9c7367b92 | |||
| 9f7dc5b768 | |||
| f141bef4b5 | |||
| 32e940577e | |||
| 012d148080 | |||
| d64b4ea2dc | |||
| a9e0b834d9 | |||
| 3a8ec27d93 | |||
| b69de65e78 | |||
| 44f8d941a7 | |||
| 8c1c5fd8e1 | |||
| bbfdeeaff5 | |||
| f12e43bb79 | |||
| a1544022cf | |||
| e2008578da | |||
| 9b5a43580e |
+48
-151
@@ -36,7 +36,7 @@ jobs:
|
||||
apk add git cmake gcc g++ make linux-headers xz
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -44,9 +44,8 @@ jobs:
|
||||
shell: alpine.sh {0}
|
||||
run: |
|
||||
cd external/src/curl
|
||||
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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
make -j$(nproc)
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
- name: Build libuv
|
||||
shell: alpine.sh {0}
|
||||
@@ -54,7 +53,7 @@ jobs:
|
||||
cd external/src/libuv
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -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 -DENABLE_CLANG_TIDY=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -105,7 +104,7 @@ jobs:
|
||||
file p2pool
|
||||
|
||||
- name: Archive binary
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool-alpine-static-${{ matrix.config.arch }}
|
||||
path: build/p2pool
|
||||
@@ -133,7 +132,7 @@ jobs:
|
||||
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev xz-utils ${{ matrix.config.c }} ${{ matrix.config.cpp }}
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -166,7 +165,7 @@ jobs:
|
||||
./p2pool_tests
|
||||
|
||||
- name: Archive binary
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool-${{ matrix.config.os }}-${{ matrix.config.c }}
|
||||
path: build/p2pool
|
||||
@@ -190,23 +189,22 @@ jobs:
|
||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
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_BUILD_TYPE=Release -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 -DENABLE_CLANG_TIDY=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -246,7 +244,7 @@ jobs:
|
||||
./p2pool_tests
|
||||
|
||||
- name: Archive binary
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool-ubuntu-static-libs
|
||||
path: build/p2pool
|
||||
@@ -268,23 +266,22 @@ jobs:
|
||||
sudo apt install -y git build-essential cmake xz-utils
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
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_BUILD_TYPE=Release -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 -DENABLE_CLANG_TIDY=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -324,107 +321,11 @@ jobs:
|
||||
./p2pool_tests
|
||||
|
||||
- name: Archive binary
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool-${{ matrix.config.os }}-aarch64
|
||||
path: build/p2pool
|
||||
|
||||
build-ubuntu-riscv64:
|
||||
|
||||
timeout-minutes: 60
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
config:
|
||||
- {os: ubuntu-22.04, flags: "-fuse-linker-plugin -ffunction-sections"}
|
||||
|
||||
steps:
|
||||
- name: Setup Alpine Linux
|
||||
uses: jirutka/setup-alpine@v1
|
||||
with:
|
||||
arch: riscv64
|
||||
branch: latest-stable
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y git build-essential cmake gcc-riscv64-linux-gnu g++-riscv64-linux-gnu binutils-riscv64-linux-gnu xz-utils
|
||||
sudo cp /usr/riscv64-linux-gnu/lib/* /home/runner/rootfs/alpine-latest-riscv64/lib
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/riscv64_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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
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_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/riscv64_toolchain.cmake -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build libzmq
|
||||
run: |
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/riscv64_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_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../cmake/riscv64_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=riscv64 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run self-test
|
||||
shell: alpine.sh {0}
|
||||
run: build/p2pool --test
|
||||
|
||||
- name: Build RandomX tests
|
||||
run: |
|
||||
cd build
|
||||
make -j$(nproc) randomx-tests
|
||||
|
||||
- name: Run RandomX tests
|
||||
shell: alpine.sh {0}
|
||||
run: build/external/src/RandomX/randomx-tests
|
||||
|
||||
- name: Build tests
|
||||
run: |
|
||||
cd tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../cmake/riscv64_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=riscv64 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool_tests
|
||||
|
||||
- name: Prepare test data
|
||||
run: |
|
||||
cd tests/build
|
||||
unxz *.xz
|
||||
|
||||
- name: Run tests
|
||||
shell: alpine.sh {0}
|
||||
run: |
|
||||
cd tests/build
|
||||
./p2pool_tests
|
||||
|
||||
- name: Archive binary
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: p2pool-${{ matrix.config.os }}-riscv64
|
||||
path: build/p2pool
|
||||
|
||||
build-windows-msys2:
|
||||
|
||||
timeout-minutes: 60
|
||||
@@ -433,8 +334,8 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
config:
|
||||
- {c: "gcc", cxx: "g++", flags: "-ffunction-sections -Wno-error=maybe-uninitialized -Wno-error=attributes -Wno-unknown-attributes"}
|
||||
- {c: "clang", cxx: "clang++", flags: "-fuse-ld=lld -Wno-unused-command-line-argument -Wno-nan-infinity-disabled -Wno-unknown-attributes"}
|
||||
- {c: "gcc", cxx: "g++", flags: "-ffunction-sections -Wno-error=maybe-uninitialized -Wno-error=attributes -Wno-attributes"}
|
||||
- {c: "clang", cxx: "clang++", flags: "-fuse-ld=lld -Wno-unused-command-line-argument -Wno-nan-infinity-disabled -Wno-attributes"}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
@@ -442,7 +343,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -459,16 +360,15 @@ jobs:
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
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_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
|
||||
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 -DENABLE_CLANG_TIDY=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -508,7 +408,7 @@ jobs:
|
||||
./p2pool_tests.exe
|
||||
|
||||
- name: Archive binary
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool-msys2-${{ matrix.config.c }}.exe
|
||||
path: build/p2pool.exe
|
||||
@@ -529,7 +429,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -580,35 +480,34 @@ jobs:
|
||||
p2pool_tests.exe
|
||||
|
||||
- name: Archive binary
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
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:
|
||||
|
||||
timeout-minutes: 60
|
||||
runs-on: macos-13
|
||||
timeout-minutes: 90
|
||||
runs-on: macos-26-intel
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
make -j4
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
- name: Build libuv
|
||||
run: |
|
||||
cd external/src/libuv
|
||||
mkdir build
|
||||
cd build
|
||||
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
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/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 -DENABLE_CLANG_TIDY=OFF
|
||||
make -j4
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -616,14 +515,14 @@ jobs:
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
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
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/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_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
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/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
|
||||
@@ -638,7 +537,7 @@ jobs:
|
||||
cd tests
|
||||
mkdir build
|
||||
cd build
|
||||
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
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/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_tests
|
||||
|
||||
- name: Run tests
|
||||
@@ -648,35 +547,34 @@ jobs:
|
||||
./p2pool_tests
|
||||
|
||||
- name: Archive binary
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool-macos-13
|
||||
name: p2pool-macos
|
||||
path: build/p2pool
|
||||
|
||||
build-macos-aarch64:
|
||||
|
||||
timeout-minutes: 30
|
||||
runs-on: macos-14
|
||||
runs-on: macos-26
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
make -j3
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
|
||||
- name: Build libuv
|
||||
run: |
|
||||
cd external/src/libuv
|
||||
mkdir build
|
||||
cd build
|
||||
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
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -target arm64-apple-macos-11' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DENABLE_CLANG_TIDY=OFF
|
||||
make -j3
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -684,14 +582,14 @@ jobs:
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
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
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/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_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
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/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
|
||||
@@ -706,7 +604,7 @@ jobs:
|
||||
cd tests
|
||||
mkdir build
|
||||
cd build
|
||||
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
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/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_tests
|
||||
|
||||
- name: Run tests
|
||||
@@ -716,9 +614,9 @@ jobs:
|
||||
./p2pool_tests
|
||||
|
||||
- name: Archive binary
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool-macos-11-aarch64
|
||||
name: p2pool-macos-aarch64
|
||||
path: build/p2pool
|
||||
|
||||
build-freebsd:
|
||||
@@ -736,7 +634,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -757,13 +655,12 @@ jobs:
|
||||
run: |
|
||||
sudo pkg install -y cmake
|
||||
cd external/src/curl
|
||||
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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
make -j4
|
||||
cd lib && mkdir .libs && cp libcurl.a .libs
|
||||
cd ../../libuv
|
||||
cd ../libuv
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -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 -DENABLE_CLANG_TIDY=OFF
|
||||
make -j4
|
||||
cd ../../libzmq
|
||||
mkdir build
|
||||
@@ -787,7 +684,7 @@ jobs:
|
||||
./p2pool_tests
|
||||
|
||||
- name: Archive binary
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool-${{ matrix.os.name }}-${{ matrix.os.version }}
|
||||
path: build/p2pool
|
||||
@@ -807,7 +704,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -838,7 +735,7 @@ jobs:
|
||||
./p2pool_tests
|
||||
|
||||
- name: Archive binary
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool-${{ matrix.os.name }}-${{ matrix.os.version }}
|
||||
path: build/p2pool
|
||||
|
||||
@@ -19,12 +19,12 @@ jobs:
|
||||
run: |
|
||||
wget https://apt.llvm.org/llvm.sh
|
||||
chmod +x llvm.sh
|
||||
sudo ./llvm.sh 21
|
||||
sudo apt-get install -y clang-tidy-21
|
||||
clang-tidy-21 --verify-config
|
||||
sudo ./llvm.sh 22
|
||||
sudo apt-get install -y clang-tidy-22
|
||||
clang-tidy-22 --verify-config
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -32,9 +32,9 @@ jobs:
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-21 -DCMAKE_CXX_COMPILER=clang++-21 -DDEV_CLANG_TIDY=ON -DSTATIC_LIBS=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-22 -DCMAKE_CXX_COMPILER=clang++-22 -DDEV_CLANG_TIDY=ON -DSTATIC_LIBS=ON -DWITH_INDEXED_HASHES=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
|
||||
- name: Run clang-tidy
|
||||
run: |
|
||||
cd src
|
||||
clang-tidy-21 *.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-22 *.cpp -p ../build -checks=bugprone-*,clang-analyzer-*,llvm-*,cppcoreguidelines-pro-type-const-cast,cppcoreguidelines-pro-type-cstyle-cast,cppcoreguidelines-rvalue-reference-param-not-moved,hicpp-use-emplace,hicpp-use-override,-bugprone-easily-swappable-parameters,-bugprone-empty-catch,-llvm-include-order,-bugprone-random-generator-seed,-llvm-use-ranges,-bugprone-throwing-static-initialization -warnings-as-errors=* -header-filter=^[^\./]
|
||||
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
sudo apt update && sudo apt install git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ jobs:
|
||||
run: |
|
||||
wget https://apt.llvm.org/llvm.sh
|
||||
chmod +x llvm.sh
|
||||
sudo ./llvm.sh 21 all
|
||||
sudo ./llvm.sh 22 all
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
cd tests
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DDEV_DEBUG=ON -DWITH_COVERAGE=ON -DCMAKE_C_COMPILER=clang-21 -DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DDEV_DEBUG=ON -DWITH_INDEXED_HASHES=ON -DWITH_COVERAGE=ON -DCMAKE_C_COMPILER=clang-22 -DCMAKE_CXX_COMPILER=clang++-22 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool_tests
|
||||
|
||||
- name: Run tests
|
||||
@@ -50,12 +50,12 @@ jobs:
|
||||
- name: Merge profile data
|
||||
run: |
|
||||
cd tests/build
|
||||
llvm-profdata-21 merge -sparse ./p2pool_tests.profraw -o ./p2pool_tests.profdata
|
||||
llvm-profdata-22 merge -sparse ./p2pool_tests.profraw -o ./p2pool_tests.profdata
|
||||
|
||||
- name: Export profile data
|
||||
run: |
|
||||
cd tests/build
|
||||
llvm-cov-21 export ./p2pool_tests -format=lcov -instr-profile=./p2pool_tests.profdata > coverage.info
|
||||
llvm-cov-22 export ./p2pool_tests -format=lcov -instr-profile=./p2pool_tests.profdata > coverage.info
|
||||
|
||||
- name: Run genhtml
|
||||
run: |
|
||||
@@ -63,7 +63,7 @@ jobs:
|
||||
genhtml --demangle-cpp -o coverage coverage.info
|
||||
|
||||
- name: Checkout GitHub Pages repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: SChernykh/SChernykh.github.io
|
||||
token: ${{ secrets.PAGES_DEPLOY_TOKEN }}
|
||||
@@ -85,7 +85,7 @@ jobs:
|
||||
|
||||
- name: Archive coverage data
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool-coverage
|
||||
path: tests/build/coverage
|
||||
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -32,14 +32,13 @@ jobs:
|
||||
- name: Build cppcheck
|
||||
run: |
|
||||
cd cppcheck-main
|
||||
git checkout 1d9ea2ffcca587f99c68f0b6a4c37d5b3e046c28
|
||||
make -j$(nproc) cppcheck
|
||||
|
||||
- name: cmake p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSTATIC_LIBS=ON -DWITH_GRPC=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSTATIC_LIBS=ON -DWITH_GRPC=OFF -DWITH_INDEXED_HASHES=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
python ../cppcheck/remove_external.py compile_commands.json
|
||||
|
||||
- name: Run cppcheck
|
||||
@@ -49,14 +48,14 @@ jobs:
|
||||
|
||||
- name: Archive full error list
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: errors_full-linux
|
||||
path: cppcheck/errors_full.txt
|
||||
|
||||
- name: Archive checkers report
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: checkers_report-linux
|
||||
path: cppcheck/checkers_report.txt
|
||||
@@ -68,7 +67,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -97,14 +96,14 @@ jobs:
|
||||
|
||||
- name: Archive full error list
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: errors_full-windows
|
||||
path: cppcheck/errors_full.txt
|
||||
|
||||
- name: Archive checkers report
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: checkers_report-windows
|
||||
path: cppcheck/checkers_report.txt
|
||||
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -58,13 +58,13 @@ jobs:
|
||||
|
||||
# Upload SARIF file to GitHub Code Scanning Alerts
|
||||
- name: Upload SARIF to GitHub
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
uses: github/codeql-action/upload-sarif@v4
|
||||
with:
|
||||
sarif_file: ${{ steps.run-analysis.outputs.sarif }}
|
||||
|
||||
# Upload SARIF file as an Artifact to download and view
|
||||
- name: Upload SARIF as an Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: sarif-file
|
||||
path: ${{ steps.run-analysis.outputs.sarif }}
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
XZ_OPT=-e9 tar --exclude=".git" --exclude="build" -f build/p2pool_source.tar.xz -c ../p2pool --xz
|
||||
|
||||
- name: Archive source code
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool_source.tar.xz
|
||||
path: build/p2pool_source.tar.xz
|
||||
|
||||
+131
-45
@@ -27,23 +27,22 @@ jobs:
|
||||
sudo apt install -y git build-essential cmake gcc-12 g++-12
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
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_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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
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
|
||||
cmake .. -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DENABLE_CLANG_TIDY=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -58,7 +57,7 @@ jobs:
|
||||
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 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
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 -DWITH_INDEXED_HASHES=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
@@ -71,13 +70,19 @@ jobs:
|
||||
sudo sysctl vm.mmap_rnd_bits=28
|
||||
TSAN_OPTIONS="suppressions=../tests/src/tsan_sup.txt halt_on_error=1 history_size=4" ./p2pool --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||
|
||||
- name: Check p2pool.log
|
||||
- name: Check synchronization
|
||||
run: |
|
||||
cd build
|
||||
grep 'Synchronization finished successfully' p2pool.log
|
||||
|
||||
- name: Check p2pool.log for errors
|
||||
run: |
|
||||
cd build
|
||||
../scripts/workflows/test-sync-check.sh
|
||||
|
||||
- name: Archive p2pool.log
|
||||
uses: actions/upload-artifact@v4
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool_ubuntu_data_tsan
|
||||
path: |
|
||||
@@ -86,7 +91,7 @@ jobs:
|
||||
|
||||
sync-test-ubuntu-msan:
|
||||
timeout-minutes: 60
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
@@ -98,14 +103,14 @@ jobs:
|
||||
run: |
|
||||
wget https://apt.llvm.org/llvm.sh
|
||||
chmod +x llvm.sh
|
||||
sudo ./llvm.sh 20 all
|
||||
sudo ./llvm.sh 22 all
|
||||
|
||||
- name: Build libcxx_msan
|
||||
run: |
|
||||
git clone --depth=1 https://github.com/llvm/llvm-project -b release/20.x
|
||||
git clone --depth=1 https://github.com/llvm/llvm-project -b release/22.x
|
||||
cd llvm-project
|
||||
mkdir build
|
||||
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
|
||||
cmake -G Ninja -S runtimes -B build -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DCMAKE_C_COMPILER=clang-22 -DCMAKE_CXX_COMPILER=clang++-22 -DLLVM_USE_SANITIZER=MemoryWithOrigins -DLIBCXXABI_USE_LLVM_UNWINDER=OFF
|
||||
ninja -C build cxx cxxabi
|
||||
cd build
|
||||
mkdir /tmp/libcxx_msan
|
||||
@@ -113,23 +118,22 @@ jobs:
|
||||
cp -r lib /tmp/libcxx_msan
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
cmake . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-22 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -O0 -fno-omit-frame-pointer -g3' -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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
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-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
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-22 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -O0 -fno-omit-frame-pointer -g3' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DENABLE_CLANG_TIDY=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -137,14 +141,14 @@ jobs:
|
||||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
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"
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-22 -DCMAKE_CXX_COMPILER=clang++-22 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -O0 -fno-omit-frame-pointer -g3' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -isystem /tmp/libcxx_msan/include/c++/v1 -O0 -fno-omit-frame-pointer -g3' -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-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"
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-22 -DCMAKE_CXX_COMPILER=clang++-22 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -fno-omit-frame-pointer' -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-22 -fno-omit-frame-pointer' -DDEV_TEST_SYNC=ON -DDEV_WITH_MSAN=ON -DWITH_LTO=OFF -DSTATIC_LIBS=ON -DWITH_INDEXED_HASHES=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
@@ -155,15 +159,21 @@ jobs:
|
||||
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 node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||
MSAN_OPTIONS="halt_on_error=1" ./p2pool --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --out-peers 50 --data-api data --local-api --loglevel 6
|
||||
|
||||
- name: Check p2pool.log
|
||||
- name: Check synchronization
|
||||
run: |
|
||||
cd build
|
||||
grep 'Synchronization finished successfully' p2pool.log
|
||||
|
||||
- name: Check p2pool.log for errors
|
||||
run: |
|
||||
cd build
|
||||
../scripts/workflows/test-sync-check.sh
|
||||
|
||||
- name: Archive p2pool.log
|
||||
uses: actions/upload-artifact@v4
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool_ubuntu_data_msan
|
||||
path: |
|
||||
@@ -183,7 +193,7 @@ jobs:
|
||||
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev gcc-12 g++-12
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -191,7 +201,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 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
cmake .. -DDEV_TEST_SYNC=ON -DDEV_WITH_UBSAN=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DWITH_LTO=OFF -DWITH_INDEXED_HASHES=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
@@ -204,13 +214,19 @@ jobs:
|
||||
sudo sysctl vm.mmap_rnd_bits=28
|
||||
UBSAN_OPTIONS="suppressions=../tests/src/ubsan_sup.txt halt_on_error=1" ./p2pool --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||
|
||||
- name: Check p2pool.log
|
||||
- name: Check synchronization
|
||||
run: |
|
||||
cd build
|
||||
grep 'Synchronization finished successfully' p2pool.log
|
||||
|
||||
- name: Check p2pool.log for errors
|
||||
run: |
|
||||
cd build
|
||||
../scripts/workflows/test-sync-check.sh
|
||||
|
||||
- name: Archive p2pool.log
|
||||
uses: actions/upload-artifact@v4
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool_ubuntu_data_ubsan
|
||||
path: |
|
||||
@@ -230,7 +246,7 @@ jobs:
|
||||
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev gcc-12 g++-12
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -238,7 +254,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 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
cmake .. -DDEV_TEST_SYNC=ON -DDEV_DEBUG=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 -DWITH_INDEXED_HASHES=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
@@ -251,49 +267,112 @@ jobs:
|
||||
sudo sysctl vm.mmap_rnd_bits=28
|
||||
ASAN_OPTIONS="detect_stack_use_after_return=1 atexit=1" ./p2pool --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||
|
||||
- name: Check p2pool.log
|
||||
- name: Check synchronization
|
||||
run: |
|
||||
cd build
|
||||
grep 'Synchronization finished successfully' p2pool.log
|
||||
|
||||
- name: Check p2pool.log for errors
|
||||
run: |
|
||||
cd build
|
||||
../scripts/workflows/test-sync-check.sh
|
||||
|
||||
- name: Archive p2pool.log
|
||||
uses: actions/upload-artifact@v4
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool_ubuntu_data_asan
|
||||
path: |
|
||||
build/*.log
|
||||
build/data/
|
||||
|
||||
sync-test-ubuntu-tysan:
|
||||
if: false # disabled because it generates a flood of type aliasing errors
|
||||
timeout-minutes: 60
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev
|
||||
|
||||
- name: Install clang
|
||||
run: |
|
||||
wget https://apt.llvm.org/llvm.sh
|
||||
chmod +x llvm.sh
|
||||
sudo ./llvm.sh 22 all
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build p2pool
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-22 -DCMAKE_CXX_COMPILER=clang++-22 -DDEV_TEST_SYNC=ON -DDEV_DEBUG=ON -DDEV_WITH_TYSAN=ON -DWITH_LTO=OFF -DWITH_INDEXED_HASHES=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
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
|
||||
TYSAN_OPTIONS=print_stacktrace=1 ./p2pool --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --out-peers 50 --data-api data --local-api --loglevel 6 --light-mode 2> stderr.log
|
||||
|
||||
- name: Check synchronization
|
||||
run: |
|
||||
cd build
|
||||
grep 'Synchronization finished successfully' p2pool.log
|
||||
|
||||
- name: Check p2pool.log for errors
|
||||
run: |
|
||||
cd build
|
||||
../scripts/workflows/test-sync-check.sh
|
||||
|
||||
- name: Archive p2pool.log
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool_ubuntu_data_tysan
|
||||
path: |
|
||||
build/*.log
|
||||
build/data/
|
||||
|
||||
sync-test-macos:
|
||||
|
||||
timeout-minutes: 60
|
||||
timeout-minutes: 120
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
config:
|
||||
- {os: macos-13, flags: ""}
|
||||
- {os: macos-14, flags: "-target arm64-apple-macos-11"}
|
||||
- {os: macos-26-intel, flags: ""}
|
||||
- {os: macos-26, flags: "-target arm64-apple-macos-11"}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- 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_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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
cmake . -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/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 -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
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
|
||||
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DENABLE_CLANG_TIDY=OFF
|
||||
make -j4
|
||||
|
||||
- name: Build libzmq
|
||||
@@ -301,14 +380,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='${{ 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
|
||||
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/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 -DDEV_DEBUG=ON
|
||||
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/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 -DWITH_INDEXED_HASHES=ON
|
||||
make -j4 p2pool
|
||||
|
||||
- name: Run p2pool
|
||||
@@ -320,13 +399,19 @@ jobs:
|
||||
python3 ../tests/src/stratum_dummy.py 3 &
|
||||
./p2pool --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||
|
||||
- name: Check p2pool.log
|
||||
- name: Check synchronization
|
||||
run: |
|
||||
cd build
|
||||
grep 'Synchronization finished successfully' p2pool.log
|
||||
|
||||
- name: Check p2pool.log for errors
|
||||
run: |
|
||||
cd build
|
||||
../scripts/workflows/test-sync-check.sh
|
||||
|
||||
- name: Archive p2pool.log
|
||||
uses: actions/upload-artifact@v4
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool_${{ matrix.config.os }}_data
|
||||
path: |
|
||||
@@ -340,7 +425,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -351,7 +436,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 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_TEST_SYNC=ON -DDEV_WITH_ASAN=ON -DDEV_DEBUG=ON -DWITH_INDEXED_HASHES=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
|
||||
@@ -371,7 +456,8 @@ jobs:
|
||||
findstr /C:"Synchronization finished successfully" p2pool.log
|
||||
|
||||
- name: Archive p2pool.log
|
||||
uses: actions/upload-artifact@v4
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool_windows_data_debug_asan
|
||||
path: |
|
||||
@@ -385,7 +471,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -396,7 +482,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 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
|
||||
cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_VERSION="10.0" -DDEV_TEST_SYNC=ON -DDEV_DEBUG=ON -DDEV_TRACK_MEMORY=ON -DWITH_INDEXED_HASHES=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
|
||||
@@ -416,7 +502,7 @@ jobs:
|
||||
|
||||
- name: Archive p2pool.log
|
||||
if: '!cancelled()'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: p2pool_windows_data_leaks
|
||||
path: |
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
SChernykh <15806605+SChernykh@users.noreply.github.com> sech1 <sech1@sech1>
|
||||
+19
-4
@@ -18,6 +18,7 @@ option(WITH_LTO "Use link-time compiler optimization (if linking fails for you,
|
||||
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, and lack many other security features. It's recommended to keep it ON!" ON)
|
||||
option(WITH_INDEXED_HASHES "Save memory used for storing transaction hashes and public keys (a bit slower block verification - use it only if you compile for a very low memory system)" OFF)
|
||||
|
||||
option(WITH_MERGE_MINING_DONATION "Merge mine donations to the author. This doesn't affect your hashrate or payouts in any way - only unused merge mining capacity will be utilised. If you merge mine yourself, your settings will take priority." ON)
|
||||
|
||||
@@ -26,12 +27,15 @@ option(DEV_WITH_TSAN "[Developer only] Compile with thread sanitizer" OFF)
|
||||
option(DEV_WITH_MSAN "[Developer only] Compile with memory sanitizer" OFF)
|
||||
option(DEV_WITH_UBSAN "[Developer only] Compile with undefined behavior sanitizer" OFF)
|
||||
option(DEV_WITH_ASAN "[Developer only] Compile with address sanitizer" OFF)
|
||||
option(DEV_WITH_TYSAN "[Developer only] Compile with type 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)
|
||||
|
||||
set(BUILD_TESTING OFF CACHE BOOL "CMake's CTest module")
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
include(cmake/msvc_libs.cmake)
|
||||
endif()
|
||||
@@ -43,7 +47,7 @@ if (WITH_GRPC)
|
||||
add_subdirectory(external/src/Tari)
|
||||
elseif (WITH_TLS)
|
||||
add_subdirectory(cmake/ssl)
|
||||
include_directories(external/src/grpc/third_party/boringssl-with-bazel/src/include)
|
||||
include_directories(external/src/grpc/third_party/boringssl-with-bazel/include)
|
||||
endif()
|
||||
|
||||
if (WITH_RANDOMX)
|
||||
@@ -127,12 +131,14 @@ set(HEADERS
|
||||
src/uv_util.h
|
||||
src/wallet.h
|
||||
src/zmq_reader.h
|
||||
src/i2p.h
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
external/src/crypto/sha256.c
|
||||
external/src/cryptonote/crypto-ops-data.c
|
||||
external/src/cryptonote/crypto-ops.c
|
||||
external/src/cryptonote/fcmp_pp_crypto.cpp
|
||||
external/src/hardforks/hardforks.cpp
|
||||
src/block_cache.cpp
|
||||
src/block_template.cpp
|
||||
@@ -159,6 +165,7 @@ set(SOURCES
|
||||
src/util.cpp
|
||||
src/wallet.cpp
|
||||
src/zmq_reader.cpp
|
||||
src/i2p.cpp
|
||||
)
|
||||
|
||||
if (AMD64)
|
||||
@@ -188,6 +195,11 @@ if (WITH_TLS)
|
||||
set(SOURCES ${SOURCES} src/tls.cpp)
|
||||
endif()
|
||||
|
||||
if (WITH_INDEXED_HASHES)
|
||||
add_compile_definitions(WITH_INDEXED_HASHES)
|
||||
set(SOURCES ${SOURCES} src/indexed_hash.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})
|
||||
|
||||
@@ -257,14 +269,14 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
||||
find_library(UV_LIBRARY_DEBUG NAMES uv libuv.a)
|
||||
find_library(UV_LIBRARY NAMES uv libuv.a)
|
||||
if (WIN32)
|
||||
find_library(CURL_LIBRARY_DEBUG NAMES libcurl.a PATHS "external/src/curl/lib" NO_DEFAULT_PATH)
|
||||
find_library(CURL_LIBRARY_DEBUG NAMES libcurl-d.a PATHS "external/src/curl/lib" NO_DEFAULT_PATH)
|
||||
find_library(CURL_LIBRARY NAMES libcurl.a PATHS "external/src/curl/lib" NO_DEFAULT_PATH)
|
||||
else()
|
||||
if (CURL_LIBRARIES)
|
||||
set(CURL_LIBRARY_DEBUG ${CURL_LIBRARIES})
|
||||
set(CURL_LIBRARY ${CURL_LIBRARIES})
|
||||
else()
|
||||
find_library(CURL_LIBRARY_DEBUG NAMES curl)
|
||||
find_library(CURL_LIBRARY_DEBUG NAMES curl-d)
|
||||
find_library(CURL_LIBRARY NAMES curl)
|
||||
endif()
|
||||
endif()
|
||||
@@ -394,6 +406,8 @@ if (WIN32 AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
|
||||
add_definitions(-DNDEBUG)
|
||||
endif()
|
||||
|
||||
include(cmake/git.cmake)
|
||||
|
||||
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES})
|
||||
|
||||
if (STATIC_BINARY OR STATIC_LIBS)
|
||||
@@ -448,7 +462,8 @@ if (STATIC_BINARY OR STATIC_LIBS)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME}
|
||||
"${CMAKE_SOURCE_DIR}/external/src/libzmq/build/lib/libzmq.a"
|
||||
"${CMAKE_SOURCE_DIR}/external/src/libuv/build/libuv.a"
|
||||
"${CMAKE_SOURCE_DIR}/external/src/curl/lib/libcurl.a"
|
||||
debug "${CMAKE_SOURCE_DIR}/external/src/curl/lib/libcurl-d.a"
|
||||
optimized "${CMAKE_SOURCE_DIR}/external/src/curl/lib/libcurl.a"
|
||||
${STATIC_LIBS}
|
||||
)
|
||||
else()
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
|
||||
Decentralized pool for Monero mining.
|
||||
|
||||
Pool status and monitoring pages can be found at https://p2pool.io/, https://p2pool.io/mini/ and https://p2pool.observer/, https://mini.p2pool.observer/
|
||||
Pool status and monitoring pages can be found at:
|
||||
|
||||
|P2Pool||
|
||||
|-|-|
|
||||
|main|https://p2pool.io/ <br> https://p2pool.observer/|
|
||||
|mini|https://p2pool.io/mini/ <br> https://mini.p2pool.observer/|
|
||||
|nano|https://p2pool.io/nano/ <br> https://nano.p2pool.observer/|
|
||||
|
||||
These are 3rd-party pages. If they are down, it doesn't mean there is a problem with P2Pool itself - it keeps mining always thanks to its decentralized nature.
|
||||
|
||||
@@ -60,6 +66,7 @@ Here's the comparison table of the different ways of mining. While pool mining i
|
||||
* Advanced mempool picking algorithm, it creates blocks with better reward than what monerod solo mining does
|
||||
* Password protected private pools
|
||||
* Highly reliable configurations are supported (multiple P2Pool nodes mining to the same wallet, each P2Pool node can use multiple Monero nodes and switch on the fly if an issue is detected)
|
||||
* Mining through [TOR](docs/TOR.MD) and [I2P](docs/I2P.MD) are fully supported
|
||||
|
||||
## How payouts work in P2Pool
|
||||
|
||||
@@ -82,19 +89,23 @@ 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.4.1 is recommended|v4.0 or newer
|
||||
|v15, v16 (active after August 13th, 2022)|v0.18.0.0 or newer, v0.18.4.2 is recommended|v4.0 or newer
|
||||
|
||||
## How to mine on P2Pool
|
||||
|
||||
### General Considerations
|
||||
|
||||
- In order to mine on P2Pool, a synced Monero node using monerod v0.18.0.0 or newer is required. If you don't currently have one, you can download the [official Monero binaries](https://www.getmonero.org/downloads/), start `monerod` on your PC and wait until it's fully synced. Advanced Monero node setup instructions are [here](https://sethforprivacy.com/guides/run-a-monero-node-advanced/).
|
||||
- It is highly recommended that you create a separate restricted user account (in your OS) for mining. While P2Pool has been battle-tested for a long time now, any software may have unknown bugs/vulnerabilities.
|
||||
- You have to use a primary wallet address (the one starting with `4`) for mining. Subaddresses and integrated addresses are not supported, just like with monerod solo mining.
|
||||
- You can add the `--mini` parameter to your P2Pool command to connect to the **p2pool-mini** sidechain. Note that it will also change the default p2p port from 37889 to 37888.
|
||||
- Check that ports 18080 (Monero p2p port) and 37889/37888 (P2Pool/P2Pool mini p2p port) are open in your firewall to ensure better connectivity. If you're mining from a computer behind NAT (like a router) you could consider forwarding the ports to your local machine.
|
||||
- It is highly recommended that you create a separate restricted user account (in your OS) for mining. While P2Pool has been battle-tested for a long time now, any software may have unknown bugs/vulnerabilities.
|
||||
- You can mine to a primary wallet address (the one starting with `4`) for mining. If you want to mine to a subaddress, you will need to provide both the main address (starting with 4) and the subaddress (starting with 8) using `--wallet` and `--subaddress` command line parameters.
|
||||
- You can add the `--mini` or `--nano` parameter to your P2Pool command to connect to the respective sidechain.
|
||||
> [!NOTE]
|
||||
> You cannot use both `--mini` and `--nano` together<br>
|
||||
> Using `--mini` will change the p2p port to 37888.<br>
|
||||
> Using `--nano` will change the p2p port to 37890.<br>
|
||||
- Check that ports 18080 (Monero p2p port) and 37889/37888/37890 (P2Pool default/mini/nano p2p port) are open in your firewall to ensure better connectivity. If you're mining from a computer behind NAT (like a router) you could consider forwarding the ports to your local machine.
|
||||
- You can connect multiple miners to the same P2Pool node. The more the better!
|
||||
- The steps below assume that you run everything on the same machine. If it's not the case, change `127.0.0.1` to appropriate IP addresses for your setup.
|
||||
- The steps below assume that you run everything on the same machine. If it's not the case, change `127.0.0.1` to appropriate IP addresses for your setup.
|
||||
- It is highly recommended to create a new mainnet wallet for P2Pool mining because **wallet addresses are public on P2Pool**.
|
||||
|
||||
**Wallet software compatible with P2Pool payouts**
|
||||
@@ -103,11 +114,10 @@ In order to continue mining on P2Pool, you must update both Monero and P2Pool so
|
||||
- [Cake Wallet v4.4.5 and newer](https://cakewallet.com/)
|
||||
- [Monero.com by Cake Wallet](https://monero.com/)
|
||||
- [Feather Wallet v2.1.0 and newer](https://featherwallet.org/)
|
||||
- [MyMonero](https://mymonero.com/)
|
||||
|
||||
### GUI for P2Pool
|
||||
|
||||
- [Gupax](https://github.com/hinto-janai/gupax) project aims to provide an easy to use cross-platform GUI to configure and run P2Pool & [XMRig](https://github.com/xmrig/xmrig).
|
||||
- [Gupax](https://github.com/gupax-io/gupax) project aims to provide an easy to use cross-platform GUI to configure and run P2Pool & [XMRig](https://github.com/xmrig/xmrig).
|
||||
|
||||
### Merge mining
|
||||
|
||||
@@ -115,7 +125,7 @@ Merge mining is available in P2Pool since the fork that happened on October 12th
|
||||
|
||||
Blockchains that will support [Merge mining RPC API](https://github.com/SChernykh/p2pool/blob/master/docs/MERGE_MINING.MD#proposed-rpc-api):
|
||||
- [Townforge](https://townforge.net/) supports it in their [tmp-mm branch](https://git.townforge.net/townforge/townforge/src/branch/tmp-mm) (not released yet)
|
||||
- [DarkFi](https://dark.fi/) is going to support it, but it's [not ready yet](https://github.com/darkrenaissance/darkfi/issues/244)
|
||||
- [DarkFi](https://dark.fi/) supports it in their [testnet](https://dark.fi/book/testnet/merge-mining.html)
|
||||
```
|
||||
p2pool.exe --wallet YOUR_MONERO_WALLET_ADDRESS --merge-mine IP:port YOUR_WALLET_ADDRESS_ON_ANOTHER_BLOCKCHAIN
|
||||
```
|
||||
@@ -147,15 +157,15 @@ Note that Tari will be mined in solo mode (only full Tari blocks can be mined fo
|
||||
1. Download the latest P2Pool binaries [here](https://github.com/SChernykh/p2pool/releases/latest).
|
||||
- Alternatively, grab the latest source code for P2Pool and [build it](#build-instructions).
|
||||
2. Download the latest XMRig (linux-static-x64) binary [here](https://github.com/xmrig/xmrig/releases/latest).
|
||||
3. Prepare enough huge pages (each of monerod/P2Pool/XMRig needs them):
|
||||
3. Prepare enough huge pages (each of monerod/P2Pool/XMRig needs them):
|
||||
```
|
||||
sudo sysctl vm.nr_hugepages=3072
|
||||
```
|
||||
4. Check that ports 18080 (Monero p2p port) and 37889/37888 (P2Pool/P2Pool mini p2p port) are open in your local firewall to ensure better connectivity.
|
||||
5. Start `monerod` with the following command/options:
|
||||
4. Check that ports 18080 (Monero p2p port) and 37889/37888/37890 (P2Pool default/mini/nano p2p port) are open in your local firewall to ensure better connectivity.
|
||||
5. Start `monerod` with the following command/options:
|
||||
```
|
||||
./monerod --zmq-pub tcp://127.0.0.1:18083 --out-peers 32 --in-peers 64 --add-priority-node=p2pmd.xmrvsbeast.com:18080 --add-priority-node=nodes.hashvault.pro:18080 --enforce-dns-checkpointing --enable-dns-blocklist
|
||||
```
|
||||
```
|
||||
**Note:**
|
||||
The `--zmq-pub` option is required for P2Pool to work properly.
|
||||
|
||||
@@ -177,16 +187,16 @@ The `--zmq-pub` option is required for P2Pool to work properly.
|
||||
```
|
||||
./xmrig -o 127.0.0.1:3333
|
||||
```
|
||||
- Note that you don't need to specify your wallet address for XMRig. **Wallet addresses set in XMRig config will be ignored!**
|
||||
- To set a custom fixed difficulty for your miner (for example, 10000), instead start XMRig with the following options:
|
||||
- Note that you don't need to specify your wallet address for XMRig. **Wallet addresses set in XMRig config will be ignored!**
|
||||
- To set a custom fixed difficulty for your miner (for example, 10000), instead start XMRig with the following options:
|
||||
```
|
||||
./xmrig -u x+10000 -o 127.0.0.1:3333
|
||||
```
|
||||
9. XMRig should connect and start mining!
|
||||
|
||||
**Additional Information:**
|
||||
**Additional Information:**
|
||||
- For a more in-depth beginner friendly walk-through with the option of using Docker, please see SethForPrivacy's guide at: https://sethforprivacy.com/guides/run-a-p2pool-node/
|
||||
- You can check the p2pool.log for any warnings or errors using the following command:
|
||||
- You can check the p2pool.log for any warnings or errors using the following command:
|
||||
```
|
||||
grep -E 'WARNING|ERROR' p2pool.log
|
||||
```
|
||||
@@ -203,7 +213,7 @@ nocreate
|
||||
}
|
||||
```
|
||||
|
||||
### Windows
|
||||
### Windows
|
||||
|
||||
**Note:** *Windows SmartScreen may block incoming connections by files that are "Downloaded from the Internet". You can allow 'p2pool.exe' and 'monerod.exe' by double-clicking them, clicking "More Info", then click "Run Anyway" and then closing them immediately so you can run them from the command line. Advanced users can use the PowerShell cmdlet `Unblock-File` to remove this flag.*
|
||||
|
||||
@@ -211,8 +221,8 @@ nocreate
|
||||
- Alternatively, grab the latest source code for P2Pool and [build it](#build-instructions).
|
||||
2. Download the latest XMRig binary [here](https://github.com/xmrig/xmrig/releases/latest).
|
||||
3. Expand the P2Pool binaries into an appropriate location (`%USERPROFILE%/bin` or `C:/bin/` are good options)
|
||||
4. Expand XMRig binary into an appropriate location (the same folder as P2Pool is fine).
|
||||
5. Prepare huge pages to work properly (each of monerod/P2Pool/XMRig needs them):
|
||||
4. Expand XMRig binary into an appropriate location (the same folder as P2Pool is fine).
|
||||
5. Prepare huge pages to work properly (each of monerod/P2Pool/XMRig needs them):
|
||||
- On Windows 10 or above, run XMRig at least once as Administrator (right-click Run As Administrator)
|
||||
- On earlier versions of Windows, you'll need to run XMRig as Administrator at least once per login.
|
||||
6. Create "Monero" folder inside extracted P2Pool folder and copy Monero binaries there.
|
||||
@@ -220,7 +230,7 @@ nocreate
|
||||
|
||||
**Note:** *When running the below commands, Windows Firewall may prompt to allow connections, click "Allow" if prompted.*
|
||||
|
||||
8. Start `monerod` with the following command/options:
|
||||
8. Start `monerod` with the following command/options:
|
||||
```
|
||||
.\Monero\monerod.exe --zmq-pub tcp://127.0.0.1:18083 --out-peers 32 --in-peers 64 --add-priority-node=p2pmd.xmrvsbeast.com:18080 --add-priority-node=nodes.hashvault.pro:18080 --enforce-dns-checkpointing --enable-dns-blocklist
|
||||
```
|
||||
@@ -244,8 +254,8 @@ The `--zmq-pub` option is required for P2Pool to work properly.
|
||||
```
|
||||
.\xmrig.exe -o 127.0.0.1:3333
|
||||
```
|
||||
- Note that you don't need to specify your wallet address for XMRig. **Wallet addresses set in XMRig config will be ignored!**
|
||||
- To set a custom fixed difficulty for your miner (for example, 10000), instead start XMRig with the following options:
|
||||
- Note that you don't need to specify your wallet address for XMRig. **Wallet addresses set in XMRig config will be ignored!**
|
||||
- To set a custom fixed difficulty for your miner (for example, 10000), instead start XMRig with the following options:
|
||||
```
|
||||
xmrig.exe -u x+10000 -o 127.0.0.1:3333
|
||||
```
|
||||
@@ -289,7 +299,7 @@ pacman -S p2pool
|
||||
|
||||
### [Nix/NixOS](https://nixos.org)
|
||||
|
||||
This is a flake only project. So you have to use [nixUnstable with nix flakes](https://nixos.wiki/wiki/Flakes) to build or install P2Pool.
|
||||
This is a flake only project. So you have to use [nixUnstable with nix flakes](https://nixos.wiki/wiki/Flakes) to build or install P2Pool.
|
||||
The commands below use the new flake specific reference-format, so be sure to also set `ca-references` in `--experimental-features`.
|
||||
|
||||
Because this project has submodules which are not fixed in _nixUnstable_ yet you have to use the `nix/master` branch:
|
||||
@@ -320,7 +330,7 @@ cmake .. -G "Visual Studio 16 2019"
|
||||
```
|
||||
then open generated build\p2pool.sln in Visual Studio and build it there
|
||||
|
||||
Alternatively, you can select "Clone a repository" within the GUI, then select "Build" from the menu.
|
||||
Alternatively, you can select "Clone a repository" within the GUI, then select "Build" from the menu.
|
||||
|
||||
### macOS
|
||||
|
||||
|
||||
+6
-2
@@ -73,7 +73,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
endif()
|
||||
endif()
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
set(GENERAL_FLAGS "/MP /EHa")
|
||||
set(GENERAL_FLAGS "/MP /EHa /permissive-")
|
||||
set(WARNING_FLAGS "/Wall /WX /sdl")
|
||||
set(SECURITY_FLAGS "/GS /guard:cf")
|
||||
set(OPTIMIZATION_FLAGS "/O2 /Oi /Ob2 /Ot /Oy /DNDEBUG /GL")
|
||||
@@ -113,6 +113,10 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
||||
set(GENERAL_FLAGS "${GENERAL_FLAGS} -mfix-cortex-a53-835769")
|
||||
endif()
|
||||
|
||||
if (DEV_WITH_TYSAN)
|
||||
set(GENERAL_FLAGS "${GENERAL_FLAGS} -fno-omit-frame-pointer -fsanitize=type")
|
||||
endif()
|
||||
|
||||
set(WARNING_FLAGS "-Wall -Wextra -Wno-unused-function -Wno-undefined-internal -Wno-unknown-warning-option -Wno-nan-infinity-disabled -Wunreachable-code-aggressive -Wmissing-prototypes -Wmissing-variable-declarations -Werror")
|
||||
|
||||
if (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 20))
|
||||
@@ -123,7 +127,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
||||
set(WARNING_FLAGS "-w")
|
||||
endif()
|
||||
|
||||
if (DEV_WITH_MSAN OR DEV_DEBUG OR (CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
|
||||
if (DEV_WITH_MSAN OR DEV_WITH_TYSAN 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")
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
if (GIT_COMMIT)
|
||||
message(STATUS "GIT_COMMIT is set to ${GIT_COMMIT}")
|
||||
else()
|
||||
set(GIT_COMMIT "unknown")
|
||||
|
||||
find_program(GIT_EXECUTABLE git)
|
||||
|
||||
if (GIT_EXECUTABLE)
|
||||
execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --short=7 HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
RESULT_VARIABLE RET
|
||||
OUTPUT_VARIABLE COMMIT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if (RET EQUAL 0)
|
||||
set(GIT_COMMIT "${COMMIT}")
|
||||
|
||||
execute_process(COMMAND git status --porcelain
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
RESULT_VARIABLE RET
|
||||
OUTPUT_VARIABLE GIT_UNSTAGED
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(GIT_UNSTAGED OR RET)
|
||||
set(GIT_COMMIT "${GIT_COMMIT} (dirty)")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "You are currently on commit ${GIT_COMMIT}")
|
||||
endif()
|
||||
|
||||
add_compile_definitions(GIT_COMMIT="${GIT_COMMIT}")
|
||||
+1
-1
@@ -40,6 +40,6 @@ add_definitions(-DGRPC_NO_XDS)
|
||||
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/boringssl-with-bazel/include)
|
||||
include_directories(external/src/grpc/third_party/protobuf/src)
|
||||
include_directories(external/src/grpc/include)
|
||||
|
||||
@@ -3,7 +3,7 @@ set(CMAKE_CROSSCOMPILING TRUE)
|
||||
|
||||
set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
||||
|
||||
set(CMAKE_C_COMPILER /usr/local/bin/aarch64-apple-darwin24.5-clang)
|
||||
set(CMAKE_CXX_COMPILER /usr/local/bin/aarch64-apple-darwin24.5-clang++)
|
||||
set(CMAKE_ASM_COMPILER /usr/local/bin/aarch64-apple-darwin24.5-as)
|
||||
set(CMAKE_STRIP /usr/local/bin/aarch64-apple-darwin24.5-strip)
|
||||
set(CMAKE_C_COMPILER /usr/local/bin/aarch64-apple-darwin25.1-clang)
|
||||
set(CMAKE_CXX_COMPILER /usr/local/bin/aarch64-apple-darwin25.1-clang++)
|
||||
set(CMAKE_ASM_COMPILER /usr/local/bin/aarch64-apple-darwin25.1-as)
|
||||
set(CMAKE_STRIP /usr/local/bin/aarch64-apple-darwin25.1-strip)
|
||||
|
||||
@@ -3,7 +3,7 @@ set(CMAKE_CROSSCOMPILING TRUE)
|
||||
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
|
||||
set(CMAKE_C_COMPILER /usr/local/bin/x86_64-apple-darwin24.5-clang)
|
||||
set(CMAKE_CXX_COMPILER /usr/local/bin/x86_64-apple-darwin24.5-clang++)
|
||||
set(CMAKE_ASM_COMPILER /usr/local/bin/x86_64-apple-darwin24.5-as)
|
||||
set(CMAKE_STRIP /usr/local/bin/x86_64-apple-darwin24.5-strip)
|
||||
set(CMAKE_C_COMPILER /usr/local/bin/x86_64-apple-darwin25.1-clang)
|
||||
set(CMAKE_CXX_COMPILER /usr/local/bin/x86_64-apple-darwin25.1-clang++)
|
||||
set(CMAKE_ASM_COMPILER /usr/local/bin/x86_64-apple-darwin25.1-as)
|
||||
set(CMAKE_STRIP /usr/local/bin/x86_64-apple-darwin25.1-strip)
|
||||
|
||||
@@ -56,7 +56,7 @@ 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 "")
|
||||
set(OPENSSL_INCLUDE_DIR "../grpc/third_party/boringssl-with-bazel/include" CACHE STRING "")
|
||||
endif()
|
||||
|
||||
add_subdirectory(external/src/curl)
|
||||
|
||||
@@ -33,7 +33,7 @@ docker compose up
|
||||
```
|
||||
|
||||
#### Optional
|
||||
* Open ports 18080 (Monero p2p port) and 37889 (P2Pool p2p port) or 37888 (P2Pool-mini p2p port) in your firewall to ensure better connectivity. If you're mining from a computer behind NAT (like a router) you could consider forwarding the ports to your local machine
|
||||
* Open ports 18080 (Monero p2p port) and 37889/37888/37890 (P2Pool default/mini/nano p2p port) in your firewall to ensure better connectivity. If you're mining from a computer behind NAT (like a router) you could consider forwarding the ports to your local machine
|
||||
* An XMRig CPU miner is included by default, but you can connect additional miners to this same p2pool node using port 3333 (or alternate if configured) when you set it as "exposed" in the configuration
|
||||
* Configure your kernel for maximum mining performance: [XMRig RandomX Optimization Guide](https://xmrig.com/docs/miner/randomx-optimization-guide)
|
||||
* Many optional configurations and customizations are available by running './configure'
|
||||
@@ -54,4 +54,5 @@ Change to p2pool/docker-compose directory <br />
|
||||
Stop and remove all containers: ```docker compose down``` <br />
|
||||
Remove the p2pool data: ```docker volume rm p2pool``` <br />
|
||||
Remove the p2pool-mini data: ```docker volume rm p2pool-mini``` <br />
|
||||
Remove the p2pool-nano data: ```docker volume rm p2pool-nano``` <br />
|
||||
Remove the monero data: ```docker volume rm monero```
|
||||
|
||||
@@ -37,7 +37,8 @@ class P2PoolHelpBox(HelpBoxBase):
|
||||
"P2Pool Sidechain:": [
|
||||
"Which P2Pool sidechain to mine on",
|
||||
" use main for faster miners",
|
||||
" use mini for slower miners",
|
||||
" use mini for slow miners (>30kH/s)",
|
||||
" use nano for slower miners (<30kH/s)",
|
||||
],
|
||||
"Enable Server Statistics": [
|
||||
"Provide access to your P2Pool server statictics via a web interface",
|
||||
@@ -364,7 +365,7 @@ class P2PoolConfigForm(ConfigFormBase):
|
||||
self.sidechain = self.add(
|
||||
npyscreen.TitleSelectOne,
|
||||
name="P2Pool Sidechain:",
|
||||
values=["main", "mini"],
|
||||
values=["main", "mini", "nano"],
|
||||
scroll_exit=True,
|
||||
max_height=2,
|
||||
value=[
|
||||
|
||||
@@ -7,10 +7,12 @@ networks:
|
||||
|
||||
volumes:
|
||||
p2pool:
|
||||
{% if sidechain[0] == 0 %}
|
||||
name: p2pool
|
||||
{% else %}
|
||||
{% if sidechain[0] == 1 %}
|
||||
name: p2pool-mini
|
||||
{% elif sidechain[0] == 2 %}
|
||||
name: p2pool-nano
|
||||
{% else %}
|
||||
name: p2pool
|
||||
{% endif %}
|
||||
|
||||
{% if configure_monero == True %}
|
||||
@@ -55,6 +57,8 @@ services:
|
||||
--loglevel {{ p2pool_log_level | int }}
|
||||
{% if sidechain[0] == 1 %}
|
||||
--mini
|
||||
{% elif sidechain[0] == 2 %}
|
||||
--nano
|
||||
{% endif %}
|
||||
{% if enable_autodiff == False %}
|
||||
--no-autodiff
|
||||
|
||||
+33
-3
@@ -1,7 +1,8 @@
|
||||
### P2Pool command line options
|
||||
|
||||
```
|
||||
--wallet Wallet address to mine to. Subaddresses and integrated addresses are not supported!
|
||||
--wallet Main wallet address (the one that starts with 4...). To mine to a subaddress of this wallet, use it together with --subaddress
|
||||
--subaddress Subaddress to mine to. It must belong to the same wallet that was specified with --wallet parameter
|
||||
--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)
|
||||
@@ -12,6 +13,7 @@
|
||||
--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
|
||||
--log-file Path to the log file, default is "p2pool.log" in p2pool's working 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
|
||||
@@ -22,11 +24,12 @@
|
||||
--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
|
||||
--nano Connect to p2pool-nano sidechain. Note that it will also change default p2p port from 37889 to 37890
|
||||
--mini Connect to p2pool-mini sidechain. Note that it will also change default p2p port from 37889 to 37888. Cannot be used with --nano.
|
||||
--nano Connect to p2pool-nano sidechain. Note that it will also change default p2p port from 37889 to 37890. Cannot be used with --mini.
|
||||
--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
|
||||
--socks5-proxy-type The type of SOCKS5 proxy. Can be one of the following values: auto, plain, tor. Default is auto (auto-detect by the port number)
|
||||
--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
|
||||
@@ -38,8 +41,13 @@
|
||||
--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)
|
||||
--stratum-proxy-protocol Enable HAProxy PROXY protocol v2 for incoming Stratum connections (use with HAProxy send-proxy-v2)
|
||||
--p2p-proxy-protocol Enable HAProxy PROXY protocol v2 for incoming P2P connections (use with HAProxy send-proxy-v2)
|
||||
--no-stratum-http Disable HTTP on Stratum ports
|
||||
--full-validation Enables full share validation / increases CPU usage
|
||||
--onion-address Tell other peers to use this .onion address to connect to this node through TOR
|
||||
--no-clearnet-p2p Forces P2P server to listen on 127.0.0.1 and to not connect to clearnet IPs
|
||||
--params-file File name to load parameters from. It can't be used together with any other command line parameters
|
||||
```
|
||||
|
||||
### Example command line
|
||||
@@ -48,6 +56,28 @@
|
||||
p2pool.exe --host 127.0.0.1 --rpc-port 18081 --zmq-port 18083 --wallet YOUR_WALLET_ADDRESS --stratum 0.0.0.0:3333 --p2p 0.0.0.0:37889
|
||||
```
|
||||
|
||||
### Example command line (params file)
|
||||
|
||||
```
|
||||
p2pool.exe --params-file params.conf
|
||||
```
|
||||
|
||||
params.conf
|
||||
```
|
||||
# IP of your node
|
||||
host = 127.0.0.1
|
||||
wallet = YOUR_WALLET_ADDRESS
|
||||
data-api = "/path/to/api/folder" # use quotes if you have spaces in the path
|
||||
loglevel = 4
|
||||
mini = 1
|
||||
```
|
||||
|
||||
### Example command line (mining to a subaddress)
|
||||
|
||||
```
|
||||
p2pool.exe --host 127.0.0.1 --wallet WALLET_MAIN_ADDRESS --subaddress SUBADDRESS_FROM_THE_SAME_WALLET
|
||||
```
|
||||
|
||||
### Multiple backup hosts
|
||||
|
||||
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.
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
## Running P2Pool with I2P
|
||||
|
||||
P2Pool has several command-line options that should be used for I2P setup:
|
||||
|
||||
- `--socks5 IP:port` to specify your I2P SOCKS proxy address (usually `127.0.0.1:4447` if you are using i2pd or followed the guide below)
|
||||
- `--socks5-proxy-type i2p` to specify the type of SOCKS5 proxy being used
|
||||
- `--no-dns` to disable all DNS queries and prevent DNS leaks. P2Pool only ever makes DNS requests to get a list of seed nodes, to resolve your Monero node's domain (if it's not set as an IP address), and to resolve manually added peers
|
||||
- `--no-upnp` to disable UPnP requests (they are sent to your router, so use this option if you are not on your home network)
|
||||
- `--i2p-address` your hidden service's `.b32.i2p` address (without port number). This address will be broadcast to other peers when you mine a share in P2Pool. This is to prevent address spamming - you have to mine a real share to be able to broadcast your I2P address.
|
||||
- **Attention: this also links the I2P address with the Monero wallet you use for mining. Create a new I2P address when mining through I2P, don't use your existing addresses to avoid metadata leaks.**
|
||||
- `--no-clearnet-p2p` to never connect to clearnet P2Pool nodes.
|
||||
|
||||
## Setting up I2P tunnels for P2Pool (i2pd on Linux)
|
||||
|
||||
Follow [these instructions](https://docs.i2pd.website/en/latest/user-guide/install/) to install i2pd on your system.
|
||||
First, ensure the SOCKS proxy tunnel is enabled (as it should be by default). See [here](https://docs.i2pd.website/en/latest/user-guide/configuration/) for more information.
|
||||
|
||||
You will need to modify some lines in the `tunnels.conf` file, usually located in `/var/lib/i2pd/tunnels.conf` on Linux.
|
||||
Add a server tunnel to allow inbound connections from peers:
|
||||
```ini
|
||||
[p2pool]
|
||||
type = server
|
||||
host = 127.0.0.1
|
||||
port = 28723
|
||||
keys = p2pool.dat
|
||||
```
|
||||
This will create a hidden service key in `/var/lib/i2pd/p2pool.dat`; you may want to back this up.
|
||||
Please note that you **must** use the port number shown above in order for other peers to be able to find you.
|
||||
|
||||
Restart i2pd:
|
||||
```bash
|
||||
sudo systemctl restart i2pd.service
|
||||
```
|
||||
|
||||
Get the hostname of your hidden service:
|
||||
```bash
|
||||
curl -s http://127.0.0.1:7070/?page=i2p_tunnels | grep -Eo "[a-zA-Z0-9./?=_%:-]*" | grep "28723"
|
||||
```
|
||||
|
||||
The resulting `.b32.i2p` address should then be used for the `--i2p-address` command-line parameter.
|
||||
|
||||
## Command line example
|
||||
```bash
|
||||
./p2pool --host MONERO_NODE_IP --wallet YOUR_WALLET --socks5 127.0.0.1:4447 --socks5-proxy-type i2p --no-dns --no-upnp --i2p-address YOUR_I2P_ADDRESS
|
||||
```
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
## Running P2Pool with TOR
|
||||
|
||||
P2Pool has several command-line options that should be used for TOR setup:
|
||||
|
||||
- `--socks5 IP:port` to specify your TOR proxy address (usually `127.0.0.1:9050` if you installed TOR on the same PC)
|
||||
- `--socks5-proxy-type tor` to specify the type of SOCKS5 proxy being used
|
||||
- `--no-dns` to disable all DNS queries and prevent DNS leaks. P2Pool only ever makes DNS requests to get a list of seed nodes, to resolve your Monero node's domain (if it's not set as an IP address), and to resolve manually added peers
|
||||
- `--no-upnp` to disable UPnP requests (they are sent to your router, so use this option if you are not on your home network)
|
||||
- `--onion-address` your hidden service's address (without port number). This address will be broadcast to other peers when you mine a share in P2Pool. This is to prevent address spamming - you have to mine a real share to be able to broadcast your TOR address.
|
||||
- **Attention: this also links the onion address with the Monero wallet you use for mining. Create a new onion address when mining through TOR, don't use your existing onion addresses to avoid meta-data leaks.**
|
||||
- `--no-clearnet-p2p` to never connect to clearnet P2Pool nodes. This also makes sure that your P2Pool traffic doesn't exit the TOR network (and is not seen/modified by the exit nodes)
|
||||
|
||||
## Setting up a hidden service for P2Pool (Linux)
|
||||
|
||||
- Add these lines to your TOR config in `/etc/tor/torrc`:
|
||||
```
|
||||
HiddenServiceDir /var/lib/tor/p2pool/
|
||||
HiddenServicePort 28722 127.0.0.1:37889
|
||||
```
|
||||
Note that you must use port 28722 as the hidden service's port because this is what other peers will use when trying to connect to you. The internal port (37889) should be your actual P2Pool listening port (37889 for P2Pool-main, 37888 for P2Pool-mini, 37890 for P2Pool-nano)
|
||||
- Restart the TOR service:
|
||||
```
|
||||
sudo systemctl restart tor.service
|
||||
```
|
||||
- If there were no errors, you should now have the `/var/lib/tor/p2pool` directory with a `hostname` file in it. This file will contain your onion address
|
||||
- Use this address in P2Pool's command line: `--onion-address ADDRESS_FROM_HOSTNAME_FILE`
|
||||
- It is strongly recommended to create a new onion address for mining (see `--onion-address` remarks). This guide ensures you will be using a new onion address, assuming that you don't already have a hidden service named `p2pool`.
|
||||
|
||||
## Command line example
|
||||
```
|
||||
./p2pool --host MONERO_NODE_IP --wallet YOUR_WALLET --socks5 127.0.0.1:9050 --socks5-proxy-type tor --no-dns --no-upnp --onion-address ADDRESS_FROM_HOSTNAME_FILE
|
||||
```
|
||||
@@ -239,9 +239,8 @@ Wallets with confirmed P2Pool support<br>
|
||||
<li><a href="https://play.google.com/store/apps/details?id=com.m2049r.xmrwallet" target="_blank">Monerujo v3.0.2 "Fluorine Fermi"</a> and newer
|
||||
<li><a href="https://play.google.com/store/apps/details?id=com.cakewallet.cake_wallet" target="_blank">Cake Wallet v4.4.5</a> and newer
|
||||
<li><a href="https://featherwallet.org/" target="_blank">Feather Wallet v2.1.0</a> and newer
|
||||
<li><a href="https://mymonero.com/" target="_blank">MyMonero</a>
|
||||
</ul>
|
||||
It's highly recommended to create a new wallet for mining because wallet addresses are public on p2pool. You have to use the primary wallet address for mining. Subaddresses and integrated addresses are not supported, just like with monerod solo mining.
|
||||
It's highly recommended to create a new wallet for mining because wallet addresses are public on p2pool. You can mine to a primary wallet address (the one starting with `4`) for mining. If you want to mine to a subaddress, you will need to provide both the main address (starting with 4) and the subaddress (starting with 8) using "--wallet" and "--subaddress" command line parameters.
|
||||
</details>
|
||||
|
||||
<details><summary>Setup Monero node</summary>
|
||||
@@ -256,7 +255,7 @@ It's highly recommended to create a new wallet for mining because wallet address
|
||||
<details><summary>Setup P2Pool node</summary>
|
||||
<ul>
|
||||
<li>Download the latest P2Pool <a href="https://github.com/SChernykh/p2pool/releases/latest" target="_blank">release</a>
|
||||
<li>[Optional] Open port <span>37889</span> (P2Pool port) or <span>37888</span> (P2Pool mini port) in your firewall to ensure better connectivity
|
||||
<li>[Optional] Open port <span>37889</span> (P2Pool p2p port) in your firewall to ensure better connectivity
|
||||
<li>Run <span>./p2pool --host 127.0.0.1 --wallet YOUR_WALLET_ADDRESS</span>
|
||||
<li>It should take no more than 5-10 minutes to synchronize
|
||||
</ul></details>
|
||||
@@ -274,6 +273,7 @@ It's highly recommended to create a new wallet for mining because wallet address
|
||||
<ul>
|
||||
<li>You can enter your wallet address at <a href="https://p2pool.observer/" target="_blank">P2Pool Observer</a>
|
||||
<li>P2Pool Observer for P2Pool mini can be found <a href="https://mini.p2pool.observer/" target="_blank">here</a>
|
||||
<li>P2Pool Observer for P2Pool nano can be found <a href="https://nano.p2pool.observer/" target="_blank">here</a>
|
||||
<li>You will find your wallet's statistics there only after you've mined at least 1 P2Pool share
|
||||
</ul>
|
||||
</details>
|
||||
@@ -300,7 +300,7 @@ P2Pool is a decentralized community, there is no dedicated support. You can reac
|
||||
<li><span style="font-size:2rem;color:#e09000;">I have been mining for several hours and still got no rewards?</span>
|
||||
<ul><li>P2Pool doesn't work exactly like regular pools - there's no "pending balance" here. You need to find a pool share first and then wait for P2Pool to find a Monero block. You'll get a payout to your XMR wallet as soon as a block is found and you have shares in PPLNS window. It can take several days to a week to find a share if your hashrate is low. Type "status" command in P2Pool console or visit <a href="https://p2pool.observer/" target="_blank">P2Pool observer</a> to check your progress.</ul><br>
|
||||
<li><span style="font-size:2rem;color:#e09000;">I am mining but I can't find any shares</span>
|
||||
<ul><li>First check for any warnings and errors in P2Pool console and logs. If everything works fine, you can check the <a href="https://p2pool.observer/calculate-share-time" target="_blank">average share time calculator</a> to get an idea how often you should find a share with your hashrate. If this time is more than 1 day, it's recommended to switch to P2Pool mini by adding <span style="color:#808080;">--mini</span> to P2Pool command line.</ul><br>
|
||||
<ul><li>First check for any warnings and errors in P2Pool console and logs. If everything works fine, you can check the <a href="https://p2pool.observer/calculate-share-time" target="_blank">average share time calculator</a> to get an idea how often you should find a share with your hashrate. If this time is more than 1 day, it's recommended to switch to either P2Pool mini or nano by adding <span style="color:#808080;">--mini</span> or <span style="color:#808080;">--nano</span> to P2Pool command line.</ul><br>
|
||||
<li><span style="font-size:2rem;color:#e09000;">I get an error "monerod RPC ... is incompatible, update to RPC >= v3.8"</span>
|
||||
<ul><li>Use monerod v0.18.0.0 or newer</ul><br>
|
||||
<li><span style="font-size:2rem;color:#e09000;">I get warnings "peer ... is ahead on mainchain (height ..., your height ...). Is your monerod stuck or lagging?"</span>
|
||||
@@ -314,4 +314,4 @@ Donate to support the project:<br><span style="font-size:0.9rem;color:#b0b0b0;">
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -239,9 +239,8 @@ Wallets with confirmed P2Pool support<br>
|
||||
<li><a href="https://play.google.com/store/apps/details?id=com.m2049r.xmrwallet" target="_blank">Monerujo v3.0.2 "Fluorine Fermi"</a> and newer
|
||||
<li><a href="https://play.google.com/store/apps/details?id=com.cakewallet.cake_wallet" target="_blank">Cake Wallet v4.4.5</a> and newer
|
||||
<li><a href="https://featherwallet.org/" target="_blank">Feather Wallet v2.1.0</a> and newer
|
||||
<li><a href="https://mymonero.com/" target="_blank">MyMonero</a>
|
||||
</ul>
|
||||
It's highly recommended to create a new wallet for mining because wallet addresses are public on p2pool. You have to use the primary wallet address for mining. Subaddresses and integrated addresses are not supported, just like with monerod solo mining.
|
||||
It's highly recommended to create a new wallet for mining because wallet addresses are public on p2pool. You can mine to a primary wallet address (the one starting with `4`) for mining. If you want to mine to a subaddress, you will need to provide both the main address (starting with 4) and the subaddress (starting with 8) using "--wallet" and "--subaddress" command line parameters.
|
||||
</details>
|
||||
|
||||
<details><summary>Setup Monero node</summary>
|
||||
@@ -256,7 +255,7 @@ It's highly recommended to create a new wallet for mining because wallet address
|
||||
<details><summary>Setup P2Pool node</summary>
|
||||
<ul>
|
||||
<li>Download the latest P2Pool <a href="https://github.com/SChernykh/p2pool/releases/latest" target="_blank">release</a>
|
||||
<li>[Optional] Open port <span>37889</span> (P2Pool port) or <span>37888</span> (P2Pool mini port) in your firewall to ensure better connectivity
|
||||
<li>[Optional] Open port <span>37888</span> (P2Pool mini p2p port) in your firewall to ensure better connectivity
|
||||
<li>Run <span>./p2pool --host 127.0.0.1 --wallet YOUR_WALLET_ADDRESS --mini</span>
|
||||
<li>It should take no more than 5-10 minutes to synchronize
|
||||
</ul></details>
|
||||
@@ -274,6 +273,7 @@ It's highly recommended to create a new wallet for mining because wallet address
|
||||
<ul>
|
||||
<li>You can enter your wallet address at <a href="https://p2pool.observer/" target="_blank">P2Pool Observer</a>
|
||||
<li>P2Pool Observer for P2Pool mini can be found <a href="https://mini.p2pool.observer/" target="_blank">here</a>
|
||||
<li>P2Pool Observer for P2Pool nano can be found <a href="https://nano.p2pool.observer/" target="_blank">here</a>
|
||||
<li>You will find your wallet's statistics there only after you've mined at least 1 P2Pool share
|
||||
</ul>
|
||||
</details>
|
||||
@@ -300,7 +300,7 @@ P2Pool is a decentralized community, there is no dedicated support. You can reac
|
||||
<li><span style="font-size:2rem;color:#e09000;">I have been mining for several hours and still got no rewards?</span>
|
||||
<ul><li>P2Pool doesn't work exactly like regular pools - there's no "pending balance" here. You need to find a pool share first and then wait for P2Pool to find a Monero block. You'll get a payout to your XMR wallet as soon as a block is found and you have shares in PPLNS window. It can take several days to a week to find a share if your hashrate is low. Type "status" command in P2Pool console or visit <a href="https://mini.p2pool.observer/" target="_blank">P2Pool observer</a> to check your progress.</ul><br>
|
||||
<li><span style="font-size:2rem;color:#e09000;">I am mining but I can't find any shares</span>
|
||||
<ul><li>First check for any warnings and errors in P2Pool console and logs. If everything works fine, you can check the <a href="https://p2pool.observer/calculate-share-time" target="_blank">average share time calculator</a> to get an idea how often you should find a share with your hashrate. If this time is more than 1 day, it's recommended to switch to P2Pool mini by adding <span style="color:#808080;">--mini</span> to P2Pool command line.</ul><br>
|
||||
<ul><li>First check for any warnings and errors in P2Pool console and logs. If everything works fine, you can check the <a href="https://p2pool.observer/calculate-share-time" target="_blank">average share time calculator</a> to get an idea how often you should find a share with your hashrate. If this time is more than 1 day, it's recommended to switch to P2Pool mini or nano by adding <span style="color:#808080;">--mini</span> or <span style="color:#808080;">--nano</span> to P2Pool command line.</ul><br>
|
||||
<li><span style="font-size:2rem;color:#e09000;">I get an error "monerod RPC ... is incompatible, update to RPC >= v3.8"</span>
|
||||
<ul><li>Use monerod v0.18.0.0 or newer</ul><br>
|
||||
<li><span style="font-size:2rem;color:#e09000;">I get warnings "peer ... is ahead on mainchain (height ..., your height ...). Is your monerod stuck or lagging?"</span>
|
||||
@@ -314,4 +314,4 @@ Donate to support the project:<br><span style="font-size:0.9rem;color:#b0b0b0;">
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -242,9 +242,8 @@ Wallets with confirmed P2Pool support<br>
|
||||
<li><a href="https://play.google.com/store/apps/details?id=com.m2049r.xmrwallet" target="_blank">Monerujo v3.0.2 "Fluorine Fermi"</a> and newer
|
||||
<li><a href="https://play.google.com/store/apps/details?id=com.cakewallet.cake_wallet" target="_blank">Cake Wallet v4.4.5</a> and newer
|
||||
<li><a href="https://featherwallet.org/" target="_blank">Feather Wallet v2.1.0</a> and newer
|
||||
<li><a href="https://mymonero.com/" target="_blank">MyMonero</a>
|
||||
</ul>
|
||||
It's highly recommended to create a new wallet for mining because wallet addresses are public on p2pool. You have to use the primary wallet address for mining. Subaddresses and integrated addresses are not supported, just like with monerod solo mining.
|
||||
It's highly recommended to create a new wallet for mining because wallet addresses are public on p2pool. You can mine to a primary wallet address (the one starting with `4`) for mining. If you want to mine to a subaddress, you will need to provide both the main address (starting with 4) and the subaddress (starting with 8) using "--wallet" and "--subaddress" command line parameters.
|
||||
</details>
|
||||
|
||||
<details><summary>Setup Monero node</summary>
|
||||
@@ -259,7 +258,7 @@ It's highly recommended to create a new wallet for mining because wallet address
|
||||
<details><summary>Setup P2Pool node</summary>
|
||||
<ul>
|
||||
<li>Download the latest P2Pool <a href="https://github.com/SChernykh/p2pool/releases/latest" target="_blank">release</a>
|
||||
<li>[Optional] Open port <span>37889</span> (P2Pool port) or <span>37890</span> (P2Pool nano port) in your firewall to ensure better connectivity
|
||||
<li>[Optional] Open port <span>37890</span> (P2Pool nano p2p port) in your firewall to ensure better connectivity
|
||||
<li>Run <span>./p2pool --host 127.0.0.1 --wallet YOUR_WALLET_ADDRESS --nano</span>
|
||||
<li>It should take no more than 5-10 minutes to synchronize
|
||||
</ul></details>
|
||||
@@ -276,6 +275,7 @@ It's highly recommended to create a new wallet for mining because wallet address
|
||||
<details><summary>Checking your progress</summary>
|
||||
<ul>
|
||||
<li>You can enter your wallet address at <a href="https://p2pool.observer/" target="_blank">P2Pool Observer</a>
|
||||
<li>P2Pool Observer for P2Pool mini can be found <a href="https://mini.p2pool.observer/" target="_blank">here</a>
|
||||
<li>P2Pool Observer for P2Pool nano can be found <a href="https://nano.p2pool.observer/" target="_blank">here</a>
|
||||
<li>You will find your wallet's statistics there only after you've mined at least 1 P2Pool share
|
||||
</ul>
|
||||
@@ -317,4 +317,4 @@ Donate to support the project:<br><span style="font-size:0.9rem;color:#b0b0b0;">
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Vendored
+1
-1
Submodule external/src/RandomX updated: d341d6a61c...1343007c61
+550
-452
File diff suppressed because it is too large
Load Diff
+567
-347
File diff suppressed because it is too large
Load Diff
+6
-2
@@ -262,8 +262,9 @@ message NetworkDifficultyResponse {
|
||||
uint64 sha3x_estimated_hash_rate = 6;
|
||||
uint64 monero_randomx_estimated_hash_rate = 7;
|
||||
uint64 tari_randomx_estimated_hash_rate = 10;
|
||||
UDecimalValue cuckaroo_estimated_hash_rate = 11;
|
||||
uint64 num_coinbases = 8;
|
||||
repeated bytes coinbase_extras = 9;
|
||||
repeated bytes coinbase_extras = 9;
|
||||
}
|
||||
|
||||
// A generic single value response for a specific height
|
||||
@@ -626,9 +627,12 @@ message GetNetworkStateResponse {
|
||||
uint64 reward = 5;
|
||||
// estimate sha3x hash rate
|
||||
uint64 sha3x_estimated_hash_rate = 6;
|
||||
// estimate randomx hash rate
|
||||
// estimate monero randomx hash rate
|
||||
uint64 monero_randomx_estimated_hash_rate = 7;
|
||||
// estimate tari randomx hash rate
|
||||
uint64 tari_randomx_estimated_hash_rate = 10;
|
||||
// estimate cuckaroo hash rate
|
||||
UDecimalValue cuckaroo_estimated_hash_rate = 12;
|
||||
// number of connections
|
||||
uint64 num_connections = 8;
|
||||
//liveness results
|
||||
|
||||
+18
-17
@@ -384,22 +384,23 @@ const char descriptor_table_protodef_block_2eproto[] ABSL_ATTRIBUTE_SECTION_VARI
|
||||
"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\"\210\001\n\007PowAlgo\022,\n\010pow_algo\030\001 \001(\016"
|
||||
"2\032.tari.rpc.PowAlgo.PowAlgos\"O\n\010PowAlgos"
|
||||
"data\030\004 \001(\014\"\240\001\n\007PowAlgo\022,\n\010pow_algo\030\001 \001(\016"
|
||||
"2\032.tari.rpc.PowAlgo.PowAlgos\"g\n\010PowAlgos"
|
||||
"\022\026\n\022POW_ALGOS_RANDOMXM\020\000\022\023\n\017POW_ALGOS_SH"
|
||||
"A3X\020\001\022\026\n\022POW_ALGOS_RANDOMXT\020\002\"U\n\005Block\022%"
|
||||
"\n\006header\030\001 \001(\0132\025.tari.rpc.BlockHeader\022%\n"
|
||||
"\004body\030\002 \001(\0132\027.tari.rpc.AggregateBody\"H\n\017"
|
||||
"HistoricalBlock\022\025\n\rconfirmations\030\001 \001(\004\022\036"
|
||||
"\n\005block\030\002 \001(\0132\017.tari.rpc.Block\"\252\001\n\026NewBl"
|
||||
"ockHeaderTemplate\022\017\n\007version\030\001 \001(\r\022\016\n\006he"
|
||||
"ight\030\002 \001(\004\022\021\n\tprev_hash\030\003 \001(\014\022\033\n\023total_k"
|
||||
"ernel_offset\030\004 \001(\014\022\"\n\003pow\030\005 \001(\0132\025.tari.r"
|
||||
"pc.ProofOfWork\022\033\n\023total_script_offset\030\007 "
|
||||
"\001(\014\"\207\001\n\020NewBlockTemplate\0220\n\006header\030\001 \001(\013"
|
||||
"2 .tari.rpc.NewBlockHeaderTemplate\022%\n\004bo"
|
||||
"dy\030\002 \001(\0132\027.tari.rpc.AggregateBody\022\032\n\022is_"
|
||||
"mempool_in_sync\030\003 \001(\010b\006proto3"
|
||||
"A3X\020\001\022\026\n\022POW_ALGOS_RANDOMXT\020\002\022\026\n\022POW_ALG"
|
||||
"OS_CUCKAROO\020\003\"U\n\005Block\022%\n\006header\030\001 \001(\0132\025"
|
||||
".tari.rpc.BlockHeader\022%\n\004body\030\002 \001(\0132\027.ta"
|
||||
"ri.rpc.AggregateBody\"H\n\017HistoricalBlock\022"
|
||||
"\025\n\rconfirmations\030\001 \001(\004\022\036\n\005block\030\002 \001(\0132\017."
|
||||
"tari.rpc.Block\"\252\001\n\026NewBlockHeaderTemplat"
|
||||
"e\022\017\n\007version\030\001 \001(\r\022\016\n\006height\030\002 \001(\004\022\021\n\tpr"
|
||||
"ev_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_script_offset\030\007 \001(\014\"\207\001\n\020NewBlock"
|
||||
"Template\0220\n\006header\030\001 \001(\0132 .tari.rpc.NewB"
|
||||
"lockHeaderTemplate\022%\n\004body\030\002 \001(\0132\027.tari."
|
||||
"rpc.AggregateBody\022\032\n\022is_mempool_in_sync\030"
|
||||
"\003 \001(\010b\006proto3"
|
||||
};
|
||||
static const ::_pbi::DescriptorTable* PROTOBUF_NONNULL const
|
||||
descriptor_table_block_2eproto_deps[1] = {
|
||||
@@ -409,7 +410,7 @@ static ::absl::once_flag descriptor_table_block_2eproto_once;
|
||||
PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_block_2eproto = {
|
||||
false,
|
||||
false,
|
||||
1109,
|
||||
1133,
|
||||
descriptor_table_protodef_block_2eproto,
|
||||
"block.proto",
|
||||
&descriptor_table_block_2eproto_once,
|
||||
@@ -429,7 +430,7 @@ const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL PowAlgo_PowAlgos_desc
|
||||
return file_level_enum_descriptors_block_2eproto[0];
|
||||
}
|
||||
PROTOBUF_CONSTINIT const uint32_t PowAlgo_PowAlgos_internal_data_[] = {
|
||||
196608u, 0u, };
|
||||
262144u, 0u, };
|
||||
// ===================================================================
|
||||
|
||||
class BlockHeader::_Internal {
|
||||
|
||||
+6
-4
@@ -102,6 +102,7 @@ enum PowAlgo_PowAlgos : int {
|
||||
PowAlgo_PowAlgos_POW_ALGOS_RANDOMXM = 0,
|
||||
PowAlgo_PowAlgos_POW_ALGOS_SHA3X = 1,
|
||||
PowAlgo_PowAlgos_POW_ALGOS_RANDOMXT = 2,
|
||||
PowAlgo_PowAlgos_POW_ALGOS_CUCKAROO = 3,
|
||||
PowAlgo_PowAlgos_PowAlgo_PowAlgos_INT_MIN_SENTINEL_DO_NOT_USE_ =
|
||||
::std::numeric_limits<::int32_t>::min(),
|
||||
PowAlgo_PowAlgos_PowAlgo_PowAlgos_INT_MAX_SENTINEL_DO_NOT_USE_ =
|
||||
@@ -112,11 +113,11 @@ extern const uint32_t PowAlgo_PowAlgos_internal_data_[];
|
||||
inline constexpr PowAlgo_PowAlgos PowAlgo_PowAlgos_PowAlgos_MIN =
|
||||
static_cast<PowAlgo_PowAlgos>(0);
|
||||
inline constexpr PowAlgo_PowAlgos PowAlgo_PowAlgos_PowAlgos_MAX =
|
||||
static_cast<PowAlgo_PowAlgos>(2);
|
||||
static_cast<PowAlgo_PowAlgos>(3);
|
||||
inline bool PowAlgo_PowAlgos_IsValid(int value) {
|
||||
return 0 <= value && value <= 2;
|
||||
return 0 <= value && value <= 3;
|
||||
}
|
||||
inline constexpr int PowAlgo_PowAlgos_PowAlgos_ARRAYSIZE = 2 + 1;
|
||||
inline constexpr int PowAlgo_PowAlgos_PowAlgos_ARRAYSIZE = 3 + 1;
|
||||
const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL PowAlgo_PowAlgos_descriptor();
|
||||
template <typename T>
|
||||
const ::std::string& PowAlgo_PowAlgos_Name(T value) {
|
||||
@@ -127,7 +128,7 @@ const ::std::string& PowAlgo_PowAlgos_Name(T value) {
|
||||
}
|
||||
template <>
|
||||
inline const ::std::string& PowAlgo_PowAlgos_Name(PowAlgo_PowAlgos value) {
|
||||
return ::google::protobuf::internal::NameOfDenseEnum<PowAlgo_PowAlgos_descriptor, 0, 2>(
|
||||
return ::google::protobuf::internal::NameOfDenseEnum<PowAlgo_PowAlgos_descriptor, 0, 3>(
|
||||
static_cast<int>(value));
|
||||
}
|
||||
inline bool PowAlgo_PowAlgos_Parse(
|
||||
@@ -493,6 +494,7 @@ class PowAlgo final : public ::google::protobuf::Message
|
||||
static constexpr PowAlgos POW_ALGOS_RANDOMXM = PowAlgo_PowAlgos_POW_ALGOS_RANDOMXM;
|
||||
static constexpr PowAlgos POW_ALGOS_SHA3X = PowAlgo_PowAlgos_POW_ALGOS_SHA3X;
|
||||
static constexpr PowAlgos POW_ALGOS_RANDOMXT = PowAlgo_PowAlgos_POW_ALGOS_RANDOMXT;
|
||||
static constexpr PowAlgos POW_ALGOS_CUCKAROO = PowAlgo_PowAlgos_POW_ALGOS_CUCKAROO;
|
||||
static inline bool PowAlgos_IsValid(int value) {
|
||||
return PowAlgo_PowAlgos_IsValid(value);
|
||||
}
|
||||
|
||||
+6
-3
@@ -68,8 +68,10 @@ message BlockHeader {
|
||||
// The proof of work data structure that is included in the block header.
|
||||
message ProofOfWork {
|
||||
// The algorithm used to mine this block
|
||||
// 0 = Monero
|
||||
// 0 = Monero RandomX
|
||||
// 1 = Sha3X
|
||||
// 2 = Tari RandomX
|
||||
// 3 = Cuckaroo
|
||||
uint64 pow_algo = 1;
|
||||
// Supplemental proof of work data. For example for Sha3x, this would be empty (only the block header is
|
||||
// required), but for Monero merge mining we need the Monero block header and RandomX seed hash.
|
||||
@@ -80,9 +82,10 @@ message ProofOfWork {
|
||||
message PowAlgo {
|
||||
// The permitted pow algorithms
|
||||
enum PowAlgos {
|
||||
POW_ALGOS_RANDOMXM = 0; // Accessible as `grpc::pow_algo::PowAlgos::RandomxM`
|
||||
POW_ALGOS_RANDOMXM = 0; // Accessible as `grpc::pow_algo::PowAlgos::RandomxM`
|
||||
POW_ALGOS_SHA3X = 1; // Accessible as `grpc::pow_algo::PowAlgos::Sha3x`
|
||||
POW_ALGOS_RANDOMXT = 2; // Accessible as `grpc::pow_algo::PowAlgos::RandomxT`
|
||||
POW_ALGOS_RANDOMXT = 2; // Accessible as `grpc::pow_algo::PowAlgos::RandomxT`
|
||||
POW_ALGOS_CUCKAROO = 3; // Accessible as `grpc::pow_algo::PowAlgos::Cuckaroo`
|
||||
}
|
||||
// The pow algo to use
|
||||
PowAlgos pow_algo = 1;
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ message NetworkStatusResponse {
|
||||
uint32 num_node_connections = 3;
|
||||
}
|
||||
|
||||
message Address{
|
||||
message Address {
|
||||
bytes address =1;
|
||||
string last_seen = 2;
|
||||
uint32 connection_attempts = 3;
|
||||
|
||||
+323
-8
@@ -55,6 +55,32 @@ struct WeightParamsDefaultTypeInternal {
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 WeightParamsDefaultTypeInternal _WeightParams_default_instance_;
|
||||
|
||||
inline constexpr UDecimalValue::Impl_::Impl_(
|
||||
::_pbi::ConstantInitialized) noexcept
|
||||
: _cached_size_{0},
|
||||
units_{::uint64_t{0u}},
|
||||
nanos_{0u} {}
|
||||
|
||||
template <typename>
|
||||
PROTOBUF_CONSTEXPR UDecimalValue::UDecimalValue(::_pbi::ConstantInitialized)
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
: ::google::protobuf::Message(UDecimalValue_class_data_.base()),
|
||||
#else // PROTOBUF_CUSTOM_VTABLE
|
||||
: ::google::protobuf::Message(),
|
||||
#endif // PROTOBUF_CUSTOM_VTABLE
|
||||
_impl_(::_pbi::ConstantInitialized()) {
|
||||
}
|
||||
struct UDecimalValueDefaultTypeInternal {
|
||||
PROTOBUF_CONSTEXPR UDecimalValueDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {}
|
||||
~UDecimalValueDefaultTypeInternal() {}
|
||||
union {
|
||||
UDecimalValue _instance;
|
||||
};
|
||||
};
|
||||
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 UDecimalValueDefaultTypeInternal _UDecimalValue_default_instance_;
|
||||
|
||||
inline constexpr Signature::Impl_::Impl_(
|
||||
::_pbi::ConstantInitialized) noexcept
|
||||
: _cached_size_{0},
|
||||
@@ -581,6 +607,13 @@ const ::uint32_t
|
||||
29,
|
||||
21,
|
||||
30,
|
||||
0x081, // bitmap
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::UDecimalValue, _impl_._has_bits_),
|
||||
5, // hasbit index offset
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::UDecimalValue, _impl_.units_),
|
||||
PROTOBUF_FIELD_OFFSET(::tari::rpc::UDecimalValue, _impl_.nanos_),
|
||||
0,
|
||||
1,
|
||||
};
|
||||
|
||||
static const ::_pbi::MigrationSchema
|
||||
@@ -598,6 +631,7 @@ static const ::_pbi::MigrationSchema
|
||||
{76, sizeof(::tari::rpc::RangeProof)},
|
||||
{81, sizeof(::tari::rpc::ConsensusConstants_ProofOfWorkEntry_DoNotUse)},
|
||||
{88, sizeof(::tari::rpc::ConsensusConstants)},
|
||||
{161, sizeof(::tari::rpc::UDecimalValue)},
|
||||
};
|
||||
static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = {
|
||||
&::tari::rpc::_Range_default_instance_._instance,
|
||||
@@ -613,6 +647,7 @@ static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = {
|
||||
&::tari::rpc::_RangeProof_default_instance_._instance,
|
||||
&::tari::rpc::_ConsensusConstants_ProofOfWorkEntry_DoNotUse_default_instance_._instance,
|
||||
&::tari::rpc::_ConsensusConstants_default_instance_._instance,
|
||||
&::tari::rpc::_UDecimalValue_default_instance_._instance,
|
||||
};
|
||||
const char descriptor_table_protodef_types_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
|
||||
protodesc_cold) = {
|
||||
@@ -672,24 +707,25 @@ const char descriptor_table_protodef_types_2eproto[] ABSL_ATTRIBUTE_SECTION_VARI
|
||||
"ial_epoch\030& \001(\r\022)\n!vn_registration_max_v"
|
||||
"ns_per_epoch\030\' \001(\r\032S\n\020ProofOfWorkEntry\022\013"
|
||||
"\n\003key\030\001 \001(\r\022.\n\005value\030\002 \001(\0132\037.tari.rpc.Po"
|
||||
"wAlgorithmConstants:\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\033V"
|
||||
"ALIDATOR_NODE_REGISTRATION\020\003\022\036\n\032CODE_TEM"
|
||||
"PLATE_REGISTRATION\020\004*:\n\016RangeProofType\022\024"
|
||||
"\n\020BULLETPROOF_PLUS\020\000\022\022\n\016REVEALED_VALUE\020\001"
|
||||
"b\006proto3"
|
||||
"wAlgorithmConstants:\0028\001\"-\n\rUDecimalValue"
|
||||
"\022\r\n\005units\030\001 \001(\004\022\r\n\005nanos\030\002 \001(\007*s\n\nOutput"
|
||||
"Type\022\014\n\010STANDARD\020\000\022\014\n\010COINBASE\020\001\022\010\n\004BURN"
|
||||
"\020\002\022\037\n\033VALIDATOR_NODE_REGISTRATION\020\003\022\036\n\032C"
|
||||
"ODE_TEMPLATE_REGISTRATION\020\004*:\n\016RangeProo"
|
||||
"fType\022\024\n\020BULLETPROOF_PLUS\020\000\022\022\n\016REVEALED_"
|
||||
"VALUE\020\001b\006proto3"
|
||||
};
|
||||
static ::absl::once_flag descriptor_table_types_2eproto_once;
|
||||
PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_types_2eproto = {
|
||||
false,
|
||||
false,
|
||||
2448,
|
||||
2495,
|
||||
descriptor_table_protodef_types_2eproto,
|
||||
"types.proto",
|
||||
&descriptor_table_types_2eproto_once,
|
||||
nullptr,
|
||||
0,
|
||||
13,
|
||||
14,
|
||||
schemas,
|
||||
file_default_instances,
|
||||
TableStruct_types_2eproto::offsets,
|
||||
@@ -5280,6 +5316,285 @@ void ConsensusConstants::InternalSwap(ConsensusConstants* PROTOBUF_RESTRICT PROT
|
||||
::google::protobuf::Metadata ConsensusConstants::GetMetadata() const {
|
||||
return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full());
|
||||
}
|
||||
// ===================================================================
|
||||
|
||||
class UDecimalValue::_Internal {
|
||||
public:
|
||||
using HasBits =
|
||||
decltype(::std::declval<UDecimalValue>()._impl_._has_bits_);
|
||||
static constexpr ::int32_t kHasBitsOffset =
|
||||
8 * PROTOBUF_FIELD_OFFSET(UDecimalValue, _impl_._has_bits_);
|
||||
};
|
||||
|
||||
UDecimalValue::UDecimalValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena)
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
: ::google::protobuf::Message(arena, UDecimalValue_class_data_.base()) {
|
||||
#else // PROTOBUF_CUSTOM_VTABLE
|
||||
: ::google::protobuf::Message(arena) {
|
||||
#endif // PROTOBUF_CUSTOM_VTABLE
|
||||
SharedCtor(arena);
|
||||
// @@protoc_insertion_point(arena_constructor:tari.rpc.UDecimalValue)
|
||||
}
|
||||
UDecimalValue::UDecimalValue(
|
||||
::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const UDecimalValue& from)
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
: ::google::protobuf::Message(arena, UDecimalValue_class_data_.base()),
|
||||
#else // PROTOBUF_CUSTOM_VTABLE
|
||||
: ::google::protobuf::Message(arena),
|
||||
#endif // PROTOBUF_CUSTOM_VTABLE
|
||||
_impl_(from._impl_) {
|
||||
_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(
|
||||
from._internal_metadata_);
|
||||
}
|
||||
PROTOBUF_NDEBUG_INLINE UDecimalValue::Impl_::Impl_(
|
||||
::google::protobuf::internal::InternalVisibility visibility,
|
||||
::google::protobuf::Arena* PROTOBUF_NULLABLE arena)
|
||||
: _cached_size_{0} {}
|
||||
|
||||
inline void UDecimalValue::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) {
|
||||
new (&_impl_) Impl_(internal_visibility(), arena);
|
||||
::memset(reinterpret_cast<char *>(&_impl_) +
|
||||
offsetof(Impl_, units_),
|
||||
0,
|
||||
offsetof(Impl_, nanos_) -
|
||||
offsetof(Impl_, units_) +
|
||||
sizeof(Impl_::nanos_));
|
||||
}
|
||||
UDecimalValue::~UDecimalValue() {
|
||||
// @@protoc_insertion_point(destructor:tari.rpc.UDecimalValue)
|
||||
SharedDtor(*this);
|
||||
}
|
||||
inline void UDecimalValue::SharedDtor(MessageLite& self) {
|
||||
UDecimalValue& this_ = static_cast<UDecimalValue&>(self);
|
||||
this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>();
|
||||
ABSL_DCHECK(this_.GetArena() == nullptr);
|
||||
this_._impl_.~Impl_();
|
||||
}
|
||||
|
||||
inline void* PROTOBUF_NONNULL UDecimalValue::PlacementNew_(
|
||||
const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem,
|
||||
::google::protobuf::Arena* PROTOBUF_NULLABLE arena) {
|
||||
return ::new (mem) UDecimalValue(arena);
|
||||
}
|
||||
constexpr auto UDecimalValue::InternalNewImpl_() {
|
||||
return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(UDecimalValue),
|
||||
alignof(UDecimalValue));
|
||||
}
|
||||
constexpr auto UDecimalValue::InternalGenerateClassData_() {
|
||||
return ::google::protobuf::internal::ClassDataFull{
|
||||
::google::protobuf::internal::ClassData{
|
||||
&_UDecimalValue_default_instance_._instance,
|
||||
&_table_.header,
|
||||
nullptr, // OnDemandRegisterArenaDtor
|
||||
nullptr, // IsInitialized
|
||||
&UDecimalValue::MergeImpl,
|
||||
::google::protobuf::Message::GetNewImpl<UDecimalValue>(),
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
&UDecimalValue::SharedDtor,
|
||||
::google::protobuf::Message::GetClearImpl<UDecimalValue>(), &UDecimalValue::ByteSizeLong,
|
||||
&UDecimalValue::_InternalSerialize,
|
||||
#endif // PROTOBUF_CUSTOM_VTABLE
|
||||
PROTOBUF_FIELD_OFFSET(UDecimalValue, _impl_._cached_size_),
|
||||
false,
|
||||
},
|
||||
&UDecimalValue::kDescriptorMethods,
|
||||
&descriptor_table_types_2eproto,
|
||||
nullptr, // tracker
|
||||
};
|
||||
}
|
||||
|
||||
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const
|
||||
::google::protobuf::internal::ClassDataFull UDecimalValue_class_data_ =
|
||||
UDecimalValue::InternalGenerateClassData_();
|
||||
|
||||
PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL
|
||||
UDecimalValue::GetClassData() const {
|
||||
::google::protobuf::internal::PrefetchToLocalCache(&UDecimalValue_class_data_);
|
||||
::google::protobuf::internal::PrefetchToLocalCache(UDecimalValue_class_data_.tc_table);
|
||||
return UDecimalValue_class_data_.base();
|
||||
}
|
||||
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
|
||||
const ::_pbi::TcParseTable<1, 2, 0, 0, 2>
|
||||
UDecimalValue::_table_ = {
|
||||
{
|
||||
PROTOBUF_FIELD_OFFSET(UDecimalValue, _impl_._has_bits_),
|
||||
0, // no _extensions_
|
||||
2, 8, // max_field_number, fast_idx_mask
|
||||
offsetof(decltype(_table_), field_lookup_table),
|
||||
4294967292, // skipmap
|
||||
offsetof(decltype(_table_), field_entries),
|
||||
2, // num_field_entries
|
||||
0, // num_aux_entries
|
||||
offsetof(decltype(_table_), field_names), // no aux_entries
|
||||
UDecimalValue_class_data_.base(),
|
||||
nullptr, // post_loop_handler
|
||||
::_pbi::TcParser::GenericFallback, // fallback
|
||||
#ifdef PROTOBUF_PREFETCH_PARSE_TABLE
|
||||
::_pbi::TcParser::GetTable<::tari::rpc::UDecimalValue>(), // to_prefetch
|
||||
#endif // PROTOBUF_PREFETCH_PARSE_TABLE
|
||||
}, {{
|
||||
// fixed32 nanos = 2;
|
||||
{::_pbi::TcParser::FastF32S1,
|
||||
{21, 1, 0, PROTOBUF_FIELD_OFFSET(UDecimalValue, _impl_.nanos_)}},
|
||||
// uint64 units = 1;
|
||||
{::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(UDecimalValue, _impl_.units_), 0>(),
|
||||
{8, 0, 0, PROTOBUF_FIELD_OFFSET(UDecimalValue, _impl_.units_)}},
|
||||
}}, {{
|
||||
65535, 65535
|
||||
}}, {{
|
||||
// uint64 units = 1;
|
||||
{PROTOBUF_FIELD_OFFSET(UDecimalValue, _impl_.units_), _Internal::kHasBitsOffset + 0, 0,
|
||||
(0 | ::_fl::kFcOptional | ::_fl::kUInt64)},
|
||||
// fixed32 nanos = 2;
|
||||
{PROTOBUF_FIELD_OFFSET(UDecimalValue, _impl_.nanos_), _Internal::kHasBitsOffset + 1, 0,
|
||||
(0 | ::_fl::kFcOptional | ::_fl::kFixed32)},
|
||||
}},
|
||||
// no aux_entries
|
||||
{{
|
||||
}},
|
||||
};
|
||||
PROTOBUF_NOINLINE void UDecimalValue::Clear() {
|
||||
// @@protoc_insertion_point(message_clear_start:tari.rpc.UDecimalValue)
|
||||
::google::protobuf::internal::TSanWrite(&_impl_);
|
||||
::uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
cached_has_bits = _impl_._has_bits_[0];
|
||||
if ((cached_has_bits & 0x00000003u) != 0) {
|
||||
::memset(&_impl_.units_, 0, static_cast<::size_t>(
|
||||
reinterpret_cast<char*>(&_impl_.nanos_) -
|
||||
reinterpret_cast<char*>(&_impl_.units_)) + sizeof(_impl_.nanos_));
|
||||
}
|
||||
_impl_._has_bits_.Clear();
|
||||
_internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
::uint8_t* PROTOBUF_NONNULL UDecimalValue::_InternalSerialize(
|
||||
const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target,
|
||||
::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) {
|
||||
const UDecimalValue& this_ = static_cast<const UDecimalValue&>(base);
|
||||
#else // PROTOBUF_CUSTOM_VTABLE
|
||||
::uint8_t* PROTOBUF_NONNULL UDecimalValue::_InternalSerialize(
|
||||
::uint8_t* PROTOBUF_NONNULL target,
|
||||
::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const {
|
||||
const UDecimalValue& this_ = *this;
|
||||
#endif // PROTOBUF_CUSTOM_VTABLE
|
||||
// @@protoc_insertion_point(serialize_to_array_start:tari.rpc.UDecimalValue)
|
||||
::uint32_t cached_has_bits = 0;
|
||||
(void)cached_has_bits;
|
||||
|
||||
// uint64 units = 1;
|
||||
if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) {
|
||||
if (this_._internal_units() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::_pbi::WireFormatLite::WriteUInt64ToArray(
|
||||
1, this_._internal_units(), target);
|
||||
}
|
||||
}
|
||||
|
||||
// fixed32 nanos = 2;
|
||||
if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) {
|
||||
if (this_._internal_nanos() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::_pbi::WireFormatLite::WriteFixed32ToArray(
|
||||
2, this_._internal_nanos(), target);
|
||||
}
|
||||
}
|
||||
|
||||
if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) {
|
||||
target =
|
||||
::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream);
|
||||
}
|
||||
// @@protoc_insertion_point(serialize_to_array_end:tari.rpc.UDecimalValue)
|
||||
return target;
|
||||
}
|
||||
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
::size_t UDecimalValue::ByteSizeLong(const MessageLite& base) {
|
||||
const UDecimalValue& this_ = static_cast<const UDecimalValue&>(base);
|
||||
#else // PROTOBUF_CUSTOM_VTABLE
|
||||
::size_t UDecimalValue::ByteSizeLong() const {
|
||||
const UDecimalValue& this_ = *this;
|
||||
#endif // PROTOBUF_CUSTOM_VTABLE
|
||||
// @@protoc_insertion_point(message_byte_size_start:tari.rpc.UDecimalValue)
|
||||
::size_t total_size = 0;
|
||||
|
||||
::uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void)cached_has_bits;
|
||||
|
||||
::_pbi::Prefetch5LinesFrom7Lines(&this_);
|
||||
cached_has_bits = this_._impl_._has_bits_[0];
|
||||
if ((cached_has_bits & 0x00000003u) != 0) {
|
||||
// uint64 units = 1;
|
||||
if ((cached_has_bits & 0x00000001u) != 0) {
|
||||
if (this_._internal_units() != 0) {
|
||||
total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(
|
||||
this_._internal_units());
|
||||
}
|
||||
}
|
||||
// fixed32 nanos = 2;
|
||||
if ((cached_has_bits & 0x00000002u) != 0) {
|
||||
if (this_._internal_nanos() != 0) {
|
||||
total_size += 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
return this_.MaybeComputeUnknownFieldsSize(total_size,
|
||||
&this_._impl_._cached_size_);
|
||||
}
|
||||
|
||||
void UDecimalValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) {
|
||||
auto* const _this = static_cast<UDecimalValue*>(&to_msg);
|
||||
auto& from = static_cast<const UDecimalValue&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:tari.rpc.UDecimalValue)
|
||||
ABSL_DCHECK_NE(&from, _this);
|
||||
::uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
cached_has_bits = from._impl_._has_bits_[0];
|
||||
if ((cached_has_bits & 0x00000003u) != 0) {
|
||||
if ((cached_has_bits & 0x00000001u) != 0) {
|
||||
if (from._internal_units() != 0) {
|
||||
_this->_impl_.units_ = from._impl_.units_;
|
||||
}
|
||||
}
|
||||
if ((cached_has_bits & 0x00000002u) != 0) {
|
||||
if (from._internal_nanos() != 0) {
|
||||
_this->_impl_.nanos_ = from._impl_.nanos_;
|
||||
}
|
||||
}
|
||||
}
|
||||
_this->_impl_._has_bits_[0] |= cached_has_bits;
|
||||
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void UDecimalValue::CopyFrom(const UDecimalValue& from) {
|
||||
// @@protoc_insertion_point(class_specific_copy_from_start:tari.rpc.UDecimalValue)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
|
||||
void UDecimalValue::InternalSwap(UDecimalValue* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) {
|
||||
using ::std::swap;
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
|
||||
::google::protobuf::internal::memswap<
|
||||
PROTOBUF_FIELD_OFFSET(UDecimalValue, _impl_.nanos_)
|
||||
+ sizeof(UDecimalValue::_impl_.nanos_)
|
||||
- PROTOBUF_FIELD_OFFSET(UDecimalValue, _impl_.units_)>(
|
||||
reinterpret_cast<char*>(&_impl_.units_),
|
||||
reinterpret_cast<char*>(&other->_impl_.units_));
|
||||
}
|
||||
|
||||
::google::protobuf::Metadata UDecimalValue::GetMetadata() const {
|
||||
return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full());
|
||||
}
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace rpc
|
||||
} // namespace tari
|
||||
|
||||
+259
@@ -112,6 +112,10 @@ class Signature;
|
||||
struct SignatureDefaultTypeInternal;
|
||||
extern SignatureDefaultTypeInternal _Signature_default_instance_;
|
||||
extern const ::google::protobuf::internal::ClassDataFull Signature_class_data_;
|
||||
class UDecimalValue;
|
||||
struct UDecimalValueDefaultTypeInternal;
|
||||
extern UDecimalValueDefaultTypeInternal _UDecimalValue_default_instance_;
|
||||
extern const ::google::protobuf::internal::ClassDataFull UDecimalValue_class_data_;
|
||||
class WeightParams;
|
||||
struct WeightParamsDefaultTypeInternal;
|
||||
extern WeightParamsDefaultTypeInternal _WeightParams_default_instance_;
|
||||
@@ -439,6 +443,209 @@ class WeightParams final : public ::google::protobuf::Message
|
||||
extern const ::google::protobuf::internal::ClassDataFull WeightParams_class_data_;
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class UDecimalValue final : public ::google::protobuf::Message
|
||||
/* @@protoc_insertion_point(class_definition:tari.rpc.UDecimalValue) */ {
|
||||
public:
|
||||
inline UDecimalValue() : UDecimalValue(nullptr) {}
|
||||
~UDecimalValue() PROTOBUF_FINAL;
|
||||
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
void operator delete(UDecimalValue* PROTOBUF_NONNULL msg, std::destroying_delete_t) {
|
||||
SharedDtor(*msg);
|
||||
::google::protobuf::internal::SizedDelete(msg, sizeof(UDecimalValue));
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename = void>
|
||||
explicit PROTOBUF_CONSTEXPR UDecimalValue(::google::protobuf::internal::ConstantInitialized);
|
||||
|
||||
inline UDecimalValue(const UDecimalValue& from) : UDecimalValue(nullptr, from) {}
|
||||
inline UDecimalValue(UDecimalValue&& from) noexcept
|
||||
: UDecimalValue(nullptr, ::std::move(from)) {}
|
||||
inline UDecimalValue& operator=(const UDecimalValue& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline UDecimalValue& operator=(UDecimalValue&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const
|
||||
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance);
|
||||
}
|
||||
inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields()
|
||||
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() {
|
||||
return GetDescriptor();
|
||||
}
|
||||
static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() {
|
||||
return default_instance().GetMetadata().descriptor;
|
||||
}
|
||||
static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() {
|
||||
return default_instance().GetMetadata().reflection;
|
||||
}
|
||||
static const UDecimalValue& default_instance() {
|
||||
return *reinterpret_cast<const UDecimalValue*>(
|
||||
&_UDecimalValue_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages = 13;
|
||||
friend void swap(UDecimalValue& a, UDecimalValue& b) { a.Swap(&b); }
|
||||
inline void Swap(UDecimalValue* PROTOBUF_NONNULL other) {
|
||||
if (other == this) return;
|
||||
if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) {
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::google::protobuf::internal::GenericSwap(this, other);
|
||||
}
|
||||
}
|
||||
void UnsafeArenaSwap(UDecimalValue* PROTOBUF_NONNULL other) {
|
||||
if (other == this) return;
|
||||
ABSL_DCHECK(GetArena() == other->GetArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
UDecimalValue* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const {
|
||||
return ::google::protobuf::Message::DefaultConstruct<UDecimalValue>(arena);
|
||||
}
|
||||
using ::google::protobuf::Message::CopyFrom;
|
||||
void CopyFrom(const UDecimalValue& from);
|
||||
using ::google::protobuf::Message::MergeFrom;
|
||||
void MergeFrom(const UDecimalValue& from) { UDecimalValue::MergeImpl(*this, from); }
|
||||
|
||||
private:
|
||||
static void MergeImpl(::google::protobuf::MessageLite& to_msg,
|
||||
const ::google::protobuf::MessageLite& from_msg);
|
||||
|
||||
public:
|
||||
bool IsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL;
|
||||
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
||||
private:
|
||||
static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg);
|
||||
static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize(
|
||||
const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target,
|
||||
::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream);
|
||||
|
||||
public:
|
||||
::size_t ByteSizeLong() const { return ByteSizeLong(*this); }
|
||||
::uint8_t* PROTOBUF_NONNULL _InternalSerialize(
|
||||
::uint8_t* PROTOBUF_NONNULL target,
|
||||
::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const {
|
||||
return _InternalSerialize(*this, target, stream);
|
||||
}
|
||||
#else // PROTOBUF_CUSTOM_VTABLE
|
||||
::size_t ByteSizeLong() const final;
|
||||
::uint8_t* PROTOBUF_NONNULL _InternalSerialize(
|
||||
::uint8_t* PROTOBUF_NONNULL target,
|
||||
::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final;
|
||||
#endif // PROTOBUF_CUSTOM_VTABLE
|
||||
int GetCachedSize() const { return _impl_._cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena);
|
||||
static void SharedDtor(MessageLite& self);
|
||||
void InternalSwap(UDecimalValue* PROTOBUF_NONNULL other);
|
||||
private:
|
||||
template <typename T>
|
||||
friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)();
|
||||
static ::absl::string_view FullMessageName() { return "tari.rpc.UDecimalValue"; }
|
||||
|
||||
protected:
|
||||
explicit UDecimalValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena);
|
||||
UDecimalValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const UDecimalValue& from);
|
||||
UDecimalValue(
|
||||
::google::protobuf::Arena* PROTOBUF_NULLABLE arena, UDecimalValue&& from) noexcept
|
||||
: UDecimalValue(arena) {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL;
|
||||
static void* PROTOBUF_NONNULL PlacementNew_(
|
||||
const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem,
|
||||
::google::protobuf::Arena* PROTOBUF_NULLABLE arena);
|
||||
static constexpr auto InternalNewImpl_();
|
||||
|
||||
public:
|
||||
static constexpr auto InternalGenerateClassData_();
|
||||
|
||||
::google::protobuf::Metadata GetMetadata() const;
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
enum : int {
|
||||
kUnitsFieldNumber = 1,
|
||||
kNanosFieldNumber = 2,
|
||||
};
|
||||
// uint64 units = 1;
|
||||
void clear_units() ;
|
||||
::uint64_t units() const;
|
||||
void set_units(::uint64_t value);
|
||||
|
||||
private:
|
||||
::uint64_t _internal_units() const;
|
||||
void _internal_set_units(::uint64_t value);
|
||||
|
||||
public:
|
||||
// fixed32 nanos = 2;
|
||||
void clear_nanos() ;
|
||||
::uint32_t nanos() const;
|
||||
void set_nanos(::uint32_t value);
|
||||
|
||||
private:
|
||||
::uint32_t _internal_nanos() const;
|
||||
void _internal_set_nanos(::uint32_t value);
|
||||
|
||||
public:
|
||||
// @@protoc_insertion_point(class_scope:tari.rpc.UDecimalValue)
|
||||
private:
|
||||
class _Internal;
|
||||
friend class ::google::protobuf::internal::TcParser;
|
||||
static const ::google::protobuf::internal::TcParseTable<1, 2,
|
||||
0, 0,
|
||||
2>
|
||||
_table_;
|
||||
|
||||
friend class ::google::protobuf::MessageLite;
|
||||
friend class ::google::protobuf::Arena;
|
||||
template <typename T>
|
||||
friend class ::google::protobuf::Arena::InternalHelper;
|
||||
using InternalArenaConstructable_ = void;
|
||||
using DestructorSkippable_ = void;
|
||||
struct Impl_ {
|
||||
inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept;
|
||||
inline explicit Impl_(
|
||||
::google::protobuf::internal::InternalVisibility visibility,
|
||||
::google::protobuf::Arena* PROTOBUF_NULLABLE arena);
|
||||
inline explicit Impl_(
|
||||
::google::protobuf::internal::InternalVisibility visibility,
|
||||
::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from,
|
||||
const UDecimalValue& from_msg);
|
||||
::google::protobuf::internal::HasBits<1> _has_bits_;
|
||||
::google::protobuf::internal::CachedSize _cached_size_;
|
||||
::uint64_t units_;
|
||||
::uint32_t nanos_;
|
||||
PROTOBUF_TSAN_DECLARE_MEMBER
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
friend struct ::TableStruct_types_2eproto;
|
||||
};
|
||||
|
||||
extern const ::google::protobuf::internal::ClassDataFull UDecimalValue_class_data_;
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class Signature final : public ::google::protobuf::Message
|
||||
/* @@protoc_insertion_point(class_definition:tari.rpc.Signature) */ {
|
||||
public:
|
||||
@@ -5787,6 +5994,58 @@ inline void ConsensusConstants::_internal_set_vn_registration_max_vns_per_epoch(
|
||||
_impl_.vn_registration_max_vns_per_epoch_ = value;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// UDecimalValue
|
||||
|
||||
// uint64 units = 1;
|
||||
inline void UDecimalValue::clear_units() {
|
||||
::google::protobuf::internal::TSanWrite(&_impl_);
|
||||
_impl_.units_ = ::uint64_t{0u};
|
||||
_impl_._has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
inline ::uint64_t UDecimalValue::units() const {
|
||||
// @@protoc_insertion_point(field_get:tari.rpc.UDecimalValue.units)
|
||||
return _internal_units();
|
||||
}
|
||||
inline void UDecimalValue::set_units(::uint64_t value) {
|
||||
_internal_set_units(value);
|
||||
_impl_._has_bits_[0] |= 0x00000001u;
|
||||
// @@protoc_insertion_point(field_set:tari.rpc.UDecimalValue.units)
|
||||
}
|
||||
inline ::uint64_t UDecimalValue::_internal_units() const {
|
||||
::google::protobuf::internal::TSanRead(&_impl_);
|
||||
return _impl_.units_;
|
||||
}
|
||||
inline void UDecimalValue::_internal_set_units(::uint64_t value) {
|
||||
::google::protobuf::internal::TSanWrite(&_impl_);
|
||||
_impl_.units_ = value;
|
||||
}
|
||||
|
||||
// fixed32 nanos = 2;
|
||||
inline void UDecimalValue::clear_nanos() {
|
||||
::google::protobuf::internal::TSanWrite(&_impl_);
|
||||
_impl_.nanos_ = 0u;
|
||||
_impl_._has_bits_[0] &= ~0x00000002u;
|
||||
}
|
||||
inline ::uint32_t UDecimalValue::nanos() const {
|
||||
// @@protoc_insertion_point(field_get:tari.rpc.UDecimalValue.nanos)
|
||||
return _internal_nanos();
|
||||
}
|
||||
inline void UDecimalValue::set_nanos(::uint32_t value) {
|
||||
_internal_set_nanos(value);
|
||||
_impl_._has_bits_[0] |= 0x00000002u;
|
||||
// @@protoc_insertion_point(field_set:tari.rpc.UDecimalValue.nanos)
|
||||
}
|
||||
inline ::uint32_t UDecimalValue::_internal_nanos() const {
|
||||
::google::protobuf::internal::TSanRead(&_impl_);
|
||||
return _impl_.nanos_;
|
||||
}
|
||||
inline void UDecimalValue::_internal_set_nanos(::uint32_t value) {
|
||||
::google::protobuf::internal::TSanWrite(&_impl_);
|
||||
_impl_.nanos_ = value;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
+10
@@ -146,3 +146,13 @@ message ConsensusConstants {
|
||||
uint32 vn_registration_max_vns_initial_epoch = 38;
|
||||
uint32 vn_registration_max_vns_per_epoch = 39;
|
||||
}
|
||||
|
||||
// Unsigned decimal value, examples:
|
||||
// 12345.6789 -> { units = 12345, nanos = 678900000 }
|
||||
// 12345.0006789 -> { units = 12345, nanos = 678900 }
|
||||
message UDecimalValue {
|
||||
// Whole units part of the amount
|
||||
uint64 units = 1;
|
||||
// Nano units of the amount (10^-9)
|
||||
fixed32 nanos = 2;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
Submodule external/src/cppzmq updated: 57cc98f8fc...072ed2683f
+13
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2014-2020, The Monero Project
|
||||
// Copyright (c) 2014-2024, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@@ -42,6 +42,13 @@ const fe fe_d = {-10913610, 13857413, -15372611, 6949391, 114729, -8787816, -627
|
||||
const fe fe_sqrtm1 = {-32595792, -7943725, 9377950, 3500415, 12389472, -272473, -25146209, -2005654, 326686, 11406482}; /* sqrt(-1) */
|
||||
const fe fe_d2 = {-21827239, -5839606, -30745221, 13898782, 229458, 15978800, -12551817, -6495438, 29715968, 9444199}; /* 2 * d */
|
||||
|
||||
/* a = -1 */
|
||||
// TODO: double check these consts
|
||||
const fe fe_a_sub_d = {10913609, -13857413, 15372611, -6949391, -114729, 8787816, 6275908, 3247719, 18696448, 12055116}; /* a - d */
|
||||
const fe fe_a0 = {-21827241, -5839606, -30745221, 13898782, 229458, 15978800, -12551817, -6495438, 29715968, 9444199}; /* A0 = 2 * (a + d) */
|
||||
const fe fe_ap = {-23454401, 11679213, -5618422, 5756869, -458917, 1596832, 25103633, 12990876, 7676928, 14666033}; /* Ap = -2 * A0 */
|
||||
const fe fe_msqrt2b = {-1359796, -3165658, 8463188, -8916281, -9242332, 8801166, -2887120, 14417306, 28934311, 6371549};
|
||||
|
||||
/* base[i][j] = (j+1)*256^i*B */
|
||||
const ge_precomp ge_base[32][8] = {
|
||||
{
|
||||
@@ -874,6 +881,11 @@ const fe fe_fffb1 = {-31702527, -2466483, -26106795, -12203692, -12169197, -3210
|
||||
const fe fe_fffb2 = {8166131, -6741800, -17040804, 3154616, 21461005, 1466302, -30876704, -6368709, 10503587, -13363080}; /* sqrt(2 * A * (A + 2)) */
|
||||
const fe fe_fffb3 = {-13620103, 14639558, 4532995, 7679154, 16815101, -15883539, -22863840, -14813421, 13716513, -6477756}; /* sqrt(-sqrt(-1) * A * (A + 2)) */
|
||||
const fe fe_fffb4 = {-21786234, -12173074, 21573800, 4524538, -4645904, 16204591, 8012863, -8444712, 3212926, 6885324}; /* sqrt(sqrt(-1) * A * (A + 2)) */
|
||||
const fe fe_a_inv_3 = {-22207407, 11184811, 22369621, -11184811, -22369621, 11184811, 22369621, -11184811, -22369621, 11184811}; /* A / 3*/
|
||||
const fe fe_c = {-12222970, -8312128, -11511410, 9067497, -15300785, -241793, 25456130, 14121551, -12187136, 3972024}; /* sqrt(-(A + 2))*/
|
||||
const fe fe_one = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
const fe fe_m1 = {-1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
const fe fe_inv2 = {10, 0, 0, 0, 0, 0, 0, 0, 0, -16777216}; /* 1 / 2 */
|
||||
const ge_p3 ge_p3_identity = { {0}, {1, 0}, {1, 0}, {0} };
|
||||
const ge_p3 ge_p3_H = {
|
||||
{7329926, -15101362, 31411471, 7614783, 27996851, -3197071, -11157635, -6878293, 466949, -7986503},
|
||||
|
||||
Vendored
+360
-54
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2014-2020, The Monero Project
|
||||
// Copyright (c) 2014-2024, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@@ -34,13 +34,13 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "crypto-ops.h"
|
||||
|
||||
/* Predeclarations */
|
||||
|
||||
static void fe_mul(fe, const fe, const fe);
|
||||
static void fe_sq(fe, const fe);
|
||||
static void ge_madd(ge_p1p1 *, const ge_p3 *, const ge_precomp *);
|
||||
static void ge_msub(ge_p1p1 *, const ge_p3 *, const ge_precomp *);
|
||||
static void ge_p2_0(ge_p2 *);
|
||||
@@ -73,7 +73,7 @@ uint64_t load_4(const unsigned char *in)
|
||||
h = 0
|
||||
*/
|
||||
|
||||
static void fe_0(fe h) {
|
||||
void fe_0(fe h) {
|
||||
h[0] = 0;
|
||||
h[1] = 0;
|
||||
h[2] = 0;
|
||||
@@ -92,7 +92,7 @@ static void fe_0(fe h) {
|
||||
h = 1
|
||||
*/
|
||||
|
||||
static void fe_1(fe h) {
|
||||
void fe_1(fe h) {
|
||||
h[0] = 1;
|
||||
h[1] = 0;
|
||||
h[2] = 0;
|
||||
@@ -232,7 +232,7 @@ static void fe_cmov(fe f, const fe g, unsigned int b) {
|
||||
h = f
|
||||
*/
|
||||
|
||||
static void fe_copy(fe h, const fe f) {
|
||||
void fe_copy(fe h, const fe f) {
|
||||
int32_t f0 = f[0];
|
||||
int32_t f1 = f[1];
|
||||
int32_t f2 = f[2];
|
||||
@@ -315,6 +315,39 @@ void fe_invert(fe out, const fe z) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Montgomery's trick
|
||||
// https://iacr.org/archive/pkc2004/29470042/29470042.pdf 2.2
|
||||
int fe_batch_invert(fe *out, const fe *in, const int n) {
|
||||
if (n == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Step 1: collect initial muls
|
||||
fe *init_muls = (fe *) malloc(n * sizeof(fe));
|
||||
if (!init_muls) {
|
||||
return 1;
|
||||
}
|
||||
memcpy(&init_muls[0], &in[0], sizeof(fe));
|
||||
for (int i = 1; i < n; ++i) {
|
||||
fe_mul(init_muls[i], init_muls[i-1], in[i]);
|
||||
}
|
||||
|
||||
// Step 2: get the inverse of all elems multiplied together
|
||||
fe a;
|
||||
fe_invert(a, init_muls[n-1]);
|
||||
|
||||
// Step 3: get each inverse
|
||||
for (int i = n; i > 1; --i) {
|
||||
fe_mul(out[i-1], a, init_muls[i-2]);
|
||||
fe_mul(a, a, in[i-1]);
|
||||
}
|
||||
memcpy(&out[0], &a, sizeof(fe));
|
||||
|
||||
free(init_muls);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* From fe_isnegative.c */
|
||||
|
||||
/*
|
||||
@@ -325,7 +358,7 @@ Preconditions:
|
||||
|f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
|
||||
*/
|
||||
|
||||
static int fe_isnegative(const fe f) {
|
||||
int fe_isnegative(const fe f) {
|
||||
unsigned char s[32];
|
||||
fe_tobytes(s, f);
|
||||
return s[0] & 1;
|
||||
@@ -376,7 +409,7 @@ Can get away with 11 carries, but then data flow is much deeper.
|
||||
With tighter constraints on inputs can squeeze carries into int32.
|
||||
*/
|
||||
|
||||
static void fe_mul(fe h, const fe f, const fe g) {
|
||||
void fe_mul(fe h, const fe f, const fe g) {
|
||||
int32_t f0 = f[0];
|
||||
int32_t f1 = f[1];
|
||||
int32_t f2 = f[2];
|
||||
@@ -606,7 +639,7 @@ Postconditions:
|
||||
|h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
|
||||
*/
|
||||
|
||||
static void fe_neg(fe h, const fe f) {
|
||||
void fe_neg(fe h, const fe f) {
|
||||
int32_t f0 = f[0];
|
||||
int32_t f1 = f[1];
|
||||
int32_t f2 = f[2];
|
||||
@@ -656,7 +689,7 @@ Postconditions:
|
||||
See fe_mul.c for discussion of implementation strategy.
|
||||
*/
|
||||
|
||||
static void fe_sq(fe h, const fe f) {
|
||||
void fe_sq(fe h, const fe f) {
|
||||
int32_t f0 = f[0];
|
||||
int32_t f1 = f[1];
|
||||
int32_t f2 = f[2];
|
||||
@@ -960,7 +993,7 @@ Postconditions:
|
||||
|h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
|
||||
*/
|
||||
|
||||
static void fe_sub(fe h, const fe f, const fe g) {
|
||||
void fe_sub(fe h, const fe f, const fe g) {
|
||||
int32_t f0 = f[0];
|
||||
int32_t f1 = f[1];
|
||||
int32_t f2 = f[2];
|
||||
@@ -1330,16 +1363,9 @@ void ge_double_scalarmult_base_vartime_p3(ge_p3 *r3, const unsigned char *a, con
|
||||
}
|
||||
}
|
||||
|
||||
/* From ge_frombytes.c, modified */
|
||||
|
||||
int ge_frombytes_vartime(ge_p3 *h, const unsigned char *s) {
|
||||
fe u;
|
||||
fe v;
|
||||
fe vxx;
|
||||
fe check;
|
||||
|
||||
/* From fe_frombytes.c */
|
||||
/* From fe_frombytes.c */
|
||||
|
||||
int fe_frombytes_vartime(fe y, const unsigned char *s) {
|
||||
int64_t h0 = load_4(s);
|
||||
int64_t h1 = load_3(s + 4) << 6;
|
||||
int64_t h2 = load_3(s + 7) << 5;
|
||||
@@ -1380,18 +1406,31 @@ int ge_frombytes_vartime(ge_p3 *h, const unsigned char *s) {
|
||||
carry6 = (h6 + (int64_t) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
|
||||
carry8 = (h8 + (int64_t) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
|
||||
|
||||
h->Y[0] = h0;
|
||||
h->Y[1] = h1;
|
||||
h->Y[2] = h2;
|
||||
h->Y[3] = h3;
|
||||
h->Y[4] = h4;
|
||||
h->Y[5] = h5;
|
||||
h->Y[6] = h6;
|
||||
h->Y[7] = h7;
|
||||
h->Y[8] = h8;
|
||||
h->Y[9] = h9;
|
||||
y[0] = h0;
|
||||
y[1] = h1;
|
||||
y[2] = h2;
|
||||
y[3] = h3;
|
||||
y[4] = h4;
|
||||
y[5] = h5;
|
||||
y[6] = h6;
|
||||
y[7] = h7;
|
||||
y[8] = h8;
|
||||
y[9] = h9;
|
||||
|
||||
/* End fe_frombytes.c */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* From ge_frombytes.c, modified */
|
||||
|
||||
int ge_frombytes_vartime(ge_p3 *h, const unsigned char *s) {
|
||||
fe u;
|
||||
fe v;
|
||||
fe vxx;
|
||||
fe check;
|
||||
|
||||
if (fe_frombytes_vartime(h->Y, s) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
fe_1(h->Z);
|
||||
fe_sq(u, h->Y);
|
||||
@@ -1608,7 +1647,7 @@ static void ge_precomp_cmov(ge_precomp *t, const ge_precomp *u, unsigned char b)
|
||||
fe_cmov(t->xy2d, u->xy2d, b);
|
||||
}
|
||||
|
||||
static void select(ge_precomp *t, int pos, signed char b) {
|
||||
static void _select(ge_precomp *t, int pos, signed char b) {
|
||||
ge_precomp minust;
|
||||
unsigned char bnegative = negative(b);
|
||||
unsigned char babs = b - (((-bnegative) & b) << 1);
|
||||
@@ -1628,6 +1667,32 @@ static void select(ge_precomp *t, int pos, signed char b) {
|
||||
ge_precomp_cmov(t, &minust, bnegative);
|
||||
}
|
||||
|
||||
// With these select_vartime/ge_scalarmult_base_vartime I got ~25% speed up comparing to the select/ge_scalarmult_base -- sowle
|
||||
static void select_vartime(ge_precomp *t, int pos, signed char b) {
|
||||
unsigned char bnegative = negative(b);
|
||||
unsigned char babs = b - (((-bnegative) & b) << 1);
|
||||
const ge_precomp* base;
|
||||
|
||||
if (babs == 0)
|
||||
{
|
||||
ge_precomp_0(t);
|
||||
}
|
||||
else if (bnegative == 0)
|
||||
{
|
||||
base = &ge_base[pos][babs - 1];
|
||||
fe_copy(t->yplusx, base->yplusx);
|
||||
fe_copy(t->yminusx, base->yminusx);
|
||||
fe_copy(t->xy2d, base->xy2d);
|
||||
}
|
||||
else
|
||||
{
|
||||
base = &ge_base[pos][babs - 1];
|
||||
fe_copy(t->yplusx, base->yminusx);
|
||||
fe_copy(t->yminusx, base->yplusx);
|
||||
fe_neg(t->xy2d, base->xy2d);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
h = a * B
|
||||
where a = a[0]+256*a[1]+...+256^31 a[31]
|
||||
@@ -1664,7 +1729,7 @@ void ge_scalarmult_base(ge_p3 *h, const unsigned char *a) {
|
||||
|
||||
ge_p3_0(h);
|
||||
for (i = 1; i < 64; i += 2) {
|
||||
select(&t, i / 2, e[i]);
|
||||
_select(&t, i / 2, e[i]);
|
||||
ge_madd(&r, h, &t); ge_p1p1_to_p3(h, &r);
|
||||
}
|
||||
|
||||
@@ -1674,7 +1739,49 @@ void ge_scalarmult_base(ge_p3 *h, const unsigned char *a) {
|
||||
ge_p2_dbl(&r, &s); ge_p1p1_to_p3(h, &r);
|
||||
|
||||
for (i = 0; i < 64; i += 2) {
|
||||
select(&t, i / 2, e[i]);
|
||||
_select(&t, i / 2, e[i]);
|
||||
ge_madd(&r, h, &t); ge_p1p1_to_p3(h, &r);
|
||||
}
|
||||
}
|
||||
|
||||
void ge_scalarmult_base_vartime(ge_p3 *h, const unsigned char *a) {
|
||||
signed char e[64];
|
||||
signed char carry;
|
||||
ge_p1p1 r;
|
||||
ge_p2 s;
|
||||
ge_precomp t;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 32; ++i) {
|
||||
e[2 * i + 0] = (a[i] >> 0) & 15;
|
||||
e[2 * i + 1] = (a[i] >> 4) & 15;
|
||||
}
|
||||
/* each e[i] is between 0 and 15 */
|
||||
/* e[63] is between 0 and 7 */
|
||||
|
||||
carry = 0;
|
||||
for (i = 0; i < 63; ++i) {
|
||||
e[i] += carry;
|
||||
carry = e[i] + 8;
|
||||
carry >>= 4;
|
||||
e[i] -= carry << 4;
|
||||
}
|
||||
e[63] += carry;
|
||||
/* each e[i] is between -8 and 8 */
|
||||
|
||||
ge_p3_0(h);
|
||||
for (i = 1; i < 64; i += 2) {
|
||||
select_vartime(&t, i / 2, e[i]);
|
||||
ge_madd(&r, h, &t); ge_p1p1_to_p3(h, &r);
|
||||
}
|
||||
|
||||
ge_p3_dbl(&r, h); ge_p1p1_to_p2(&s, &r);
|
||||
ge_p2_dbl(&r, &s); ge_p1p1_to_p2(&s, &r);
|
||||
ge_p2_dbl(&r, &s); ge_p1p1_to_p2(&s, &r);
|
||||
ge_p2_dbl(&r, &s); ge_p1p1_to_p3(h, &r);
|
||||
|
||||
for (i = 0; i < 64; i += 2) {
|
||||
select_vartime(&t, i / 2, e[i]);
|
||||
ge_madd(&r, h, &t); ge_p1p1_to_p3(h, &r);
|
||||
}
|
||||
}
|
||||
@@ -1955,26 +2062,18 @@ void sc_reduce(unsigned char *s) {
|
||||
s[31] = s11 >> 17;
|
||||
}
|
||||
|
||||
/* New code */
|
||||
/* From fe_pow22523.c */
|
||||
|
||||
static void fe_divpowm1(fe r, const fe u, const fe v) {
|
||||
fe v3, uv7, t0, t1, t2;
|
||||
void fe_pow22523(fe out, const fe z) {
|
||||
fe t0;
|
||||
fe t1;
|
||||
fe t2;
|
||||
int i;
|
||||
|
||||
fe_sq(v3, v);
|
||||
fe_mul(v3, v3, v); /* v3 = v^3 */
|
||||
fe_sq(uv7, v3);
|
||||
fe_mul(uv7, uv7, v);
|
||||
fe_mul(uv7, uv7, u); /* uv7 = uv^7 */
|
||||
|
||||
/*fe_pow22523(uv7, uv7);*/
|
||||
|
||||
/* From fe_pow22523.c */
|
||||
|
||||
fe_sq(t0, uv7);
|
||||
fe_sq(t0, z);
|
||||
fe_sq(t1, t0);
|
||||
fe_sq(t1, t1);
|
||||
fe_mul(t1, uv7, t1);
|
||||
fe_mul(t1, z, t1);
|
||||
fe_mul(t0, t0, t1);
|
||||
fe_sq(t0, t0);
|
||||
fe_mul(t0, t1, t0);
|
||||
@@ -2013,12 +2112,24 @@ static void fe_divpowm1(fe r, const fe u, const fe v) {
|
||||
fe_mul(t0, t1, t0);
|
||||
fe_sq(t0, t0);
|
||||
fe_sq(t0, t0);
|
||||
fe_mul(t0, t0, uv7);
|
||||
fe_mul(out, t0, z);
|
||||
}
|
||||
|
||||
/* End fe_pow22523.c */
|
||||
/* t0 = (uv^7)^((q-5)/8) */
|
||||
fe_mul(t0, t0, v3);
|
||||
fe_mul(r, t0, u); /* u^(m+1)v^(-(m+1)) */
|
||||
/* New code */
|
||||
|
||||
static void fe_divpowm1(fe r, const fe u, const fe v) {
|
||||
fe v3, uv7;
|
||||
|
||||
fe_sq(v3, v);
|
||||
fe_mul(v3, v3, v); /* v3 = v^3 */
|
||||
fe_sq(uv7, v3);
|
||||
fe_mul(uv7, uv7, v);
|
||||
fe_mul(uv7, uv7, u); /* uv7 = uv^7 */
|
||||
|
||||
fe_pow22523(r, uv7); /* (uv^7)^((q-5)/8) */
|
||||
|
||||
fe_mul(r, r, v3);
|
||||
fe_mul(r, r, u); /* u^(m+1)v^(-(m+1)) */
|
||||
}
|
||||
|
||||
static void ge_cached_0(ge_cached *r) {
|
||||
@@ -2096,6 +2207,43 @@ void ge_scalarmult(ge_p2 *r, const unsigned char *a, const ge_p3 *A) {
|
||||
}
|
||||
}
|
||||
|
||||
void ge_scalarmult_vartime(ge_p2 *r, const unsigned char *a, const ge_p3 *A) {
|
||||
signed char aslide[256];
|
||||
ge_dsmp Ai; /* A, 3A, 5A, 7A, 9A, 11A, 13A, 15A */
|
||||
ge_p1p1 t;
|
||||
ge_p3 u;
|
||||
ge_p2 r_p2;
|
||||
int i;
|
||||
|
||||
slide(aslide, a);
|
||||
ge_dsm_precomp(Ai, A);
|
||||
|
||||
ge_p2_0(&r_p2);
|
||||
ge_p2_0(r);
|
||||
|
||||
for (i = 255; i >= 0; --i) {
|
||||
if (aslide[i]) break;
|
||||
}
|
||||
|
||||
for (; i >= 0; --i) {
|
||||
ge_p2_dbl(&t, &r_p2);
|
||||
|
||||
if (aslide[i] > 0) {
|
||||
ge_p1p1_to_p3(&u, &t);
|
||||
ge_add(&t, &u, &Ai[aslide[i] / 2]);
|
||||
}
|
||||
else if (aslide[i] < 0) {
|
||||
ge_p1p1_to_p3(&u, &t);
|
||||
ge_sub(&t, &u, &Ai[(-aslide[i]) / 2]);
|
||||
}
|
||||
|
||||
if (i != 0)
|
||||
ge_p1p1_to_p2(&r_p2, &t);
|
||||
else
|
||||
ge_p1p1_to_p2(r, &t); // last step
|
||||
}
|
||||
}
|
||||
|
||||
void ge_scalarmult_p3(ge_p3 *r3, const unsigned char *a, const ge_p3 *A) {
|
||||
signed char e[64];
|
||||
int carry, carry2, i;
|
||||
@@ -2431,6 +2579,14 @@ void sc_0(unsigned char *s) {
|
||||
}
|
||||
}
|
||||
|
||||
void sc_1(unsigned char *s) {
|
||||
int i;
|
||||
s[0] = 1;
|
||||
for (i = 1; i < 32; i++) {
|
||||
s[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sc_reduce32(unsigned char *s) {
|
||||
int64_t s0 = 2097151 & load_3(s);
|
||||
int64_t s1 = 2097151 & (load_4(s + 2) >> 5);
|
||||
@@ -3831,6 +3987,92 @@ int sc_isnonzero(const unsigned char *s) {
|
||||
s[27] | s[28] | s[29] | s[30] | s[31]) - 1) >> 8) + 1;
|
||||
}
|
||||
|
||||
static void edwardsYZ_to_x25519(unsigned char *xbytes, const fe Y, const fe Z) {
|
||||
// y = Y/Z
|
||||
// x_mont = (1 + y) / (1 - y)
|
||||
// = (1 + Y/Z) / (1 - Y/Z)
|
||||
// = (Z + Y) / (Z - Y)
|
||||
|
||||
fe tmp0;
|
||||
fe tmp1;
|
||||
fe_add(tmp0, Z, Y); // Z + Y
|
||||
fe_sub(tmp1, Z, Y); // Z - Y
|
||||
fe_invert(tmp1, tmp1); // 1/(Z - Y)
|
||||
fe_mul(tmp0, tmp0, tmp1); // (Z + Y) / (Z - Y)
|
||||
fe_tobytes(xbytes, tmp0); // tobytes((Z + Y) / (Z - Y))
|
||||
}
|
||||
|
||||
void ge_p3_to_x25519(unsigned char *xbytes, const ge_p3 *h)
|
||||
{
|
||||
edwardsYZ_to_x25519(xbytes, h->Y, h->Z);
|
||||
}
|
||||
|
||||
int edwards_bytes_to_x25519_vartime(unsigned char *xbytes, const unsigned char *s)
|
||||
{
|
||||
/* From fe_frombytes.c */
|
||||
|
||||
int64_t h0 = load_4(s);
|
||||
int64_t h1 = load_3(s + 4) << 6;
|
||||
int64_t h2 = load_3(s + 7) << 5;
|
||||
int64_t h3 = load_3(s + 10) << 3;
|
||||
int64_t h4 = load_3(s + 13) << 2;
|
||||
int64_t h5 = load_4(s + 16);
|
||||
int64_t h6 = load_3(s + 20) << 7;
|
||||
int64_t h7 = load_3(s + 23) << 5;
|
||||
int64_t h8 = load_3(s + 26) << 4;
|
||||
int64_t h9 = (load_3(s + 29) & 8388607) << 2;
|
||||
int64_t carry0;
|
||||
int64_t carry1;
|
||||
int64_t carry2;
|
||||
int64_t carry3;
|
||||
int64_t carry4;
|
||||
int64_t carry5;
|
||||
int64_t carry6;
|
||||
int64_t carry7;
|
||||
int64_t carry8;
|
||||
int64_t carry9;
|
||||
|
||||
/* Validate the number to be canonical */
|
||||
if (h9 == 33554428 && h8 == 268435440 && h7 == 536870880 && h6 == 2147483520 &&
|
||||
h5 == 4294967295 && h4 == 67108860 && h3 == 134217720 && h2 == 536870880 &&
|
||||
h1 == 1073741760 && h0 >= 4294967277) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
carry9 = (h9 + (int64_t) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
|
||||
carry1 = (h1 + (int64_t) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
|
||||
carry3 = (h3 + (int64_t) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
|
||||
carry5 = (h5 + (int64_t) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
|
||||
carry7 = (h7 + (int64_t) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
|
||||
|
||||
carry0 = (h0 + (int64_t) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
|
||||
carry2 = (h2 + (int64_t) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
|
||||
carry4 = (h4 + (int64_t) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
|
||||
carry6 = (h6 + (int64_t) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
|
||||
carry8 = (h8 + (int64_t) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
|
||||
|
||||
fe Y;
|
||||
Y[0] = h0;
|
||||
Y[1] = h1;
|
||||
Y[2] = h2;
|
||||
Y[3] = h3;
|
||||
Y[4] = h4;
|
||||
Y[5] = h5;
|
||||
Y[6] = h6;
|
||||
Y[7] = h7;
|
||||
Y[8] = h8;
|
||||
Y[9] = h9;
|
||||
|
||||
/* End fe_frombytes.c */
|
||||
|
||||
fe Z;
|
||||
fe_1(Z);
|
||||
|
||||
edwardsYZ_to_x25519(xbytes, Y, Z);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ge_p3_is_point_at_infinity_vartime(const ge_p3 *p) {
|
||||
// https://eprint.iacr.org/2008/522
|
||||
// X == T == 0 and Y/Z == 1
|
||||
@@ -3879,3 +4121,67 @@ int ge_p3_is_point_at_infinity_vartime(const ge_p3 *p) {
|
||||
// Y/Z = 0/0
|
||||
return 0;
|
||||
}
|
||||
|
||||
// https://www.ietf.org/archive/id/draft-ietf-lwig-curve-representations-02.pdf E.2
|
||||
static void fe_ed_derivatives_to_wei_x(unsigned char *wei_x, const fe inv_one_minus_y, const fe one_plus_y)
|
||||
{
|
||||
// (1/(1-y))*(1+y)
|
||||
fe inv_one_minus_y_mul_one_plus_y;
|
||||
fe_mul(inv_one_minus_y_mul_one_plus_y, inv_one_minus_y, one_plus_y);
|
||||
|
||||
// wei x = (1/(1-y))*(1+y) + (A/3)
|
||||
fe wei_x_fe;
|
||||
fe_add(wei_x_fe, inv_one_minus_y_mul_one_plus_y, fe_a_inv_3);
|
||||
fe_tobytes(wei_x, wei_x_fe);
|
||||
}
|
||||
|
||||
// https://www.ietf.org/archive/id/draft-ietf-lwig-curve-representations-02.pdf E.2
|
||||
void fe_ed_derivatives_to_wei_x_y(unsigned char *wei_x, unsigned char *wei_y, const fe inv_one_minus_y, const fe one_plus_y, const fe inv_one_minus_y_mul_x)
|
||||
{
|
||||
fe_ed_derivatives_to_wei_x(wei_x, inv_one_minus_y, one_plus_y);
|
||||
|
||||
// c*(1+y)
|
||||
fe fe_c_mul_one_plus_y;
|
||||
fe_mul(fe_c_mul_one_plus_y, fe_c, one_plus_y);
|
||||
|
||||
// wei y = c * (1+y) * (1/((1-y)*x))
|
||||
fe wei_y_fe;
|
||||
fe_mul(wei_y_fe, fe_c_mul_one_plus_y, inv_one_minus_y_mul_x);
|
||||
fe_tobytes(wei_y, wei_y_fe);
|
||||
}
|
||||
|
||||
/*
|
||||
Since fe_add and fe_sub enforce the following conditions:
|
||||
|
||||
Preconditions:
|
||||
|f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
|
||||
|g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
|
||||
|
||||
Postconditions:
|
||||
|h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
|
||||
|
||||
We sometimes need to "reduce" field elems when they are in the poscondition's
|
||||
larger domain to match the precondition domain. This way we can take the output
|
||||
of fe_add or fe_sub and use it as input to another call to fe_add or fe_sub.
|
||||
|
||||
We reduce by converting the field elem to its byte repr, then re-deriving the
|
||||
field elem from the byte repr.
|
||||
*/
|
||||
void fe_reduce(fe reduced_f, const fe f)
|
||||
{
|
||||
unsigned char f_bytes[32];
|
||||
fe_tobytes(f_bytes, f);
|
||||
fe_frombytes_vartime(reduced_f, f_bytes);
|
||||
}
|
||||
|
||||
void fe_dbl(fe h, const fe f)
|
||||
{
|
||||
// Reduce the input for safety to ensure we meet the preconditions for fe_add
|
||||
fe f_reduced;
|
||||
fe_reduce(f_reduced, f);
|
||||
fe h_res;
|
||||
fe_add(h_res, f_reduced, f_reduced);
|
||||
// Reduce the output for safety to ensure the result can be used as input to
|
||||
// fe_add or fe_sub without an extra call to fe_reduce
|
||||
fe_reduce(h, h_res);
|
||||
}
|
||||
|
||||
Vendored
+41
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2014-2020, The Monero Project
|
||||
// Copyright (c) 2014-2024, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* From fe.h */
|
||||
|
||||
typedef int32_t fe[10];
|
||||
@@ -86,6 +88,7 @@ void ge_double_scalarmult_base_vartime_p3(ge_p3 *, const unsigned char *, const
|
||||
|
||||
extern const fe fe_sqrtm1;
|
||||
extern const fe fe_d;
|
||||
int fe_frombytes_vartime(fe, const unsigned char *);
|
||||
int ge_frombytes_vartime(ge_p3 *, const unsigned char *);
|
||||
|
||||
/* From ge_p1p1_to_p2.c */
|
||||
@@ -118,6 +121,8 @@ void ge_p3_tobytes(unsigned char *, const ge_p3 *);
|
||||
extern const ge_precomp ge_base[32][8];
|
||||
void ge_scalarmult_base(ge_p3 *, const unsigned char *);
|
||||
|
||||
void ge_scalarmult_base_vartime(ge_p3 *h, const unsigned char *a);
|
||||
|
||||
/* From ge_tobytes.c */
|
||||
|
||||
void ge_tobytes(unsigned char *, const ge_p2 *);
|
||||
@@ -126,25 +131,40 @@ void ge_tobytes(unsigned char *, const ge_p2 *);
|
||||
|
||||
void sc_reduce(unsigned char *);
|
||||
|
||||
/* From fe_pow22523.c */
|
||||
|
||||
void fe_pow22523(fe, const fe);
|
||||
|
||||
/* New code */
|
||||
|
||||
void ge_scalarmult(ge_p2 *, const unsigned char *, const ge_p3 *);
|
||||
void ge_scalarmult_vartime(ge_p2 *r, const unsigned char *a, const ge_p3 *A);
|
||||
void ge_scalarmult_p3(ge_p3 *, const unsigned char *, const ge_p3 *);
|
||||
void ge_double_scalarmult_precomp_vartime(ge_p2 *, const unsigned char *, const ge_p3 *, const unsigned char *, const ge_dsmp);
|
||||
void ge_triple_scalarmult_precomp_vartime(ge_p2 *, const unsigned char *, const ge_dsmp, const unsigned char *, const ge_dsmp, const unsigned char *, const ge_dsmp);
|
||||
void ge_double_scalarmult_precomp_vartime2(ge_p2 *, const unsigned char *, const ge_dsmp, const unsigned char *, const ge_dsmp);
|
||||
void ge_double_scalarmult_precomp_vartime2_p3(ge_p3 *, const unsigned char *, const ge_dsmp, const unsigned char *, const ge_dsmp);
|
||||
void ge_mul8(ge_p1p1 *, const ge_p2 *);
|
||||
extern const fe fe_a_sub_d;
|
||||
extern const fe fe_a0;
|
||||
extern const fe fe_ap;
|
||||
extern const fe fe_msqrt2b;
|
||||
extern const fe fe_ma2;
|
||||
extern const fe fe_ma;
|
||||
extern const fe fe_fffb1;
|
||||
extern const fe fe_fffb2;
|
||||
extern const fe fe_fffb3;
|
||||
extern const fe fe_fffb4;
|
||||
extern const fe fe_a_inv_3;
|
||||
extern const fe fe_c;
|
||||
extern const fe fe_one;
|
||||
extern const fe fe_m1;
|
||||
extern const fe fe_inv2;
|
||||
extern const ge_p3 ge_p3_identity;
|
||||
extern const ge_p3 ge_p3_H;
|
||||
void ge_fromfe_frombytes_vartime(ge_p2 *, const unsigned char *);
|
||||
void sc_0(unsigned char *);
|
||||
void sc_1(unsigned char *);
|
||||
void sc_reduce32(unsigned char *);
|
||||
void sc_add(unsigned char *, const unsigned char *, const unsigned char *);
|
||||
void sc_sub(unsigned char *, const unsigned char *, const unsigned char *);
|
||||
@@ -154,12 +174,32 @@ void sc_muladd(unsigned char *s, const unsigned char *a, const unsigned char *b,
|
||||
int sc_check(const unsigned char *);
|
||||
int sc_isnonzero(const unsigned char *); /* Doesn't normalize */
|
||||
|
||||
/**
|
||||
* brief: Convert Ed25519 y-coord to X25519 x-coord, AKA "ConvertPointE()" in the Carrot spec
|
||||
*/
|
||||
void ge_p3_to_x25519(unsigned char *xbytes, const ge_p3 *h);
|
||||
int edwards_bytes_to_x25519_vartime(unsigned char *xbytes, const unsigned char *s);
|
||||
|
||||
// internal
|
||||
uint64_t load_3(const unsigned char *in);
|
||||
uint64_t load_4(const unsigned char *in);
|
||||
void ge_sub(ge_p1p1 *r, const ge_p3 *p, const ge_cached *q);
|
||||
void fe_add(fe h, const fe f, const fe g);
|
||||
void fe_neg(fe h, const fe f);
|
||||
void fe_tobytes(unsigned char *, const fe);
|
||||
void fe_copy(fe h, const fe f);
|
||||
int fe_isnegative(const fe f);
|
||||
void fe_invert(fe out, const fe z);
|
||||
int fe_batch_invert(fe *out, const fe *in, const int n);
|
||||
void fe_mul(fe out, const fe, const fe);
|
||||
void fe_sq(fe h, const fe f);
|
||||
void fe_sub(fe h, const fe f, const fe g);
|
||||
void fe_0(fe h);
|
||||
void fe_1(fe h);
|
||||
|
||||
int ge_p3_is_point_at_infinity_vartime(const ge_p3 *p);
|
||||
|
||||
void fe_ed_derivatives_to_wei_x_y(unsigned char *wei_x, unsigned char *wei_y, const fe inv_one_minus_y, const fe one_plus_y, const fe inv_one_minus_y_mul_x);
|
||||
|
||||
void fe_reduce(fe reduced_f, const fe f);
|
||||
void fe_dbl(fe h, const fe f);
|
||||
|
||||
+251
@@ -0,0 +1,251 @@
|
||||
// Copyright (c) 2024, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4800)
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include "crypto-ops.h"
|
||||
}
|
||||
|
||||
#include "fcmp_pp_crypto.h"
|
||||
#include <cstring>
|
||||
|
||||
static bool fe_compare(const fe a, const fe b)
|
||||
{
|
||||
unsigned char a_bytes[32];
|
||||
unsigned char b_bytes[32];
|
||||
|
||||
fe_tobytes(a_bytes, a);
|
||||
fe_tobytes(b_bytes, b);
|
||||
|
||||
return memcmp(a_bytes, b_bytes, sizeof(a_bytes)) == 0;
|
||||
}
|
||||
|
||||
static bool sqrt_ext(fe y, const fe x)
|
||||
{
|
||||
fe y_res;
|
||||
|
||||
fe x2;
|
||||
fe_dbl(x2, x);
|
||||
|
||||
fe b;
|
||||
fe_pow22523(b, x2);
|
||||
|
||||
fe b_sq;
|
||||
fe_sq(b_sq, b);
|
||||
|
||||
fe c;
|
||||
fe_mul(c, x2, b_sq);
|
||||
|
||||
if (fe_compare(c, fe_one) || fe_compare(c, fe_m1))
|
||||
{
|
||||
fe_0(c);
|
||||
c[0] = 3;
|
||||
}
|
||||
|
||||
fe c_sub_1;
|
||||
fe_sub(c_sub_1, c, fe_one);
|
||||
|
||||
fe_mul(y_res, x, b);
|
||||
fe_mul(y_res, y_res, c_sub_1);
|
||||
|
||||
if (fe_isnegative(y_res)) {
|
||||
fe_neg(y_res, y_res);
|
||||
}
|
||||
|
||||
fe y_sq;
|
||||
fe_sq(y_sq, y_res);
|
||||
bool r = fe_compare(x, y_sq);
|
||||
|
||||
fe_copy(y, y_res);
|
||||
return r;
|
||||
};
|
||||
|
||||
namespace fcmp_pp
|
||||
{
|
||||
// TODO: impl faster sqrt
|
||||
bool sqrt(fe y, const fe x)
|
||||
{
|
||||
return sqrt_ext(y, x);
|
||||
};
|
||||
} // namespace fcmp_pp
|
||||
|
||||
static void inv_iso(fe u_out, fe w_out, const fe u, const fe w)
|
||||
{
|
||||
// 4u
|
||||
fe_dbl(u_out, u);
|
||||
fe_dbl(u_out, u_out);
|
||||
// 2w
|
||||
fe_dbl(w_out, w);
|
||||
};
|
||||
|
||||
static void inv_psi1(fe e_out, fe u_out, fe w_out, const fe e, const fe u, const fe w)
|
||||
{
|
||||
fe e_res, u_res, w_res;
|
||||
|
||||
fe tt;
|
||||
bool cc = sqrt_ext(tt, u);
|
||||
fe_copy(w_res, tt);
|
||||
fe w_;
|
||||
fe_copy(w_, w);
|
||||
fe_copy(e_res, e);
|
||||
|
||||
if (!cc)
|
||||
{
|
||||
fe tt_sq;
|
||||
fe_sq(tt_sq, tt);
|
||||
fe neg_u_dbl;
|
||||
fe_dbl(neg_u_dbl, u);
|
||||
fe_neg(neg_u_dbl, neg_u_dbl);
|
||||
if (fe_compare(tt_sq, neg_u_dbl)) {
|
||||
fe_mul(tt, tt, fe_sqrtm1);
|
||||
}
|
||||
|
||||
fe_mul(w_, w, tt);
|
||||
|
||||
fe e_sq;
|
||||
fe_sq(e_sq, e);
|
||||
fe_mul(w_res, fe_msqrt2b, e_sq);
|
||||
|
||||
fe_mul(e_res, e_res, tt);
|
||||
}
|
||||
|
||||
fe w_res_sq;
|
||||
fe_sq(w_res_sq, w_res);
|
||||
|
||||
fe e_res_sq;
|
||||
fe_sq(e_res_sq, e_res);
|
||||
|
||||
fe A_e_sq;
|
||||
fe_mul(A_e_sq, fe_a0, e_res_sq);
|
||||
|
||||
fe w_res_w;
|
||||
fe_mul(w_res_w, w_res, w_);
|
||||
|
||||
fe_sub(u_res, w_res_sq, A_e_sq);
|
||||
fe_reduce(u_res, u_res);
|
||||
fe_sub(u_res, u_res, w_res_w);
|
||||
fe_mul(u_res, u_res, fe_inv2);
|
||||
|
||||
fe_copy(e_out, e_res);
|
||||
fe_copy(u_out, u_res);
|
||||
fe_copy(w_out, w_res);
|
||||
};
|
||||
|
||||
static bool inv_psi2(fe u_out, fe w_out, const fe e, const fe u, const fe w)
|
||||
{
|
||||
fe u_res, w_res;
|
||||
|
||||
if (!fcmp_pp::sqrt(w_res, u))
|
||||
return false;
|
||||
fe e_sq;
|
||||
fe_sq(e_sq, e);
|
||||
fe Ap_e_sq;
|
||||
fe_mul(Ap_e_sq, fe_ap, e_sq);
|
||||
|
||||
fe w_res_w;
|
||||
fe_mul(w_res_w, w_res, w);
|
||||
|
||||
fe_sub(u_res, u, Ap_e_sq);
|
||||
fe_reduce(u_res, u_res);
|
||||
fe_sub(u_res, u_res, w_res_w);
|
||||
fe_mul(u_res, u_res, fe_inv2);
|
||||
|
||||
fe_copy(u_out, u_res);
|
||||
fe_copy(w_out, w_res);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
namespace fcmp_pp
|
||||
{
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
bool mul8_is_identity(const ge_p3 &point) {
|
||||
ge_p2 point_ge_p2;
|
||||
ge_p3_to_p2(&point_ge_p2, &point);
|
||||
ge_p1p1 point_mul8;
|
||||
ge_mul8(&point_mul8, &point_ge_p2);
|
||||
ge_p3 point_mul8_p3;
|
||||
ge_p1p1_to_p3(&point_mul8_p3, &point_mul8);
|
||||
return ge_p3_is_point_at_infinity_vartime(&point_mul8_p3);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// https://github.com/kayabaNerve/fcmp-plus-plus/blob/94744c5324e869a9483bbbd93a864e108304bf76/crypto/divisors/src/tests/torsion_check.rs
|
||||
// Returns true if point is torsion free
|
||||
// Pre-condition: point is a valid point and point*8 not equal to identity
|
||||
// WARNING1: this approach needs to be carefully vetted academically and audited
|
||||
// before it can be used in production.
|
||||
// WARNING2: since fe_add and fe_sub expect the input fe's to be within a
|
||||
// smaller domain than the output fe, we sometimes need to "reduce" a field elem
|
||||
// to chain calls to fe_add and fe_sub. Notice all calls to fe_reduce.
|
||||
bool torsion_check_vartime(const ge_p3 &point) {
|
||||
//assert(!mul8_is_identity(point));
|
||||
|
||||
// ed to wei
|
||||
fe e, u, w;
|
||||
{
|
||||
fe z_plus_ed_y, z_minus_ed_y;
|
||||
fe_add(z_plus_ed_y, fe_one, point.Y);
|
||||
fe_sub(z_minus_ed_y, fe_one, point.Y);
|
||||
|
||||
// e
|
||||
fe_mul(e, z_minus_ed_y, point.X);
|
||||
// u
|
||||
fe_mul(u, fe_a_sub_d, z_plus_ed_y);
|
||||
fe_mul(u, u, point.X);
|
||||
fe_mul(u, u, e);
|
||||
// w
|
||||
fe_dbl(w, z_minus_ed_y);
|
||||
}
|
||||
|
||||
//assert(check_e_u_w(e, u, w));
|
||||
|
||||
// Torsion check
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
inv_iso(u, w, u, w);
|
||||
if (!inv_psi2(u, w, e, u, w)) {
|
||||
return false;
|
||||
}
|
||||
inv_psi1(e, u, w, e, u, w);
|
||||
//assert(check_e_u_w(e, u, w));
|
||||
}
|
||||
|
||||
fe _;
|
||||
inv_iso(u, _, u, w);
|
||||
|
||||
if (!sqrt(u, u)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
}//namespace fcmp_pp
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2024, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace fcmp_pp
|
||||
{
|
||||
bool sqrt(fe y, const fe x);
|
||||
bool mul8_is_identity(const ge_p3 &point);
|
||||
bool torsion_check_vartime(const ge_p3 &point);
|
||||
} //namespace fcmp_pp
|
||||
Vendored
+1
-1
Submodule external/src/curl updated: 939e16f090...ebc5cb09a8
Vendored
+1
-1
Submodule external/src/grpc updated: 2b06027b57...42d5fab67b
Vendored
+1
-1
Submodule external/src/libuv updated: 012b1e9698...593eea1554
Vendored
+1
-1
Submodule external/src/libzmq updated: 1fce1ef005...22e433f95f
Vendored
+1
-1
Submodule external/src/miniupnp updated: 88a1515ea8...8503437d35
@@ -1,19 +1,19 @@
|
||||
diff --git a/src/crypto/rand/windows.cc b/src/crypto/rand/windows.cc
|
||||
index 59df467e7..aa5ac076c 100644
|
||||
--- a/src/crypto/rand/windows.cc
|
||||
+++ b/src/crypto/rand/windows.cc
|
||||
diff --git a/crypto/rand/windows.cc b/crypto/rand/windows.cc
|
||||
index ebd0d4afd..65e877f0e 100644
|
||||
--- a/crypto/rand/windows.cc
|
||||
+++ b/crypto/rand/windows.cc
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <windows.h>
|
||||
+#include <wincrypt.h>
|
||||
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
|
||||
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
@@ -57,16 +58,40 @@ void CRYPTO_sysrand(uint8_t *out, size_t requested) {
|
||||
using namespace bssl;
|
||||
|
||||
@@ -59,16 +60,39 @@ void bssl::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;
|
||||
typedef BOOL(WINAPI *ProcessPrngFunction)(PBYTE pbData, SIZE_T cbData);
|
||||
static ProcessPrngFunction g_processprng_fn = nullptr;
|
||||
+static HCRYPTPROV g_hCryptProv = 0;
|
||||
+
|
||||
+static BOOL WINAPI wrapper_CryptGenRandom(PBYTE pbData, SIZE_T cbData)
|
||||
@@ -21,21 +21,19 @@ index 59df467e7..aa5ac076c 100644
|
||||
+ return CryptGenRandom(g_hCryptProv, cbData, pbData);
|
||||
+}
|
||||
|
||||
static void init_processprng(void) {
|
||||
static void init_processprng() {
|
||||
HMODULE hmod = LoadLibraryW(L"bcryptprimitives");
|
||||
- if (hmod == NULL) {
|
||||
- if (hmod == nullptr) {
|
||||
- abort();
|
||||
- }
|
||||
- g_processprng_fn = (ProcessPrngFunction)GetProcAddress(hmod, "ProcessPrng");
|
||||
- if (g_processprng_fn == 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 == nullptr) {
|
||||
- abort();
|
||||
+
|
||||
+ if (CryptAcquireContext(&g_hCryptProv, NULL, NULL, PROV_RSA_FULL, 0)) {
|
||||
+ g_processprng_fn = &wrapper_CryptGenRandom;
|
||||
@@ -51,9 +49,9 @@ index 59df467e7..aa5ac076c 100644
|
||||
+ else {
|
||||
+ err = GetLastError();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ abort();
|
||||
}
|
||||
|
||||
void CRYPTO_init_sysrand(void) {
|
||||
void bssl::CRYPTO_init_sysrand() {
|
||||
|
||||
@@ -20,9 +20,8 @@ flags_libs="--target=aarch64-unknown-freebsd12.0 --sysroot=/usr/local/cross-free
|
||||
flags_p2pool="--target=aarch64-unknown-freebsd12.0 --sysroot=/usr/local/cross-freebsd-aarch64 -fuse-ld=lld -Wno-unused-command-line-argument $flags_size $flags_datetime"
|
||||
|
||||
cd /p2pool/external/src/curl
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/freebsd_aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/freebsd_aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
make -j$(nproc)
|
||||
cd lib && cp -f libcurl.a .libs
|
||||
|
||||
cd /p2pool/external/src/libuv
|
||||
rm -rf build
|
||||
@@ -38,7 +37,7 @@ make -j$(nproc)
|
||||
|
||||
cd /p2pool
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_TOOLCHAIN_FILE=../cmake/freebsd_aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool" -DOPENSSL_NO_ASM=ON -DSTATIC_BINARY=ON -DARCH_ID=aarch64
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_TOOLCHAIN_FILE=../cmake/freebsd_aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool" -DOPENSSL_NO_ASM=ON -DSTATIC_BINARY=ON -DARCH_ID=aarch64 -DGIT_COMMIT="$(git rev-parse --short=7 HEAD)"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
mkdir $1
|
||||
@@ -53,4 +52,4 @@ chmod 0775 $1/p2pool
|
||||
|
||||
tar cvf $1.tar --format=pax --pax-option='exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime' --sort=name --owner=0 --group=0 --mtime="$CURRENT_DATE $CURRENT_TIME" $1
|
||||
touch -t $TOUCH_DATE $1.tar
|
||||
7z a -tgzip -mx9 -mfb256 -stl $1.tar.gz $1.tar
|
||||
7z a -tgzip -mx9 -mfb256 -mpass15 -stl $1.tar.gz $1.tar
|
||||
|
||||
@@ -20,9 +20,8 @@ flags_libs="--target=x86_64-unknown-freebsd12.0 --sysroot=/usr/local/cross-freeb
|
||||
flags_p2pool="--target=x86_64-unknown-freebsd12.0 --sysroot=/usr/local/cross-freebsd-x86_64 -fuse-ld=lld -Wno-unused-command-line-argument $flags_size $flags_datetime"
|
||||
|
||||
cd /p2pool/external/src/curl
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/freebsd_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/freebsd_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
make -j$(nproc)
|
||||
cd lib && cp -f libcurl.a .libs
|
||||
|
||||
cd /p2pool/external/src/libuv
|
||||
rm -rf build
|
||||
@@ -38,7 +37,7 @@ make -j$(nproc)
|
||||
|
||||
cd /p2pool
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_TOOLCHAIN_FILE=../cmake/freebsd_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool" -DOPENSSL_NO_ASM=ON -DSTATIC_BINARY=ON -DARCH_ID=x86_64
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_TOOLCHAIN_FILE=../cmake/freebsd_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool" -DOPENSSL_NO_ASM=ON -DSTATIC_BINARY=ON -DARCH_ID=x86_64 -DGIT_COMMIT="$(git rev-parse --short=7 HEAD)"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
mkdir $1
|
||||
@@ -53,4 +52,4 @@ chmod 0775 $1/p2pool
|
||||
|
||||
tar cvf $1.tar --format=pax --pax-option='exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime' --sort=name --owner=0 --group=0 --mtime="$CURRENT_DATE $CURRENT_TIME" $1
|
||||
touch -t $TOUCH_DATE $1.tar
|
||||
7z a -tgzip -mx9 -mfb256 -stl $1.tar.gz $1.tar
|
||||
7z a -tgzip -mx9 -mfb256 -mpass15 -stl $1.tar.gz $1.tar
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
FROM ubuntu:24.04
|
||||
ADD prepare.sh /
|
||||
ADD prepare.sh clang_version.patch /
|
||||
RUN /prepare.sh
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
|
||||
index cce839295..b87fe998e 100644
|
||||
--- a/clang/lib/Frontend/InitPreprocessor.cpp
|
||||
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
|
||||
@@ -873,9 +873,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
|
||||
Builder.defineMacro("__clang_patchlevel__", TOSTR(CLANG_VERSION_PATCHLEVEL));
|
||||
#undef TOSTR
|
||||
#undef TOSTR2
|
||||
- Builder.defineMacro("__clang_version__",
|
||||
- "\"" CLANG_VERSION_STRING " "
|
||||
- + getClangFullRepositoryVersion() + "\"");
|
||||
+ Builder.defineMacro("__clang_version__", "\"" CLANG_VERSION_STRING "\"");
|
||||
|
||||
if (LangOpts.GNUCVersion != 0) {
|
||||
// Major, minor, patch, are given two decimal places each, so 4.2.1 becomes
|
||||
@@ -3,27 +3,28 @@ set -e
|
||||
|
||||
# Software versions to install
|
||||
|
||||
_7ZIP_VERSION=2501
|
||||
BINUTILS_VERSION=2_45
|
||||
CLANG_VERSION=20.1.8
|
||||
CMAKE_VERSION=4.1.1
|
||||
_7ZIP_VERSION=2600
|
||||
BINUTILS_VERSION=2_46
|
||||
CLANG_VERSION=21.1.8
|
||||
CMAKE_VERSION=4.3.1
|
||||
FREEBSD_VERSION=12.4
|
||||
GCC_VERSION=15.2.0
|
||||
GLIBC_VERSION=2.42
|
||||
LINUX_HEADERS_VERSION=6.16.3
|
||||
MACOSX_SDK_VERSION=15.5
|
||||
GLIBC_VERSION=2.43
|
||||
LINUX_HEADERS_VERSION=6.19.12
|
||||
MACOSX_SDK_VERSION=26.1
|
||||
OSXCROSS_VERSION=2bc739ebe45db5d72e176d2a4e1c7dd95464e8e2
|
||||
MAKE_VERSION=4.4.1
|
||||
MINGW_VERSION=13.0.0
|
||||
XZ_VERSION=5.8.1
|
||||
MINGW_VERSION=14.0.0
|
||||
XZ_VERSION=5.8.3
|
||||
TAR_VERSION=1.35
|
||||
|
||||
_7ZIP_SHA256="4ca3b7c6f2f67866b92622818b58233dc70367be2f36b498eb0bdeaaa44b53f4"
|
||||
CMAKE_SHA256="5a6c61cb62b38e153148a2c8d4af7b3d387f0c8c32b6dbceb5eb4af113efd65a"
|
||||
_7ZIP_SHA256="c74dc4a48492cde43f5fec10d53fb2a66f520e4a62a69d630c44cb22c477edc6"
|
||||
CMAKE_SHA256="208d76804009cbe8ec9aea0aa052c857c6e59bd289b43b9941c99324dc78b1d8"
|
||||
FREEBSD_AARCH64_SHA256="6c401819bfb93e810c9f9aa670a1e4685f924df5e7e0c9c6397dd6c16c954fa2"
|
||||
FREEBSD_X86_64_SHA256="581c7edacfd2fca2bdf5791f667402d22fccd8a5e184635e0cac075564d57aa8"
|
||||
GLIBC_SHA256="d1775e32e4628e64ef930f435b67bb63af7599acb6be2b335b9f19f16509f17f"
|
||||
HEADERS_SHA256="80439ba055c12f541abf44b8fc3c9b825a8f42fc25ce67462ec7e556c5790b85"
|
||||
MACOSX_SDK_SHA256="c15cf0f3f17d714d1aa5a642da8e118db53d79429eb015771ba816aa7c6c1cbd"
|
||||
GLIBC_SHA256="d9c86c6b5dbddb43a3e08270c5844fc5177d19442cf5b8df4be7c07cd5fa3831"
|
||||
HEADERS_SHA256="ce5c4f1205f9729286b569b037649591555f31ca1e03cc504bd3b70b8e58a8d5"
|
||||
MACOSX_SDK_SHA256="beee7212d265a6d2867d0236cc069314b38d5fb3486a6515734e76fa210c784c"
|
||||
MAKE_SHA256="dd16fb1d67bfab79a72f5e8390735c49e3e8e70b4945a15ab1f81ddb78658fb3"
|
||||
TAR_SHA256="4d62ff37342ec7aed748535323930c7cf94acf71c3591882b26a7ea50f3edc16"
|
||||
|
||||
@@ -32,15 +33,59 @@ echo "Install prerequisites"
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
apt-get update && apt-get upgrade -yq --no-install-recommends
|
||||
apt-get install -yq --no-install-recommends ca-certificates curl bzip2 flex texinfo bison ninja-build python3 file rsync xz-utils gawk gettext patch git gcc g++ make
|
||||
apt-get install -yq --no-install-recommends ca-certificates curl bzip2 flex texinfo bison ninja-build python3 python3-yaml file rsync xz-utils gawk gettext patch git gcc g++
|
||||
|
||||
echo "Install 7-zip"
|
||||
echo "Cloning the P2Pool repository in background"
|
||||
|
||||
cd /
|
||||
git clone --recursive --jobs $(nproc) https://github.com/SChernykh/p2pool &
|
||||
|
||||
echo "Download archives"
|
||||
|
||||
cd /root
|
||||
|
||||
MAKE_NAME=make-$MAKE_VERSION
|
||||
MAKE_FILE=$MAKE_NAME.tar.gz
|
||||
|
||||
_7ZIP_FILE=7z$_7ZIP_VERSION-linux-x64.tar.xz
|
||||
|
||||
curl -L -O https://7-zip.org/a/$_7ZIP_FILE
|
||||
CMAKE_NAME=cmake-$CMAKE_VERSION-linux-x86_64
|
||||
CMAKE_FILE=$CMAKE_NAME.tar.gz
|
||||
|
||||
HEADERS_FILE=linux-$LINUX_HEADERS_VERSION.tar.xz
|
||||
|
||||
GLIBC_FILE=glibc-$GLIBC_VERSION.tar.xz
|
||||
|
||||
MACOSX_SDK_FILE=MacOSX$MACOSX_SDK_VERSION.sdk.tar.xz
|
||||
|
||||
FREEBSD_FILE=base.txz
|
||||
|
||||
TAR_FILE=tar-$TAR_VERSION.tar.xz
|
||||
|
||||
mkdir /usr/local/cross-freebsd-x86_64
|
||||
mkdir /usr/local/cross-freebsd-aarch64
|
||||
|
||||
curl -L -Z \
|
||||
-O https://ftpmirror.gnu.org/make/$MAKE_FILE \
|
||||
-O https://7-zip.org/a/$_7ZIP_FILE \
|
||||
-O https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/$CMAKE_FILE \
|
||||
-O https://www.kernel.org/pub/linux/kernel/v6.x/$HEADERS_FILE \
|
||||
-O https://ftpmirror.gnu.org/glibc/$GLIBC_FILE \
|
||||
-O https://github.com/joseluisq/macosx-sdks/releases/download/$MACOSX_SDK_VERSION/$MACOSX_SDK_FILE \
|
||||
-o /usr/local/cross-freebsd-x86_64/$FREEBSD_FILE https://archive.freebsd.org/old-releases/amd64/$FREEBSD_VERSION-RELEASE/$FREEBSD_FILE \
|
||||
-o /usr/local/cross-freebsd-aarch64/$FREEBSD_FILE https://archive.freebsd.org/old-releases/arm64/$FREEBSD_VERSION-RELEASE/$FREEBSD_FILE \
|
||||
-O https://ftpmirror.gnu.org/tar/$TAR_FILE
|
||||
|
||||
echo "Verifying checksums"
|
||||
|
||||
cd /root
|
||||
|
||||
MAKE_FILE_SHA256="$(sha256sum $MAKE_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $MAKE_FILE_SHA256 != $MAKE_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $MAKE_FILE - expected $MAKE_SHA256, got $MAKE_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
_7ZIP_FILE_SHA256="$(sha256sum $_7ZIP_FILE | awk '{ print $1 }')"
|
||||
|
||||
@@ -49,6 +94,88 @@ if [ $_7ZIP_FILE_SHA256 != $_7ZIP_SHA256 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CMAKE_FILE_SHA256="$(sha256sum $CMAKE_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $CMAKE_FILE_SHA256 != $CMAKE_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $CMAKE_FILE - expected $CMAKE_SHA256, got $CMAKE_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
HEADERS_FILE_SHA256="$(sha256sum $HEADERS_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $HEADERS_FILE_SHA256 != $HEADERS_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $HEADERS_FILE - expected $HEADERS_SHA256, got $HEADERS_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
GLIBC_FILE_SHA256="$(sha256sum $GLIBC_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $GLIBC_FILE_SHA256 != $GLIBC_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $GLIBC_FILE - expected $GLIBC_SHA256, got $GLIBC_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MACOSX_SDK_FILE_SHA256="$(sha256sum $MACOSX_SDK_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $MACOSX_SDK_FILE_SHA256 != $MACOSX_SDK_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $MACOSX_SDK_FILE - expected $MACOSX_SDK_SHA256, got $MACOSX_SDK_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd /usr/local/cross-freebsd-x86_64
|
||||
|
||||
FREEBSD_X86_64_FILE_SHA256="$(sha256sum $FREEBSD_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $FREEBSD_X86_64_FILE_SHA256 != $FREEBSD_X86_64_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $FREEBSD_FILE - expected $FREEBSD_X86_64_SHA256, got $FREEBSD_X86_64_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd /usr/local/cross-freebsd-aarch64
|
||||
|
||||
FREEBSD_AARCH64_FILE_SHA256="$(sha256sum $FREEBSD_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $FREEBSD_AARCH64_FILE_SHA256 != $FREEBSD_AARCH64_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $FREEBSD_FILE - expected $FREEBSD_AARCH64_SHA256, got $FREEBSD_AARCH64_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd /root
|
||||
|
||||
TAR_FILE_SHA256="$(sha256sum $TAR_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $TAR_FILE_SHA256 != $TAR_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $TAR_FILE - expected $TAR_SHA256, got $TAR_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Cloning repositories"
|
||||
|
||||
cd /root
|
||||
|
||||
git clone --depth 1 --branch releases/gcc-$GCC_VERSION git://gcc.gnu.org/git/gcc.git
|
||||
git clone --depth 1 --branch binutils-$BINUTILS_VERSION git://sourceware.org/git/binutils-gdb.git
|
||||
git clone --depth 1 --branch llvmorg-$CLANG_VERSION https://github.com/llvm/llvm-project.git
|
||||
git clone --depth=1 --branch v$MINGW_VERSION https://git.code.sf.net/p/mingw-w64/mingw-w64 mingw-w64-v$MINGW_VERSION
|
||||
git clone --branch 2.0-llvm-based https://github.com/tpoechtrager/osxcross
|
||||
git clone --depth=1 --branch v$XZ_VERSION https://github.com/tukaani-project/xz
|
||||
|
||||
mv /root/$MACOSX_SDK_FILE osxcross/tarballs
|
||||
|
||||
echo "Install make"
|
||||
|
||||
cd /root
|
||||
|
||||
tar xvf $MAKE_FILE
|
||||
cd $MAKE_NAME
|
||||
CFLAGS='-O2' ./configure --disable-dependency-tracking
|
||||
./build.sh
|
||||
./make install
|
||||
|
||||
echo "Install 7-zip"
|
||||
|
||||
cd /root
|
||||
|
||||
tar xf $_7ZIP_FILE
|
||||
cp -f 7zz /usr/local/bin/7z
|
||||
|
||||
@@ -56,7 +183,6 @@ echo "Install GCC"
|
||||
|
||||
cd /root
|
||||
|
||||
git clone --depth 1 --branch releases/gcc-$GCC_VERSION git://gcc.gnu.org/git/gcc.git
|
||||
rm -rf gcc/.git
|
||||
|
||||
cd gcc
|
||||
@@ -83,7 +209,6 @@ echo "Install binutils"
|
||||
|
||||
cd /root
|
||||
|
||||
git clone --depth 1 --branch binutils-$BINUTILS_VERSION git://sourceware.org/git/binutils-gdb.git
|
||||
rm -rf binutils-gdb/.git
|
||||
|
||||
cp -r binutils-gdb binutils-gdb-aarch64
|
||||
@@ -100,53 +225,20 @@ echo "Install cmake"
|
||||
|
||||
cd /root
|
||||
|
||||
CMAKE_NAME=cmake-$CMAKE_VERSION-linux-x86_64
|
||||
CMAKE_FILE=$CMAKE_NAME.tar.gz
|
||||
|
||||
curl -L -O https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/$CMAKE_FILE
|
||||
|
||||
CMAKE_FILE_SHA256="$(sha256sum $CMAKE_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $CMAKE_FILE_SHA256 != $CMAKE_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $CMAKE_FILE - expected $CMAKE_SHA256, got $CMAKE_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tar xvf $CMAKE_FILE
|
||||
cp $CMAKE_NAME/bin/* /usr/local/bin
|
||||
cp -r $CMAKE_NAME/share/cmake-4.1 /usr/local/share
|
||||
|
||||
echo "Install make"
|
||||
|
||||
cd /root
|
||||
|
||||
MAKE_NAME=make-$MAKE_VERSION
|
||||
MAKE_FILE=$MAKE_NAME.tar.gz
|
||||
|
||||
curl -L -O https://ftpmirror.gnu.org/make/$MAKE_FILE
|
||||
|
||||
MAKE_FILE_SHA256="$(sha256sum $MAKE_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $MAKE_FILE_SHA256 != $MAKE_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $MAKE_FILE - expected $MAKE_SHA256, got $MAKE_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tar xvf $MAKE_FILE
|
||||
cd $MAKE_NAME
|
||||
CFLAGS='-O2' ./configure
|
||||
make
|
||||
cp -f make /usr/bin
|
||||
cp -r $CMAKE_NAME/share/cmake-4.3 /usr/local/share
|
||||
|
||||
echo "Install clang"
|
||||
|
||||
cd /root
|
||||
|
||||
git clone --depth 1 --branch llvmorg-$CLANG_VERSION https://github.com/llvm/llvm-project.git
|
||||
|
||||
cd llvm-project
|
||||
mv /clang_version.patch .
|
||||
git apply --verbose --ignore-whitespace clang_version.patch
|
||||
|
||||
mkdir build && cd build
|
||||
cmake -G Ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_ENABLE_PROJECTS="clang;lld;libc" -DCMAKE_BUILD_TYPE=Release -DLLVM_VERSION_SUFFIX="_p2pool" ../llvm
|
||||
cmake -G Ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_ENABLE_PROJECTS="clang;lld;libc" -DCMAKE_BUILD_TYPE=Release -DLLVM_VERSION_SUFFIX="_p2pool" -DLIBC_WNO_ERROR=ON -DLLVM_APPEND_VC_REV=OFF ../llvm
|
||||
ninja
|
||||
ninja install
|
||||
|
||||
@@ -168,17 +260,6 @@ echo "Install Linux headers for aarch64-linux-gnu"
|
||||
|
||||
cd /root
|
||||
|
||||
HEADERS_FILE=linux-$LINUX_HEADERS_VERSION.tar.xz
|
||||
|
||||
curl -L -O https://www.kernel.org/pub/linux/kernel/v6.x/$HEADERS_FILE
|
||||
|
||||
HEADERS_FILE_SHA256="$(sha256sum $HEADERS_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $HEADERS_FILE_SHA256 != $HEADERS_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $HEADERS_FILE - expected $HEADERS_SHA256, got $HEADERS_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tar xf linux-$LINUX_HEADERS_VERSION.tar.xz
|
||||
cd linux-$LINUX_HEADERS_VERSION
|
||||
make ARCH=arm64 INSTALL_HDR_PATH=/usr/local/aarch64-linux-gnu headers_install
|
||||
@@ -196,17 +277,6 @@ echo "Install glibc for aarch64-linux-gnu"
|
||||
|
||||
cd /root
|
||||
|
||||
GLIBC_FILE=glibc-$GLIBC_VERSION.tar.xz
|
||||
|
||||
curl -L -O https://ftpmirror.gnu.org/glibc/$GLIBC_FILE
|
||||
|
||||
GLIBC_FILE_SHA256="$(sha256sum $GLIBC_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $GLIBC_FILE_SHA256 != $GLIBC_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $GLIBC_FILE - expected $GLIBC_SHA256, got $GLIBC_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tar xf $GLIBC_FILE
|
||||
|
||||
mkdir glibc_build_aarch64 && cd glibc_build_aarch64
|
||||
@@ -299,7 +369,6 @@ echo "Install mingw-w64 headers"
|
||||
|
||||
cd /root
|
||||
|
||||
git clone --depth=1 --branch v$MINGW_VERSION https://git.code.sf.net/p/mingw-w64/mingw-w64 mingw-w64-v$MINGW_VERSION
|
||||
rm -rf mingw-w64-v$MINGW_VERSION/.git
|
||||
|
||||
cd mingw-w64-v$MINGW_VERSION/mingw-w64-headers
|
||||
@@ -350,66 +419,24 @@ gcc -nostdlib -nostartfiles -shared -x c /dev/null -o /usr/local/x86_64-pc-linux
|
||||
make -j$(nproc)
|
||||
make install
|
||||
|
||||
echo "Get osxcross"
|
||||
|
||||
cd /root
|
||||
|
||||
git clone --branch 2.0-llvm-based https://github.com/tpoechtrager/osxcross
|
||||
cd osxcross
|
||||
git checkout cb444e230e815c06202bef1c30eca5d353235a05
|
||||
|
||||
echo "Get MacOSX $MACOSX_SDK_VERSION SDK"
|
||||
|
||||
cd /root/osxcross/tarballs
|
||||
|
||||
MACOSX_SDK_FILE=MacOSX$MACOSX_SDK_VERSION.sdk.tar.xz
|
||||
|
||||
curl -L -O https://github.com/joseluisq/macosx-sdks/releases/download/$MACOSX_SDK_VERSION/$MACOSX_SDK_FILE
|
||||
|
||||
MACOSX_SDK_FILE_SHA256="$(sha256sum $MACOSX_SDK_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $MACOSX_SDK_FILE_SHA256 != $MACOSX_SDK_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $MACOSX_SDK_FILE - expected $MACOSX_SDK_SHA256, got $MACOSX_SDK_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Build MacOSX cross compilers"
|
||||
|
||||
cd /root/osxcross
|
||||
git checkout ${OSXCROSS_VERSION}
|
||||
|
||||
TARGET_DIR=/usr/local OSX_VERSION_MIN=10.15 UNATTENDED=1 ./build.sh
|
||||
./build_compiler_rt.sh
|
||||
|
||||
echo "Install FreeBSD $FREEBSD_VERSION SDK"
|
||||
|
||||
cd /usr/local
|
||||
|
||||
FREEBSD_FILE=base.txz
|
||||
|
||||
mkdir cross-freebsd-x86_64 && mkdir cross-freebsd-aarch64
|
||||
curl -L -Z -o cross-freebsd-x86_64/$FREEBSD_FILE -o cross-freebsd-aarch64/$FREEBSD_FILE https://archive.freebsd.org/old-releases/amd64/$FREEBSD_VERSION-RELEASE/$FREEBSD_FILE https://archive.freebsd.org/old-releases/arm64/$FREEBSD_VERSION-RELEASE/$FREEBSD_FILE
|
||||
|
||||
cd /usr/local/cross-freebsd-x86_64
|
||||
|
||||
FREEBSD_X86_64_FILE_SHA256="$(sha256sum $FREEBSD_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $FREEBSD_X86_64_FILE_SHA256 != $FREEBSD_X86_64_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $FREEBSD_FILE - expected $FREEBSD_X86_64_SHA256, got $FREEBSD_X86_64_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tar -xf $FREEBSD_FILE ./lib/ ./usr/lib/ ./usr/include/
|
||||
rm $FREEBSD_FILE
|
||||
#find /usr/local/cross-freebsd-x86_64/usr/lib -xtype l|xargs ls -l|grep ' /lib/'|awk '{print "ln -sf /usr/local/cross-freebsd-x86_64"$11 " " $9}'|/bin/sh
|
||||
|
||||
cd /usr/local/cross-freebsd-aarch64
|
||||
|
||||
FREEBSD_AARCH64_FILE_SHA256="$(sha256sum $FREEBSD_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $FREEBSD_AARCH64_FILE_SHA256 != $FREEBSD_AARCH64_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $FREEBSD_FILE - expected $FREEBSD_AARCH64_SHA256, got $FREEBSD_AARCH64_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tar -xf $FREEBSD_FILE ./lib/ ./usr/lib/ ./usr/include/
|
||||
rm $FREEBSD_FILE
|
||||
#find /usr/local/cross-freebsd-aarch64/usr/lib -xtype l|xargs ls -l|grep ' /lib/'|awk '{print "ln -sf /usr/local/cross-freebsd-aarch64"$11 " " $9}'|/bin/sh
|
||||
@@ -420,7 +447,6 @@ apt-get remove -yq xz-utils
|
||||
|
||||
cd /root
|
||||
|
||||
git clone --depth=1 --branch v$XZ_VERSION https://github.com/tukaani-project/xz
|
||||
cd xz
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang
|
||||
@@ -433,17 +459,6 @@ echo "Install tar"
|
||||
|
||||
cd /root
|
||||
|
||||
TAR_FILE=tar-$TAR_VERSION.tar.xz
|
||||
|
||||
curl -L -O https://ftpmirror.gnu.org/tar/$TAR_FILE
|
||||
|
||||
TAR_FILE_SHA256="$(sha256sum $TAR_FILE | awk '{ print $1 }')"
|
||||
|
||||
if [ $TAR_FILE_SHA256 != $TAR_SHA256 ]; then
|
||||
echo "Error: SHA256 sum does not match for $TAR_FILE - expected $TAR_SHA256, got $TAR_FILE_SHA256"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tar xvf $TAR_FILE
|
||||
cd tar-$TAR_VERSION
|
||||
FORCE_UNSAFE_CONFIGURE=1 ./configure
|
||||
@@ -462,9 +477,4 @@ echo "Deleting temporary files"
|
||||
cd /root
|
||||
rm -rf *
|
||||
|
||||
echo "Cloning the repository"
|
||||
|
||||
cd /
|
||||
git clone --recursive --jobs $(nproc) https://github.com/SChernykh/p2pool
|
||||
|
||||
echo "All done"
|
||||
|
||||
@@ -20,9 +20,8 @@ flags_libs="--target=aarch64-linux-gnu -Os -flto -fuse-ld=lld -w $flags_size $fl
|
||||
flags_p2pool="--target=aarch64-linux-gnu -fuse-ld=lld -Wno-unused-command-line-argument $flags_size $flags_datetime"
|
||||
|
||||
cd /p2pool/external/src/curl
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
make -j$(nproc)
|
||||
cd lib && cp -f libcurl.a .libs
|
||||
|
||||
cd /p2pool/external/src/libuv
|
||||
rm -rf build
|
||||
@@ -38,7 +37,7 @@ make -j$(nproc)
|
||||
|
||||
cd /p2pool
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_TOOLCHAIN_FILE=../cmake/aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool" -DOPENSSL_NO_ASM=ON -DSTATIC_BINARY=ON -DARCH_ID=aarch64
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_TOOLCHAIN_FILE=../cmake/aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool" -DOPENSSL_NO_ASM=ON -DSTATIC_BINARY=ON -DARCH_ID=aarch64 -DGIT_COMMIT="$(git rev-parse --short=7 HEAD)"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
mkdir $1
|
||||
@@ -53,4 +52,4 @@ chmod 0775 $1/p2pool
|
||||
|
||||
tar cvf $1.tar --format=pax --pax-option='exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime' --sort=name --owner=0 --group=0 --mtime="$CURRENT_DATE $CURRENT_TIME" $1
|
||||
touch -t $TOUCH_DATE $1.tar
|
||||
7z a -tgzip -mx9 -mfb256 -stl $1.tar.gz $1.tar
|
||||
7z a -tgzip -mx9 -mfb256 -mpass15 -stl $1.tar.gz $1.tar
|
||||
|
||||
@@ -20,9 +20,8 @@ flags_libs="--target=riscv64-linux-gnu -Os -flto -fuse-ld=lld -w $flags_size $fl
|
||||
flags_p2pool="--target=riscv64-linux-gnu -fuse-ld=lld -Wno-unused-command-line-argument $flags_size $flags_datetime"
|
||||
|
||||
cd /p2pool/external/src/curl
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/riscv64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/riscv64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
make -j$(nproc)
|
||||
cd lib && cp -f libcurl.a .libs
|
||||
|
||||
cd /p2pool/external/src/libuv
|
||||
rm -rf build
|
||||
@@ -38,7 +37,7 @@ make -j$(nproc)
|
||||
|
||||
cd /p2pool
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_TOOLCHAIN_FILE=../cmake/riscv64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool" -DOPENSSL_NO_ASM=ON -DSTATIC_BINARY=ON -DARCH_ID=riscv64
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_TOOLCHAIN_FILE=../cmake/riscv64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool" -DOPENSSL_NO_ASM=ON -DSTATIC_BINARY=ON -DARCH_ID=riscv64 -DGIT_COMMIT="$(git rev-parse --short=7 HEAD)"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
mkdir $1
|
||||
@@ -53,4 +52,4 @@ chmod 0775 $1/p2pool
|
||||
|
||||
tar cvf $1.tar --format=pax --pax-option='exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime' --sort=name --owner=0 --group=0 --mtime="$CURRENT_DATE $CURRENT_TIME" $1
|
||||
touch -t $TOUCH_DATE $1.tar
|
||||
7z a -tgzip -mx9 -mfb256 -stl $1.tar.gz $1.tar
|
||||
7z a -tgzip -mx9 -mfb256 -mpass15 -stl $1.tar.gz $1.tar
|
||||
|
||||
@@ -20,9 +20,8 @@ flags_libs="-Os -flto -fuse-ld=lld -w $flags_size $flags_datetime"
|
||||
flags_p2pool="-fuse-ld=lld -Wno-unused-command-line-argument $flags_size $flags_datetime"
|
||||
|
||||
cd /p2pool/external/src/curl
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_C_COMPILER=clang -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_C_COMPILER=clang -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
make -j$(nproc)
|
||||
cd lib && cp -f libcurl.a .libs
|
||||
|
||||
cd /p2pool/external/src/libuv
|
||||
rm -rf build
|
||||
@@ -38,7 +37,7 @@ make -j$(nproc)
|
||||
|
||||
cd /p2pool
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool" -DSTATIC_BINARY=ON -DARCH_ID=x86_64
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool" -DOPENSSL_NO_ASM=ON -DSTATIC_BINARY=ON -DARCH_ID=x86_64 -DGIT_COMMIT="$(git rev-parse --short=7 HEAD)"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
mkdir $1
|
||||
@@ -53,4 +52,4 @@ chmod 0775 $1/p2pool
|
||||
|
||||
tar cvf $1.tar --format=pax --pax-option='exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime' --sort=name --owner=0 --group=0 --mtime="$CURRENT_DATE $CURRENT_TIME" $1
|
||||
touch -t $TOUCH_DATE $1.tar
|
||||
7z a -tgzip -mx9 -mfb256 -stl $1.tar.gz $1.tar
|
||||
7z a -tgzip -mx9 -mfb256 -mpass15 -stl $1.tar.gz $1.tar
|
||||
|
||||
@@ -20,9 +20,8 @@ flags_libs="-Os -flto -w $flags_size $flags_datetime"
|
||||
flags_p2pool="$flags_size $flags_datetime"
|
||||
|
||||
cd /p2pool/external/src/curl
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/macos_aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/macos_aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
make -j$(nproc)
|
||||
cd lib && cp -f libcurl.a .libs
|
||||
|
||||
cd /p2pool/external/src/libuv
|
||||
rm -rf build
|
||||
@@ -38,7 +37,7 @@ make -j$(nproc)
|
||||
|
||||
cd /p2pool
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_TOOLCHAIN_FILE=../cmake/macos_aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool" -DOPENSSL_NO_ASM=ON -DSTATIC_LIBS=ON -DARCH_ID=aarch64
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_TOOLCHAIN_FILE=../cmake/macos_aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool" -DOPENSSL_NO_ASM=ON -DSTATIC_LIBS=ON -DARCH_ID=aarch64 -DGIT_COMMIT="$(git rev-parse --short=7 HEAD)"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
mkdir $1
|
||||
@@ -53,4 +52,4 @@ chmod 0775 $1/p2pool
|
||||
|
||||
tar cvf $1.tar --format=pax --pax-option='exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime' --sort=name --owner=0 --group=0 --mtime="$CURRENT_DATE $CURRENT_TIME" $1
|
||||
touch -t $TOUCH_DATE $1.tar
|
||||
7z a -tgzip -mx9 -mfb256 -stl $1.tar.gz $1.tar
|
||||
7z a -tgzip -mx9 -mfb256 -mpass15 -stl $1.tar.gz $1.tar
|
||||
|
||||
@@ -20,9 +20,8 @@ flags_libs="-Os -flto -w $flags_size $flags_datetime"
|
||||
flags_p2pool="$flags_size $flags_datetime"
|
||||
|
||||
cd /p2pool/external/src/curl
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/macos_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/macos_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
make -j$(nproc)
|
||||
cd lib && cp -f libcurl.a .libs
|
||||
|
||||
cd /p2pool/external/src/libuv
|
||||
rm -rf build
|
||||
@@ -38,7 +37,7 @@ make -j$(nproc)
|
||||
|
||||
cd /p2pool
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_TOOLCHAIN_FILE=../cmake/macos_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool" -DOPENSSL_NO_ASM=ON -DSTATIC_LIBS=ON -DARCH_ID=x86_64
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_TOOLCHAIN_FILE=../cmake/macos_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool" -DOPENSSL_NO_ASM=ON -DSTATIC_LIBS=ON -DARCH_ID=x86_64 -DGIT_COMMIT="$(git rev-parse --short=7 HEAD)"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
mkdir $1
|
||||
@@ -53,4 +52,4 @@ chmod 0775 $1/p2pool
|
||||
|
||||
tar cvf $1.tar --format=pax --pax-option='exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime' --sort=name --owner=0 --group=0 --mtime="$CURRENT_DATE $CURRENT_TIME" $1
|
||||
touch -t $TOUCH_DATE $1.tar
|
||||
7z a -tgzip -mx9 -mfb256 -stl $1.tar.gz $1.tar
|
||||
7z a -tgzip -mx9 -mfb256 -mpass15 -stl $1.tar.gz $1.tar
|
||||
|
||||
@@ -25,9 +25,8 @@ cd /p2pool
|
||||
git apply --verbose --ignore-whitespace --directory=external/src/grpc/third_party/boringssl-with-bazel patches/boringssl/win7.patch
|
||||
|
||||
cd /p2pool/external/src/curl
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/windows_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/windows_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -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 -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
|
||||
make -j$(nproc)
|
||||
cd lib && cp -f libcurl.a .libs
|
||||
|
||||
cd /p2pool/external/src/libuv
|
||||
rm -rf build
|
||||
@@ -43,7 +42,7 @@ make -j$(nproc)
|
||||
|
||||
cd /p2pool
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_TOOLCHAIN_FILE=../cmake/windows_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool $flags_cxx_headers" -DOPENSSL_NO_ASM=ON -DSTATIC_BINARY=ON -DARCH_ID=x86_64
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5" -DCMAKE_TOOLCHAIN_FILE=../cmake/windows_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_p2pool" -DCMAKE_CXX_FLAGS="$flags_p2pool $flags_cxx_headers" -DOPENSSL_NO_ASM=ON -DSTATIC_BINARY=ON -DARCH_ID=x86_64 -DGIT_COMMIT="$(git rev-parse --short=7 HEAD)"
|
||||
make -j$(nproc) p2pool
|
||||
|
||||
mkdir $1
|
||||
@@ -58,4 +57,4 @@ chmod 0775 $1/p2pool.exe
|
||||
|
||||
touch -t $TOUCH_DATE $1
|
||||
touch -t $TOUCH_DATE $1/*
|
||||
7z a -tzip -mx9 -mfb256 -stl $1.zip $1
|
||||
7z a -tzip -mx9 -mfb256 -mpass15 -stl $1.zip $1
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
grep 'ERROR ' p2pool.log | grep -E -v 'submit_block|failed to bind|ZMQ is not running|block header for seed|ZMQReader|ZMQ reader|uv_poll_start returned error EBADF' > errors.log
|
||||
|
||||
if [ -s errors.log ]; then
|
||||
cat errors.log
|
||||
exit 1
|
||||
fi
|
||||
@@ -4,6 +4,9 @@
|
||||
//
|
||||
// Fixed difficulty for miners that connect to your node must be set in their config.json
|
||||
//
|
||||
// Note: nano sidechain uses
|
||||
// "block_time": 30
|
||||
// "uncle_penalty": 10
|
||||
{
|
||||
"name": "default",
|
||||
"password": "",
|
||||
|
||||
+12
-11
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "pool_block.h"
|
||||
#include "p2p_server.h"
|
||||
#include "side_chain.h"
|
||||
#include "params.h"
|
||||
|
||||
LOG_CATEGORY(BlockCache)
|
||||
|
||||
@@ -34,9 +35,9 @@ struct BlockCache::Impl : public nocopy_nomove
|
||||
{
|
||||
#if defined(__linux__) || defined(__unix__) || defined(_POSIX_VERSION) || defined(__MACH__)
|
||||
|
||||
Impl()
|
||||
explicit Impl(const Params& params)
|
||||
{
|
||||
const std::string cache_path = DATA_DIR + cache_name;
|
||||
const std::string cache_path = params.m_dataDir + cache_name;
|
||||
|
||||
m_fd = open(cache_path.c_str(), O_RDWR | O_CREAT, static_cast<mode_t>(0600));
|
||||
if (m_fd == -1) {
|
||||
@@ -44,16 +45,16 @@ struct BlockCache::Impl : public nocopy_nomove
|
||||
return;
|
||||
}
|
||||
|
||||
int result = lseek(m_fd, static_cast<off_t>(CACHE_SIZE) - 1, SEEK_SET);
|
||||
if (result == -1) {
|
||||
auto result1 = lseek(m_fd, static_cast<off_t>(CACHE_SIZE) - 1, SEEK_SET);
|
||||
if (result1 == -1) {
|
||||
LOGERR(1, "lseek failed");
|
||||
close(m_fd);
|
||||
m_fd = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
result = write(m_fd, "", 1);
|
||||
if (result != 1) {
|
||||
auto result2 = write(m_fd, "", 1);
|
||||
if (result2 != 1) {
|
||||
LOGERR(1, "write failed");
|
||||
close(m_fd);
|
||||
m_fd = -1;
|
||||
@@ -88,8 +89,8 @@ struct BlockCache::Impl : public nocopy_nomove
|
||||
|
||||
#elif defined(_WIN32)
|
||||
|
||||
Impl()
|
||||
: m_cachePath(DATA_DIR + cache_name)
|
||||
explicit Impl(const Params& params)
|
||||
: m_cachePath(params.m_dataDir + cache_name)
|
||||
, m_file(CreateFile(m_cachePath.c_str(), GENERIC_ALL, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL))
|
||||
, m_map(0)
|
||||
{
|
||||
@@ -157,8 +158,8 @@ struct BlockCache::Impl : public nocopy_nomove
|
||||
uint8_t* m_data = nullptr;
|
||||
};
|
||||
|
||||
BlockCache::BlockCache()
|
||||
: m_impl(new Impl())
|
||||
BlockCache::BlockCache(const Params& params)
|
||||
: m_impl(new Impl(params))
|
||||
, m_flushRunning(0)
|
||||
, m_storeIndex(0)
|
||||
, m_loadingStarted(0)
|
||||
|
||||
+3
-2
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -22,11 +22,12 @@ namespace p2pool {
|
||||
struct PoolBlock;
|
||||
class SideChain;
|
||||
class P2PServer;
|
||||
struct Params;
|
||||
|
||||
class BlockCache : public nocopy_nomove
|
||||
{
|
||||
public:
|
||||
BlockCache();
|
||||
explicit BlockCache(const Params& params);
|
||||
~BlockCache();
|
||||
|
||||
void store(const PoolBlock& block);
|
||||
|
||||
+93
-34
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
* Portions Copyright (c) 2012-2013 The Cryptonote developers
|
||||
* Portions Copyright (c) 2014-2021 The Monero Project
|
||||
* Portions Copyright (c) 2021 XMRig <https://github.com/xmrig>
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "p2pool.h"
|
||||
#include "side_chain.h"
|
||||
#include "pool_block.h"
|
||||
#include "params.h"
|
||||
#include "merkle.h"
|
||||
#include <zmq.hpp>
|
||||
#include <ctime>
|
||||
@@ -205,7 +204,7 @@ void BlockTemplate::shuffle_tx_order()
|
||||
}
|
||||
}
|
||||
|
||||
void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const Wallet* miner_wallet)
|
||||
void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const Params& params)
|
||||
{
|
||||
if (data.major_version > HARDFORK_SUPPORTED_VERSION) {
|
||||
LOGERR(1, "got hardfork version " << data.major_version << ", expected <= " << HARDFORK_SUPPORTED_VERSION);
|
||||
@@ -214,7 +213,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||
|
||||
// Block template construction is relatively slow, but it's better to keep the lock the whole time
|
||||
// instead of using temporary variables and making a quick swap in the end
|
||||
//
|
||||
//
|
||||
// All readers will line up for the new template instead of using the outdated template
|
||||
WriteLock lock(m_lock);
|
||||
|
||||
@@ -270,9 +269,12 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||
|
||||
m_blockHeaderSize = m_blockHeader.size();
|
||||
|
||||
m_poolBlockTemplate->m_minerWallet = *miner_wallet;
|
||||
m_poolBlockTemplate->m_minerWallet = params.m_miningWallet;
|
||||
|
||||
m_sidechain->fill_sidechain_data(*m_poolBlockTemplate, m_shares);
|
||||
if (!m_sidechain->fill_sidechain_data(*m_poolBlockTemplate, m_shares)) {
|
||||
use_old_template();
|
||||
return;
|
||||
}
|
||||
|
||||
// Pre-calculate outputs to speed up miner tx generation
|
||||
if (!m_shares.empty()) {
|
||||
@@ -393,7 +395,8 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||
LOGERR(1, "Added transaction " << tx.id << " twice. Fix the code!");
|
||||
continue;
|
||||
}
|
||||
m_transactionHashes.insert(m_transactionHashes.end(), tx.id.h, tx.id.h + HASH_SIZE);
|
||||
const hash h = tx.id;
|
||||
m_transactionHashes.insert(m_transactionHashes.end(), h.h, h.h + HASH_SIZE);
|
||||
final_fees += tx.fee;
|
||||
final_weight += tx.weight;
|
||||
}
|
||||
@@ -474,7 +477,8 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||
LOGERR(1, "Added transaction " << tx.id << " twice. Fix the code!");
|
||||
continue;
|
||||
}
|
||||
m_transactionHashes.insert(m_transactionHashes.end(), tx.id.h, tx.id.h + HASH_SIZE);
|
||||
const hash h = tx.id;
|
||||
m_transactionHashes.insert(m_transactionHashes.end(), h.h, h.h + HASH_SIZE);
|
||||
final_fees += tx.fee;
|
||||
final_weight += tx.weight;
|
||||
}
|
||||
@@ -591,7 +595,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||
m_poolBlockTemplate->m_transactions.push_back(m_mempoolTxs[m_mempoolTxsOrder[i]].id);
|
||||
}
|
||||
|
||||
m_poolBlockTemplate->m_minerWallet = *miner_wallet;
|
||||
m_poolBlockTemplate->m_minerWallet = params.m_miningWallet;
|
||||
|
||||
// Layout: [software id, version, random number, sidechain extra_nonce]
|
||||
uint32_t* sidechain_extra = m_poolBlockTemplate->m_sidechainExtraBuf;
|
||||
@@ -613,7 +617,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||
m_poolBlockTemplate->m_auxNonce = data.aux_nonce;
|
||||
|
||||
m_poolBlockTemplate->m_mergeMiningExtra.clear();
|
||||
|
||||
|
||||
for (const AuxChainData& c : data.aux_chains) {
|
||||
std::vector<uint8_t> v;
|
||||
v.reserve(HASH_SIZE + 16);
|
||||
@@ -626,6 +630,27 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||
m_poolBlockTemplate->m_mergeMiningExtra.emplace(c.unique_id, std::move(v));
|
||||
}
|
||||
|
||||
if (params.m_subaddress.valid()) {
|
||||
uint8_t buf[HASH_SIZE + 2] = {};
|
||||
memcpy(buf, params.m_subaddress.view_public_key().h, HASH_SIZE);
|
||||
|
||||
m_poolBlockTemplate->m_mergeMiningExtra.emplace(keccak_subaddress_viewpub, std::vector(buf, buf + sizeof(buf)));
|
||||
}
|
||||
|
||||
if (!params.m_onionPubkey.empty()) {
|
||||
uint8_t buf[HASH_SIZE + 2] = {};
|
||||
memcpy(buf, params.m_onionPubkey.h, HASH_SIZE);
|
||||
|
||||
m_poolBlockTemplate->m_mergeMiningExtra.emplace(keccak_onion_address_v3, std::vector(buf, buf + sizeof(buf)));
|
||||
}
|
||||
|
||||
if (!params.m_i2pDestinationHash.empty()) {
|
||||
uint8_t buf[HASH_SIZE + 2] = {};
|
||||
memcpy(buf, params.m_i2pDestinationHash.h, HASH_SIZE);
|
||||
|
||||
m_poolBlockTemplate->m_mergeMiningExtra.emplace(keccak_i2p_b32_address, std::vector(buf, buf + sizeof(buf)));
|
||||
}
|
||||
|
||||
init_merge_mining_merkle_proof();
|
||||
|
||||
const std::vector<uint8_t> sidechain_data = m_poolBlockTemplate->serialize_sidechain_data();
|
||||
@@ -714,7 +739,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||
|
||||
LOGINFO(3, "final reward = " << log::Gray() << log::XMRAmount(final_reward) << log::NoColor() <<
|
||||
", weight = " << log::Gray() << final_weight << log::NoColor() <<
|
||||
", outputs = " << log::Gray() << m_poolBlockTemplate->m_outputs.size() << log::NoColor() <<
|
||||
", outputs = " << log::Gray() << m_poolBlockTemplate->m_outputAmounts.size() << log::NoColor() <<
|
||||
", " << log::Gray() << m_numTransactionHashes << log::NoColor() <<
|
||||
" of " << log::Gray() << m_mempoolTxs.size() << log::NoColor() << " transactions included");
|
||||
|
||||
@@ -734,7 +759,7 @@ void BlockTemplate::fill_optimal_knapsack(const MinerData& data, uint64_t base_r
|
||||
{
|
||||
// Find the maximum possible fee for every weight value and remember which tx leads to this fee/weight
|
||||
// Run time is O(N*W) where N is the number of transactions and W is the maximum block weight
|
||||
//
|
||||
//
|
||||
// Actual run time is 0.02-0.05 seconds on real full blocks
|
||||
// It's too slow and uses too much memory to be practical
|
||||
|
||||
@@ -833,7 +858,8 @@ void BlockTemplate::select_mempool_transactions(const Mempool& mempool)
|
||||
PoolBlock* b = m_poolBlockTemplate;
|
||||
b->m_transactions.clear();
|
||||
b->m_transactions.resize(1);
|
||||
b->m_outputs.clear();
|
||||
b->m_ephPublicKeys.clear();
|
||||
b->m_outputAmounts.clear();
|
||||
|
||||
// Block template size without coinbase outputs and transactions (minus 2 bytes for output and tx count dummy varints)
|
||||
size_t k = b->serialize_mainchain_data().size() + b->serialize_sidechain_data().size() - 2;
|
||||
@@ -854,7 +880,7 @@ void BlockTemplate::select_mempool_transactions(const Mempool& mempool)
|
||||
k += r / 34359738368ULL;
|
||||
}
|
||||
|
||||
const size_t max_transactions = (MAX_BLOCK_SIZE > k) ? ((MAX_BLOCK_SIZE - k) / HASH_SIZE) : 0;
|
||||
const uint32_t max_transactions = static_cast<uint32_t>((MAX_BLOCK_SIZE > k) ? ((MAX_BLOCK_SIZE - k) / HASH_SIZE) : 0);
|
||||
LOGINFO(6, max_transactions << " transactions can be taken with current block size limit");
|
||||
|
||||
if (max_transactions == 0) {
|
||||
@@ -895,10 +921,11 @@ int BlockTemplate::create_miner_tx(const MinerData& data, const std::vector<Mine
|
||||
// Number of outputs (1 output per miner)
|
||||
writeVarint(num_outputs, m_minerTx);
|
||||
|
||||
m_poolBlockTemplate->m_outputs.clear();
|
||||
m_poolBlockTemplate->m_outputs.reserve(num_outputs);
|
||||
m_poolBlockTemplate->m_ephPublicKeys.clear();
|
||||
m_poolBlockTemplate->m_outputAmounts.clear();
|
||||
|
||||
const uint8_t tx_type = m_poolBlockTemplate->get_tx_type();
|
||||
m_poolBlockTemplate->m_ephPublicKeys.reserve(num_outputs);
|
||||
m_poolBlockTemplate->m_outputAmounts.reserve(num_outputs);
|
||||
|
||||
uint64_t reward_amounts_weight = 0;
|
||||
for (size_t i = 0; i < num_outputs; ++i) {
|
||||
@@ -907,7 +934,7 @@ int BlockTemplate::create_miner_tx(const MinerData& data, const std::vector<Mine
|
||||
m_minerTx.push_back(b);
|
||||
++reward_amounts_weight;
|
||||
});
|
||||
m_minerTx.push_back(tx_type);
|
||||
m_minerTx.push_back(TXOUT_TO_TAGGED_KEY);
|
||||
|
||||
uint8_t view_tag = 0;
|
||||
|
||||
@@ -920,12 +947,11 @@ int BlockTemplate::create_miner_tx(const MinerData& data, const std::vector<Mine
|
||||
LOGERR(1, "get_eph_public_key failed at index " << i);
|
||||
}
|
||||
m_minerTx.insert(m_minerTx.end(), eph_public_key.h, eph_public_key.h + HASH_SIZE);
|
||||
m_poolBlockTemplate->m_outputs.emplace_back(m_rewards[i], eph_public_key, view_tag);
|
||||
m_poolBlockTemplate->m_ephPublicKeys.emplace_back(eph_public_key);
|
||||
m_poolBlockTemplate->m_outputAmounts.emplace_back(m_rewards[i], view_tag);
|
||||
}
|
||||
|
||||
if (tx_type == TXOUT_TO_TAGGED_KEY) {
|
||||
m_minerTx.emplace_back(view_tag);
|
||||
}
|
||||
m_minerTx.emplace_back(view_tag);
|
||||
}
|
||||
|
||||
if (dry_run) {
|
||||
@@ -956,7 +982,7 @@ int BlockTemplate::create_miner_tx(const MinerData& data, const std::vector<Mine
|
||||
LOGINFO(4, "increased EXTRA_NONCE from " << EXTRA_NONCE_SIZE << " to " << corrected_extra_nonce_size << " bytes to maintain miner tx weight");
|
||||
}
|
||||
writeVarint(corrected_extra_nonce_size, m_minerTxExtra);
|
||||
|
||||
|
||||
uint64_t extraNonceOffsetInMinerTx = m_minerTxExtra.size();
|
||||
m_minerTxExtra.insert(m_minerTxExtra.end(), corrected_extra_nonce_size, 0);
|
||||
|
||||
@@ -1349,11 +1375,11 @@ bool BlockTemplate::get_aux_proof(const uint32_t template_id, uint32_t extra_non
|
||||
return false;
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
|
||||
const hash sidechain_id = calc_sidechain_hash(extra_nonce);
|
||||
const uint32_t n_aux_chains = static_cast<uint32_t>(m_poolBlockTemplate->m_auxChains.size() + 1);
|
||||
|
||||
uint32_t found_aux_slot = n_aux_chains;
|
||||
|
||||
std::vector<hash> hashes(n_aux_chains);
|
||||
|
||||
for (const AuxChainData& aux_data : m_poolBlockTemplate->m_auxChains) {
|
||||
@@ -1361,7 +1387,7 @@ bool BlockTemplate::get_aux_proof(const uint32_t template_id, uint32_t extra_non
|
||||
hashes[aux_slot] = aux_data.data;
|
||||
|
||||
if (aux_data.data == h) {
|
||||
found = true;
|
||||
found_aux_slot = aux_slot;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1369,17 +1395,31 @@ bool BlockTemplate::get_aux_proof(const uint32_t template_id, uint32_t extra_non
|
||||
hashes[aux_slot] = sidechain_id;
|
||||
|
||||
if (sidechain_id == h) {
|
||||
found = true;
|
||||
found_aux_slot = aux_slot;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
if (found_aux_slot >= n_aux_chains) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::vector<hash>> tree;
|
||||
merkle_hash_full_tree(hashes, tree);
|
||||
root_hash root;
|
||||
const bool result = merkle_hash_with_proof(hashes, found_aux_slot, proof, path, root);
|
||||
|
||||
return get_merkle_proof(tree, h, proof, path);
|
||||
if (pool_block_debug()) {
|
||||
std::vector<std::vector<hash>> tree;
|
||||
merkle_hash_full_tree(hashes, tree);
|
||||
|
||||
std::vector<hash> proof2;
|
||||
uint32_t path2 = 0;
|
||||
|
||||
const bool result2 = get_merkle_proof(tree, h, proof2, path2);
|
||||
|
||||
if ((result2 != result) || (proof2 != proof) || (path2 != path)) {
|
||||
LOGERR(1, "get_aux_proof: merkle_hash_with_proof and get_merkle_proof returned different results. Fix the code!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> BlockTemplate::get_block_template_blob(uint32_t template_id, uint32_t sidechain_extra_nonce, size_t& nonce_offset, size_t& extra_nonce_offset, size_t& merkle_root_offset, hash& merge_mining_root, const BlockTemplate** pThis) const
|
||||
@@ -1519,10 +1559,29 @@ void BlockTemplate::init_merge_mining_merkle_proof()
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::vector<hash>> tree;
|
||||
merkle_hash_full_tree(hashes, tree);
|
||||
root_hash root;
|
||||
uint32_t merkle_proof_path;
|
||||
if (!merkle_hash_with_proof(hashes, aux_slot, m_poolBlockTemplate->m_merkleProof, merkle_proof_path, root)) {
|
||||
LOGERR(1, "init_merge_mining_merkle_proof: merkle_hash_with_proof failed. Fix the code!");
|
||||
return;
|
||||
}
|
||||
|
||||
get_merkle_proof(tree, m_poolBlockTemplate->m_sidechainId, m_poolBlockTemplate->m_merkleProof, m_poolBlockTemplate->m_merkleProofPath);
|
||||
if (pool_block_debug()) {
|
||||
std::vector<std::vector<hash>> tree;
|
||||
merkle_hash_full_tree(hashes, tree);
|
||||
|
||||
std::vector<hash> proof;
|
||||
uint32_t path = 0;
|
||||
|
||||
if (!get_merkle_proof(tree, m_poolBlockTemplate->m_sidechainId, proof, path)) {
|
||||
LOGERR(1, "init_merge_mining_merkle_proof: get_merkle_proof failed. Fix the code!");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((proof != m_poolBlockTemplate->m_merkleProof) || (path != merkle_proof_path)) {
|
||||
LOGERR(1, "init_merge_mining_merkle_proof: merkle_hash_with_proof and get_merkle_proof returned different results. Fix the code!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace p2pool
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -29,6 +29,7 @@ class Mempool;
|
||||
class Wallet;
|
||||
struct PoolBlock;
|
||||
struct MinerShare;
|
||||
struct Params;
|
||||
|
||||
class BlockTemplate
|
||||
{
|
||||
@@ -39,7 +40,7 @@ public:
|
||||
BlockTemplate(const BlockTemplate& b);
|
||||
BlockTemplate& operator=(const BlockTemplate& b);
|
||||
|
||||
void update(const MinerData& data, const Mempool& mempool, const Wallet* miner_wallet);
|
||||
void update(const MinerData& data, const Mempool& mempool, const Params& params);
|
||||
uint64_t last_updated() const { return m_lastUpdated.load(); }
|
||||
|
||||
bool get_difficulties(const uint32_t template_id, uint64_t& height, uint64_t& sidechain_height, difficulty_type& mainchain_difficulty, difficulty_type& aux_diff, difficulty_type& sidechain_difficulty) const;
|
||||
@@ -107,7 +108,11 @@ private:
|
||||
|
||||
PoolBlock* m_poolBlockTemplate;
|
||||
|
||||
#ifdef P2POOL_UNIT_TESTS
|
||||
BlockTemplate* m_oldTemplates[1] = {};
|
||||
#else
|
||||
BlockTemplate* m_oldTemplates[4] = {};
|
||||
#endif
|
||||
|
||||
std::atomic<uint64_t> m_finalReward;
|
||||
|
||||
|
||||
+126
-5
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -117,7 +117,6 @@ extern "C" void __nss_module_disable_loading();
|
||||
namespace p2pool {
|
||||
|
||||
constexpr size_t HASH_SIZE = 32;
|
||||
constexpr uint8_t HARDFORK_VIEW_TAGS_VERSION = 15;
|
||||
constexpr uint8_t HARDFORK_SUPPORTED_VERSION = 16;
|
||||
constexpr uint8_t MINER_REWARD_UNLOCK_TIME = 60;
|
||||
constexpr uint8_t NONCE_SIZE = 4;
|
||||
@@ -125,7 +124,6 @@ constexpr uint8_t EXTRA_NONCE_SIZE = 4;
|
||||
constexpr uint8_t EXTRA_NONCE_MAX_SIZE = EXTRA_NONCE_SIZE + 10;
|
||||
constexpr uint8_t TX_VERSION = 2;
|
||||
constexpr uint8_t TXIN_GEN = 0xFF;
|
||||
constexpr uint8_t TXOUT_TO_KEY = 2;
|
||||
constexpr uint8_t TXOUT_TO_TAGGED_KEY = 3;
|
||||
constexpr uint8_t TX_EXTRA_TAG_PUBKEY = 1;
|
||||
constexpr uint8_t TX_EXTRA_NONCE = 2;
|
||||
@@ -164,7 +162,7 @@ struct alignas(uint64_t) hash
|
||||
{
|
||||
uint8_t h[HASH_SIZE];
|
||||
|
||||
FORCEINLINE hash() : h{} {}
|
||||
FORCEINLINE constexpr hash() : h{} {}
|
||||
|
||||
constexpr hash(std::initializer_list<uint8_t> l) : h{} {
|
||||
auto it = l.begin();
|
||||
@@ -174,6 +172,22 @@ struct alignas(uint64_t) hash
|
||||
}
|
||||
}
|
||||
|
||||
explicit constexpr hash(const char (&s)[HASH_SIZE * 2 + 1]) : h{} {
|
||||
for (size_t i = 0; i < HASH_SIZE * 2; ++i) {
|
||||
char c = s[i];
|
||||
|
||||
if ('0' <= c && c <= '9') {
|
||||
c -= '0';
|
||||
} else if ('a' <= c && c <= 'f') {
|
||||
c = (c - 'a') + 10;
|
||||
} else if ('A' <= c && c <= 'F') {
|
||||
c = (c - 'A') + 10;
|
||||
}
|
||||
|
||||
h[i / 2] = (h[i / 2] << 4) | static_cast<uint8_t>(c);
|
||||
}
|
||||
}
|
||||
|
||||
FORCEINLINE bool operator<(const hash& other) const
|
||||
{
|
||||
const uint64_t* a = u64();
|
||||
@@ -212,6 +226,22 @@ struct alignas(uint64_t) hash
|
||||
FORCEINLINE uint64_t* u64() { return reinterpret_cast<uint64_t*>(h); }
|
||||
FORCEINLINE const uint64_t* u64() const { return reinterpret_cast<const uint64_t*>(h); }
|
||||
|
||||
template<int index>
|
||||
FORCEINLINE constexpr uint64_t u64() const
|
||||
{
|
||||
if constexpr ((index < 0) || (index >= HASH_SIZE / sizeof(uint64_t))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t k = 0;
|
||||
|
||||
for (size_t i = 0; i < sizeof(uint64_t); ++i) {
|
||||
k |= static_cast<uint64_t>(h[index * sizeof(uint64_t) + i]) << (i * sizeof(uint64_t));
|
||||
}
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& s, const hash& d);
|
||||
friend std::istream& operator>>(std::istream& s, hash& d);
|
||||
};
|
||||
@@ -379,6 +409,85 @@ FORCEINLINE difficulty_type operator/(const difficulty_type& a, const T& b)
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef WITH_INDEXED_HASHES
|
||||
struct indexed_hash
|
||||
{
|
||||
enum {
|
||||
BUCKET_BITS = 12,
|
||||
BUCKET_SHIFT = 32 - BUCKET_BITS,
|
||||
};
|
||||
|
||||
static_assert((BUCKET_BITS > 0) && (BUCKET_BITS < 32), "Invalid bucket bit size");
|
||||
|
||||
FORCEINLINE indexed_hash() : m_index(std::numeric_limits<uint32_t>::max()) {}
|
||||
|
||||
explicit indexed_hash(const hash& h);
|
||||
~indexed_hash();
|
||||
|
||||
indexed_hash(const indexed_hash& h);
|
||||
FORCEINLINE indexed_hash(indexed_hash&& h) : m_index(h.m_index) { h.m_index = std::numeric_limits<uint32_t>::max(); }
|
||||
|
||||
indexed_hash& operator=(const indexed_hash& h);
|
||||
indexed_hash& operator=(indexed_hash&& h);
|
||||
|
||||
FORCEINLINE indexed_hash& operator=(const hash& h)
|
||||
{
|
||||
if (*this == h) {
|
||||
return *this;
|
||||
}
|
||||
return operator=(indexed_hash(h));
|
||||
}
|
||||
|
||||
FORCEINLINE bool operator==(const indexed_hash& h) const { return m_index == h.m_index; }
|
||||
|
||||
FORCEINLINE bool operator==(const hash& h) const
|
||||
{
|
||||
const uint32_t i = m_index;
|
||||
|
||||
if (i == std::numeric_limits<uint32_t>::max()) {
|
||||
return h.empty();
|
||||
}
|
||||
|
||||
const uint32_t bucket = i >> BUCKET_SHIFT;
|
||||
|
||||
if (bucket != get_bucket(h)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return is_same(i, bucket, h);
|
||||
}
|
||||
|
||||
FORCEINLINE operator hash() const
|
||||
{
|
||||
const uint32_t i = m_index;
|
||||
|
||||
if (i == std::numeric_limits<uint32_t>::max()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return get(i);
|
||||
}
|
||||
|
||||
FORCEINLINE uint32_t get_bucket() const { return m_index >> BUCKET_SHIFT; }
|
||||
|
||||
static void cleanup_storage();
|
||||
|
||||
static void print_status();
|
||||
|
||||
private:
|
||||
uint32_t m_index;
|
||||
|
||||
static FORCEINLINE uint32_t get_bucket(const hash& h) { return h.u64()[3] >> (64 - BUCKET_BITS); }
|
||||
|
||||
static hash get(uint32_t index);
|
||||
static bool is_same(uint32_t index, uint32_t bucket, const hash& h);
|
||||
};
|
||||
|
||||
static_assert(sizeof(indexed_hash) == 4, "indexed_hash has wrong size");
|
||||
#else
|
||||
typedef hash indexed_hash;
|
||||
#endif
|
||||
|
||||
struct TxMempoolData
|
||||
{
|
||||
FORCEINLINE TxMempoolData() : id(), blob_size(0), weight(0), fee(0), time_received(0) {}
|
||||
@@ -397,10 +506,22 @@ struct TxMempoolData
|
||||
if (weight > tx.weight) return false;
|
||||
|
||||
// If two transactions have exactly the same fee and weight, just order them by id
|
||||
#ifdef WITH_INDEXED_HASHES
|
||||
const uint32_t id_bucket = id.get_bucket();
|
||||
const uint32_t tx_id_bucket = tx.id.get_bucket();
|
||||
|
||||
if (id_bucket < tx_id_bucket) return true;
|
||||
if (id_bucket > tx_id_bucket) return false;
|
||||
|
||||
const hash h1 = id;
|
||||
const hash h2 = tx.id;
|
||||
return h1 < h2;
|
||||
#else
|
||||
return id < tx.id;
|
||||
#endif
|
||||
}
|
||||
|
||||
hash id;
|
||||
indexed_hash id;
|
||||
uint64_t blob_size;
|
||||
uint64_t weight;
|
||||
uint64_t fee;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021 hyc <https://github.com/hyc>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -35,7 +35,7 @@ static constexpr int DEFAULT_BACKLOG = 1;
|
||||
namespace p2pool {
|
||||
|
||||
ConsoleCommands::ConsoleCommands(p2pool* pool)
|
||||
: TCPServer(DEFAULT_BACKLOG, ConsoleClient::allocate, std::string())
|
||||
: TCPServer(DEFAULT_BACKLOG, ConsoleClient::allocate, std::string(), Params::ProxyType::INVALID)
|
||||
, m_pool(pool)
|
||||
, m_tty{}
|
||||
, m_stdin_pipe{}
|
||||
@@ -91,7 +91,7 @@ ConsoleCommands::ConsoleCommands(p2pool* pool)
|
||||
rng.discard(10000);
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
if (start_listening(false, "127.0.0.1", 49152 + (rng() % 16384))) {
|
||||
if (start_listening(false, "127.0.0.1", 49152 + static_cast<int>(rng() % 16384))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -224,6 +224,10 @@ static void do_status(p2pool *m_pool, const char * /* args */)
|
||||
|
||||
m_pool->print_merge_mining_status();
|
||||
|
||||
#ifdef WITH_INDEXED_HASHES
|
||||
indexed_hash::print_status();
|
||||
#endif
|
||||
|
||||
bkg_jobs_tracker->print_status();
|
||||
|
||||
if (p2p) {
|
||||
@@ -293,7 +297,7 @@ static void do_status(p2pool *m_pool, const char * /* args */)
|
||||
|
||||
static void do_loglevel(p2pool * /* m_pool */, const char *args)
|
||||
{
|
||||
int level = strtol(args, nullptr, 10);
|
||||
int level = static_cast<int>(strtol(args, nullptr, 10));
|
||||
level = std::min(std::max(level, 0), log::MAX_GLOBAL_LOG_LEVEL);
|
||||
log::GLOBAL_LOG_LEVEL = level;
|
||||
LOGINFO(0, "log level set to " << level);
|
||||
@@ -388,7 +392,6 @@ 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();
|
||||
m_pool->stop();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
+19
-18
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -66,7 +66,7 @@ private:
|
||||
|
||||
static RandomBytes* randomBytes = nullptr;
|
||||
|
||||
}
|
||||
} // namespace
|
||||
|
||||
static FORCEINLINE bool less32(const uint8_t* k0, const uint8_t* k1)
|
||||
{
|
||||
@@ -89,7 +89,7 @@ void generate_keys(hash& pub, hash& sec)
|
||||
} while (!sc_isnonzero(sec.h));
|
||||
|
||||
ge_p3 point;
|
||||
ge_scalarmult_base(&point, sec.h);
|
||||
ge_scalarmult_base_vartime(&point, sec.h);
|
||||
ge_p3_tobytes(pub.h, &point);
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ void generate_keys_deterministic(hash& pub, hash& sec, const uint8_t* entropy, s
|
||||
} while (!sc_isnonzero(sec.h));
|
||||
|
||||
ge_p3 point;
|
||||
ge_scalarmult_base(&point, sec.h);
|
||||
ge_scalarmult_base_vartime(&point, sec.h);
|
||||
ge_p3_tobytes(pub.h, &point);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ bool check_keys(const hash& pub, const hash& sec)
|
||||
}
|
||||
|
||||
ge_p3 point;
|
||||
ge_scalarmult_base(&point, sec.h);
|
||||
ge_scalarmult_base_vartime(&point, sec.h);
|
||||
|
||||
hash pub_check;
|
||||
ge_p3_tobytes(pub_check.h, &point);
|
||||
@@ -206,7 +206,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
ge_scalarmult(&point2, key2.h, &point);
|
||||
ge_scalarmult_vartime(&point2, key2.h, &point);
|
||||
ge_mul8(&point3, &point2);
|
||||
ge_p1p1_to_p2(&point2, &point3);
|
||||
ge_tobytes(reinterpret_cast<uint8_t*>(&derivation), &point2);
|
||||
@@ -218,7 +218,7 @@ public:
|
||||
{
|
||||
WriteLock lock(derivations_lock);
|
||||
|
||||
auto entry = derivations->emplace(index, DerivationEntry{ derivation, { 0xFFFFFFFFUL, 0xFFFFFFFFUL }, {}, t }).first;
|
||||
auto entry = derivations->emplace(index, DerivationEntry{ derivation, { 0xFFFFFFFFUL, 0xFFFFFFFFUL }, {}, static_cast<uint32_t>(t) }).first;
|
||||
entry->second.add_view_tag(static_cast<uint32_t>(output_index << 8) | view_tag);
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
}
|
||||
|
||||
derivation_to_scalar(derivation, output_index, scalar);
|
||||
ge_scalarmult_base(&point2, reinterpret_cast<uint8_t*>(&scalar));
|
||||
ge_scalarmult_base_vartime(&point2, reinterpret_cast<uint8_t*>(&scalar));
|
||||
ge_p3_to_cached(&point3, &point2);
|
||||
ge_add(&point4, &point1, &point3);
|
||||
ge_p1p1_to_p2(&point5, &point4);
|
||||
@@ -262,7 +262,7 @@ public:
|
||||
const uint64_t t = seconds_since_epoch();
|
||||
{
|
||||
WriteLock lock(public_keys_lock);
|
||||
public_keys->emplace(index, PublicKeyEntry{ derived_key, t });
|
||||
public_keys->emplace(index, PublicKeyEntry{ static_cast<indexed_hash>(derived_key), static_cast<uint32_t>(t) });
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -297,7 +297,7 @@ public:
|
||||
const uint64_t t = seconds_since_epoch();
|
||||
{
|
||||
WriteLock lock(tx_keys_lock);
|
||||
tx_keys->emplace(index, TxKeyEntry{ pub, sec, t });
|
||||
tx_keys->emplace(index, TxKeyEntry{ pub, sec, static_cast<uint32_t>(t) });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,8 @@ public:
|
||||
if (timestamp) {
|
||||
auto clean_old = [timestamp](auto* table) {
|
||||
for (auto it = table->begin(); it != table->end();) {
|
||||
if (it->second.m_timestamp < timestamp) {
|
||||
// Wraparound-safe way of checking "it->second.m_timestamp < timestamp"
|
||||
if (((it->second.m_timestamp - static_cast<uint32_t>(timestamp)) & 0x80000000UL) != 0) {
|
||||
it = table->erase(it);
|
||||
}
|
||||
else {
|
||||
@@ -357,7 +358,7 @@ private:
|
||||
uint32_t m_viewTags1[2] = { 0xFFFFFFFFUL, 0xFFFFFFFFUL };
|
||||
std::vector<uint32_t> m_viewTags2;
|
||||
// cppcheck-suppress unusedStructMember
|
||||
uint64_t m_timestamp;
|
||||
uint32_t m_timestamp;
|
||||
|
||||
FORCEINLINE bool find_view_tag(size_t output_index, uint8_t& view_tag) const
|
||||
{
|
||||
@@ -390,7 +391,7 @@ private:
|
||||
m_viewTags1[i] = k; \
|
||||
return; \
|
||||
} \
|
||||
else if (t == k) { \
|
||||
if (t == k) { \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
@@ -407,9 +408,9 @@ private:
|
||||
|
||||
struct PublicKeyEntry
|
||||
{
|
||||
hash m_key;
|
||||
indexed_hash m_key;
|
||||
// cppcheck-suppress unusedStructMember
|
||||
uint64_t m_timestamp;
|
||||
uint32_t m_timestamp;
|
||||
};
|
||||
|
||||
struct TxKeyEntry
|
||||
@@ -417,7 +418,7 @@ private:
|
||||
hash m_pub;
|
||||
hash m_sec;
|
||||
// cppcheck-suppress unusedStructMember
|
||||
uint64_t m_timestamp;
|
||||
uint32_t m_timestamp;
|
||||
};
|
||||
|
||||
typedef unordered_map<std::array<uint8_t, HASH_SIZE * 2>, DerivationEntry> DerivationsMap;
|
||||
@@ -481,12 +482,12 @@ void init_crypto_cache()
|
||||
void destroy_crypto_cache()
|
||||
{
|
||||
{
|
||||
auto p = randomBytes;
|
||||
auto* p = randomBytes;
|
||||
randomBytes = nullptr;
|
||||
delete p;
|
||||
}
|
||||
{
|
||||
auto p = cache;
|
||||
auto* p = cache;
|
||||
cache = nullptr;
|
||||
delete p;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2026 jpk68
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "util.h"
|
||||
#include "i2p.h"
|
||||
|
||||
LOG_CATEGORY(I2P)
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
hash from_i2p_b32(const std::string& address)
|
||||
{
|
||||
if ((address.length() < 8) || (address.find(".b32.i2p") != address.length() - 8)) {
|
||||
LOGWARN(3, "Invalid I2P address \"" << address << "\": doesn't end with \".b32.i2p\"");
|
||||
return {};
|
||||
}
|
||||
|
||||
if (address.length() != 60) {
|
||||
LOGWARN(3, "Invalid I2P address \"" << address << "\": expected length 60, got " << address.length());
|
||||
return {};
|
||||
}
|
||||
|
||||
const hash result = from_i2p_b32_const(address.c_str());
|
||||
|
||||
if (result.empty()) {
|
||||
LOGWARN(3, "Invalid I2P address \"" << address << "\": has invalid character(s)");
|
||||
return {};
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string to_i2p_b32(const hash& dest_hash)
|
||||
{
|
||||
uint8_t buf[HASH_SIZE + 1];
|
||||
memcpy(buf, dest_hash.h, HASH_SIZE);
|
||||
buf[HASH_SIZE] = 0;
|
||||
|
||||
std::string result;
|
||||
result.reserve(60);
|
||||
|
||||
uint64_t data = 0;
|
||||
uint64_t bit_size = 0;
|
||||
|
||||
for (size_t i = 0; i < HASH_SIZE + 1; ++i) {
|
||||
data = (data << 8) | buf[i];
|
||||
bit_size += 8;
|
||||
|
||||
while (bit_size >= 5) {
|
||||
bit_size -= 5;
|
||||
result += base32_alphabet[(data >> bit_size) & 31];
|
||||
}
|
||||
}
|
||||
|
||||
result.append(".b32.i2p");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace p2pool
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2026 jpk68
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common.h"
|
||||
#include <string>
|
||||
#include <uv.h>
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
static FORCEINLINE constexpr hash from_i2p_b32_const(const char* dest_hash)
|
||||
{
|
||||
uint8_t buf[HASH_SIZE + 4] = {};
|
||||
uint8_t* p = buf;
|
||||
|
||||
uint64_t data = 0;
|
||||
uint64_t bit_size = 0;
|
||||
|
||||
for (size_t i = 0; i < 52; ++i) {
|
||||
const char c = dest_hash[i];
|
||||
uint64_t digit = 0;
|
||||
|
||||
if ('a' <= c && c <= 'z') {
|
||||
digit = static_cast<uint64_t>(c - 'a');
|
||||
}
|
||||
else if ('A' <= c && c <= 'Z') {
|
||||
digit = static_cast<uint64_t>(c - 'A');
|
||||
}
|
||||
else if ('2' <= c && c <= '7') {
|
||||
digit = static_cast<uint64_t>(c - '2') + 26;
|
||||
}
|
||||
else {
|
||||
return {};
|
||||
}
|
||||
|
||||
data = (data << 5) | digit;
|
||||
bit_size += 5;
|
||||
|
||||
while (bit_size >= 8) {
|
||||
bit_size -= 8;
|
||||
*(p++) = static_cast<uint8_t>(data >> bit_size);
|
||||
}
|
||||
}
|
||||
|
||||
hash result;
|
||||
|
||||
for (size_t i = 0; i < HASH_SIZE; ++i) {
|
||||
result.h[i] = buf[i];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
hash from_i2p_b32(const std::string& address);
|
||||
std::string to_i2p_b32(const hash& dest_hash);
|
||||
|
||||
} // namespace p2pool
|
||||
@@ -0,0 +1,291 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "util.h"
|
||||
#include "uv_util.h"
|
||||
|
||||
LOG_CATEGORY(indexed_hash)
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
static constexpr uint32_t BUCKET_COUNT = 1U << indexed_hash::BUCKET_BITS;
|
||||
static constexpr uint32_t INDEX_MASK = (1U << indexed_hash::BUCKET_SHIFT) - 1U;
|
||||
|
||||
// Stores hashes only
|
||||
static std::vector<hash> storage1[BUCKET_COUNT];
|
||||
|
||||
// Stores first 4 bytes of each hash (for better cache locality during search) and reference counters
|
||||
static std::vector<std::pair<uint32_t, uint32_t>> storage2[BUCKET_COUNT];
|
||||
|
||||
static constexpr uint32_t LOCK_COUNT = 64;
|
||||
|
||||
static ReadWriteLock locks[LOCK_COUNT];
|
||||
|
||||
static FORCEINLINE void decref(uint32_t index)
|
||||
{
|
||||
if (index == std::numeric_limits<uint32_t>::max()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32_t bucket = index >> indexed_hash::BUCKET_SHIFT;
|
||||
index &= INDEX_MASK;
|
||||
|
||||
auto& d2 = storage2[bucket];
|
||||
|
||||
WriteLock lock(locks[bucket % LOCK_COUNT]);
|
||||
|
||||
auto& p2 = d2[index];
|
||||
|
||||
#ifdef P2POOL_DEBUGGING
|
||||
if (p2.second == 0) {
|
||||
LOGERR(0, "fatal error: reference counter is 0 when it shouldn't be 0");
|
||||
PANIC_STOP();
|
||||
}
|
||||
#endif
|
||||
|
||||
--p2.second;
|
||||
}
|
||||
|
||||
static FORCEINLINE void incref(uint32_t index)
|
||||
{
|
||||
if (index == std::numeric_limits<uint32_t>::max()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32_t bucket = index >> indexed_hash::BUCKET_SHIFT;
|
||||
index &= INDEX_MASK;
|
||||
|
||||
auto& d2 = storage2[bucket];
|
||||
|
||||
WriteLock lock(locks[bucket % LOCK_COUNT]);
|
||||
++d2[index].second;
|
||||
}
|
||||
|
||||
indexed_hash::indexed_hash(const hash& h)
|
||||
{
|
||||
if (h.empty()) {
|
||||
m_index = std::numeric_limits<uint32_t>::max();
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32_t bucket = get_bucket(h);
|
||||
|
||||
auto& d1 = storage1[bucket];
|
||||
auto& d2 = storage2[bucket];
|
||||
|
||||
const uint32_t h32 = static_cast<uint32_t>(h.u64()[0]);
|
||||
uint32_t first_free_slot = std::numeric_limits<uint32_t>::max();
|
||||
|
||||
WriteLock lock(locks[bucket % LOCK_COUNT]);
|
||||
|
||||
const uint32_t n = static_cast<uint32_t>(d1.size());
|
||||
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
auto& p2 = d2[i];
|
||||
|
||||
if ((p2.first == h32) && (d1[i] == h)) {
|
||||
m_index = (bucket << BUCKET_SHIFT) | i;
|
||||
++p2.second;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((p2.second == 0) && (first_free_slot == std::numeric_limits<uint32_t>::max())) {
|
||||
first_free_slot = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (first_free_slot != std::numeric_limits<uint32_t>::max()) {
|
||||
m_index = (bucket << BUCKET_SHIFT) | first_free_slot;
|
||||
|
||||
d1[first_free_slot] = h;
|
||||
|
||||
auto& p2 = d2[first_free_slot];
|
||||
p2.first = h32;
|
||||
p2.second = 1;
|
||||
}
|
||||
else {
|
||||
if (n > INDEX_MASK) {
|
||||
LOGERR(0, "fatal error: storage overflow");
|
||||
PANIC_STOP();
|
||||
}
|
||||
|
||||
m_index = (bucket << BUCKET_SHIFT) | n;
|
||||
|
||||
if (n == d1.capacity()) {
|
||||
const uint32_t new_capacity = static_cast<uint32_t>(std::min<size_t>(n + ((n + 3) / 4), INDEX_MASK + 1));
|
||||
d1.reserve(new_capacity);
|
||||
d2.reserve(new_capacity);
|
||||
}
|
||||
|
||||
d1.emplace_back(h);
|
||||
d2.emplace_back(h32, 1);
|
||||
}
|
||||
}
|
||||
|
||||
indexed_hash::~indexed_hash()
|
||||
{
|
||||
decref(m_index);
|
||||
}
|
||||
|
||||
indexed_hash::indexed_hash(const indexed_hash& h)
|
||||
{
|
||||
const uint32_t i = h.m_index;
|
||||
|
||||
m_index = i;
|
||||
incref(i);
|
||||
}
|
||||
|
||||
indexed_hash& indexed_hash::operator=(const indexed_hash& h)
|
||||
{
|
||||
if (this == &h) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
const uint32_t i = m_index;
|
||||
const uint32_t j = h.m_index;
|
||||
|
||||
if (i == j) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
decref(i);
|
||||
|
||||
m_index = j;
|
||||
incref(j);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
indexed_hash& indexed_hash::operator=(indexed_hash&& h)
|
||||
{
|
||||
if (this == &h) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
const uint32_t i = m_index;
|
||||
const uint32_t j = h.m_index;
|
||||
|
||||
// Empty h because we're moving it
|
||||
h.m_index = std::numeric_limits<uint32_t>::max();
|
||||
|
||||
if (i == j) {
|
||||
// If h had the same index, decrease h's reference counter because now we have 1 instead of 2 objects using this index
|
||||
decref(j);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// If h had a different index, decrease our reference counter because our index will be overwritten by the index from h
|
||||
decref(i);
|
||||
|
||||
// No need to change the reference counter anymore because now we are referencing the hash that was referenced by h
|
||||
m_index = j;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
hash indexed_hash::get(uint32_t index)
|
||||
{
|
||||
const uint32_t bucket = index >> BUCKET_SHIFT;
|
||||
|
||||
const auto& d1 = storage1[bucket];
|
||||
index &= INDEX_MASK;
|
||||
|
||||
ReadLock lock(locks[bucket % LOCK_COUNT]);
|
||||
|
||||
#ifdef P2POOL_DEBUGGING
|
||||
if (storage2[bucket][index].second == 0) {
|
||||
LOGERR(0, "fatal error: reference counter is 0 when it shouldn't be 0");
|
||||
PANIC_STOP();
|
||||
}
|
||||
#endif
|
||||
|
||||
return d1[index];
|
||||
}
|
||||
|
||||
bool indexed_hash::is_same(uint32_t index, uint32_t bucket, const hash& h)
|
||||
{
|
||||
const auto& d1 = storage1[bucket];
|
||||
index &= INDEX_MASK;
|
||||
|
||||
ReadLock lock(locks[bucket % LOCK_COUNT]);
|
||||
|
||||
#ifdef P2POOL_DEBUGGING
|
||||
if (storage2[bucket][index].second == 0) {
|
||||
LOGERR(0, "fatal error: reference counter is 0 when it shouldn't be 0");
|
||||
PANIC_STOP();
|
||||
}
|
||||
#endif
|
||||
|
||||
return d1[index] == h;
|
||||
}
|
||||
|
||||
void indexed_hash::cleanup_storage()
|
||||
{
|
||||
for (auto& d1 : storage1) {
|
||||
d1.clear();
|
||||
d1.shrink_to_fit();
|
||||
}
|
||||
|
||||
for (auto& d2 : storage2) {
|
||||
#ifdef P2POOL_DEBUGGING
|
||||
for (const auto& p2 : d2) {
|
||||
if (p2.second) {
|
||||
LOGERR(0, "storage is not empty at exit. Fix the code!");
|
||||
PANIC_STOP();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
d2.clear();
|
||||
d2.shrink_to_fit();
|
||||
}
|
||||
}
|
||||
|
||||
void indexed_hash::print_status()
|
||||
{
|
||||
size_t total_hashes_stored = 0;
|
||||
size_t total_refcount = 0;
|
||||
size_t memory_used = 0;
|
||||
|
||||
const auto& s1 = storage1;
|
||||
const auto& s2 = storage2;
|
||||
|
||||
for (uint32_t i = 0; i < LOCK_COUNT; ++i) {
|
||||
ReadLock lock(locks[i]);
|
||||
|
||||
for (uint32_t j = i; j < BUCKET_COUNT; j += LOCK_COUNT) {
|
||||
memory_used += s1[j].capacity() * HASH_SIZE + s2[j].capacity() * sizeof(uint32_t) * 2;
|
||||
|
||||
for (const auto& p2 : storage2[j]) {
|
||||
if (p2.second) {
|
||||
++total_hashes_stored;
|
||||
total_refcount += p2.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memory_used += total_refcount * sizeof(indexed_hash);
|
||||
|
||||
LOGINFO(4, "status" <<
|
||||
"\nTotal hashes stored = " << total_hashes_stored <<
|
||||
"\nTotal refcount = " << total_refcount <<
|
||||
"\nMemory used = " << static_cast<double>(memory_used) / 1048576.0 << " MB (reduced from " << static_cast<double>(total_refcount * HASH_SIZE) / 1048576.0 << " MB)"
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace p2pool
|
||||
+18
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -85,6 +85,23 @@ struct parse_wrapper<T, hash>
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef WITH_INDEXED_HASHES
|
||||
template<typename T>
|
||||
struct parse_wrapper<T, indexed_hash>
|
||||
{
|
||||
static NOINLINE bool parse(T& v, const char* name, indexed_hash& out_value)
|
||||
{
|
||||
hash h;
|
||||
if (!parse_wrapper<T, hash>::parse(v, name, h)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
out_value = static_cast<indexed_hash>(h);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
struct parse_wrapper<T, difficulty_type>
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -97,6 +97,8 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
|
||||
, m_connectedTime(0)
|
||||
, m_proxy(proxy)
|
||||
{
|
||||
BACKGROUND_JOB_START(CurlContext);
|
||||
|
||||
m_pollHandles.reserve(2);
|
||||
|
||||
{
|
||||
@@ -124,7 +126,7 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
|
||||
m_req.clear();
|
||||
}
|
||||
else {
|
||||
s << "/json_rpc\0";
|
||||
s << "/json_rpc" << '\0';
|
||||
}
|
||||
|
||||
m_url = buf;
|
||||
@@ -266,6 +268,8 @@ CurlContext::~CurlContext()
|
||||
delete m_closeCallback;
|
||||
|
||||
curl_slist_free_all(m_headers);
|
||||
|
||||
BACKGROUND_JOB_STOP(CurlContext);
|
||||
}
|
||||
|
||||
int CurlContext::on_socket(CURL* /*easy*/, curl_socket_t s, int action)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
+17
-17
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -50,12 +50,12 @@ NOINLINE void keccakf_plain(std::array<uint64_t, 25>& st)
|
||||
bc[4] = st[4] ^ st[9] ^ st[14] ^ st[19] ^ st[24];
|
||||
|
||||
#define THETA(i) { \
|
||||
const uint64_t t = bc[(i + 4) % 5] ^ ROTL64(bc[(i + 1) % 5], 1); \
|
||||
st[i + 0 ] ^= t; \
|
||||
st[i + 5] ^= t; \
|
||||
st[i + 10] ^= t; \
|
||||
st[i + 15] ^= t; \
|
||||
st[i + 20] ^= t; \
|
||||
const uint64_t t = bc[((i) + 4) % 5] ^ ROTL64(bc[((i) + 1) % 5], 1); \
|
||||
st[(i) + 0 ] ^= t; \
|
||||
st[(i) + 5] ^= t; \
|
||||
st[(i) + 10] ^= t; \
|
||||
st[(i) + 15] ^= t; \
|
||||
st[(i) + 20] ^= t; \
|
||||
}
|
||||
|
||||
THETA(0);
|
||||
@@ -93,16 +93,16 @@ NOINLINE void keccakf_plain(std::array<uint64_t, 25>& st)
|
||||
|
||||
// Chi
|
||||
#define CHI(j) { \
|
||||
const uint64_t st0 = st[j ]; \
|
||||
const uint64_t st1 = st[j + 1]; \
|
||||
const uint64_t st2 = st[j + 2]; \
|
||||
const uint64_t st3 = st[j + 3]; \
|
||||
const uint64_t st4 = st[j + 4]; \
|
||||
st[j ] ^= ~st1 & st2; \
|
||||
st[j + 1] ^= ~st2 & st3; \
|
||||
st[j + 2] ^= ~st3 & st4; \
|
||||
st[j + 3] ^= ~st4 & st0; \
|
||||
st[j + 4] ^= ~st0 & st1; \
|
||||
const uint64_t st0 = st[(j) ]; \
|
||||
const uint64_t st1 = st[(j) + 1]; \
|
||||
const uint64_t st2 = st[(j) + 2]; \
|
||||
const uint64_t st3 = st[(j) + 3]; \
|
||||
const uint64_t st4 = st[(j) + 4]; \
|
||||
st[(j) ] ^= ~st1 & st2; \
|
||||
st[(j) + 1] ^= ~st2 & st3; \
|
||||
st[(j) + 2] ^= ~st3 & st4; \
|
||||
st[(j) + 3] ^= ~st4 & st0; \
|
||||
st[(j) + 4] ^= ~st0 & st1; \
|
||||
}
|
||||
|
||||
CHI( 0);
|
||||
|
||||
+5
-6
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keccak_constexpr.h"
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
enum KeccakParams {
|
||||
@@ -26,9 +28,6 @@ enum KeccakParams {
|
||||
|
||||
extern const uint64_t keccakf_rndc[24];
|
||||
|
||||
// keccak hash of a single 0x00 byte
|
||||
constexpr hash keccak_0x00{ 0xbc, 0x36, 0x78, 0x9e, 0x7a, 0x1e, 0x28, 0x14, 0x36, 0x46, 0x42, 0x29, 0x82, 0x8f, 0x81, 0x7d, 0x66, 0x12, 0xf7, 0xb4, 0x77, 0xd6, 0x65, 0x91, 0xff, 0x96, 0xa9, 0xe0, 0x64, 0xbc, 0xc9, 0x8a };
|
||||
|
||||
typedef void (*keccakf_func)(std::array<uint64_t, 25>&);
|
||||
extern keccakf_func keccakf;
|
||||
|
||||
@@ -50,7 +49,7 @@ FORCEINLINE void keccak(const uint8_t* in, int inlen, uint8_t (&md)[N])
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
FORCEINLINE void keccak_custom(T&& in, int inlen, uint8_t* md, int mdlen)
|
||||
FORCEINLINE void keccak_custom(T&& in, int inlen, uint8_t* md, int mdlen, bool SHA3 = false)
|
||||
{
|
||||
std::array<uint64_t, 25> st = {};
|
||||
|
||||
@@ -77,7 +76,7 @@ FORCEINLINE void keccak_custom(T&& in, int inlen, uint8_t* md, int mdlen)
|
||||
temp[i] = in(offset + i);
|
||||
}
|
||||
|
||||
temp[inlen++] = 1;
|
||||
temp[inlen++] = SHA3 ? 6 : 1;
|
||||
memset(temp + inlen, 0, rsiz - inlen);
|
||||
temp[rsiz - 1] |= 0x80;
|
||||
|
||||
|
||||
+17
-17
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -43,12 +43,12 @@ NOINLINE void keccakf_bmi(std::array<uint64_t, 25>& st)
|
||||
bc[4] = st[4] ^ st[9] ^ st[14] ^ st[19] ^ st[24];
|
||||
|
||||
#define THETA(i) { \
|
||||
const uint64_t t = bc[(i + 4) % 5] ^ ROTL64(bc[(i + 1) % 5], 1); \
|
||||
st[i + 0 ] ^= t; \
|
||||
st[i + 5] ^= t; \
|
||||
st[i + 10] ^= t; \
|
||||
st[i + 15] ^= t; \
|
||||
st[i + 20] ^= t; \
|
||||
const uint64_t t = bc[((i) + 4) % 5] ^ ROTL64(bc[((i) + 1) % 5], 1); \
|
||||
st[(i) + 0 ] ^= t; \
|
||||
st[(i) + 5] ^= t; \
|
||||
st[(i) + 10] ^= t; \
|
||||
st[(i) + 15] ^= t; \
|
||||
st[(i) + 20] ^= t; \
|
||||
}
|
||||
|
||||
THETA(0);
|
||||
@@ -86,16 +86,16 @@ NOINLINE void keccakf_bmi(std::array<uint64_t, 25>& st)
|
||||
|
||||
// Chi
|
||||
#define CHI(j) { \
|
||||
const uint64_t st0 = st[j ]; \
|
||||
const uint64_t st1 = st[j + 1]; \
|
||||
const uint64_t st2 = st[j + 2]; \
|
||||
const uint64_t st3 = st[j + 3]; \
|
||||
const uint64_t st4 = st[j + 4]; \
|
||||
st[j ] ^= _andn_u64(st1, st2); \
|
||||
st[j + 1] ^= _andn_u64(st2, st3); \
|
||||
st[j + 2] ^= _andn_u64(st3, st4); \
|
||||
st[j + 3] ^= _andn_u64(st4, st0); \
|
||||
st[j + 4] ^= _andn_u64(st0, st1); \
|
||||
const uint64_t st0 = st[(j) ]; \
|
||||
const uint64_t st1 = st[(j) + 1]; \
|
||||
const uint64_t st2 = st[(j) + 2]; \
|
||||
const uint64_t st3 = st[(j) + 3]; \
|
||||
const uint64_t st4 = st[(j) + 4]; \
|
||||
st[(j) ] ^= _andn_u64(st1, st2); \
|
||||
st[(j) + 1] ^= _andn_u64(st2, st3); \
|
||||
st[(j) + 2] ^= _andn_u64(st3, st4); \
|
||||
st[(j) + 3] ^= _andn_u64(st4, st0); \
|
||||
st[(j) + 4] ^= _andn_u64(st0, st1); \
|
||||
}
|
||||
|
||||
CHI(0);
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
namespace ConstexprKeccak
|
||||
{
|
||||
|
||||
template<int ROUNDS>
|
||||
static FORCEINLINE constexpr void keccakf(std::array<uint64_t, 25>& st)
|
||||
{
|
||||
constexpr uint64_t round_constants[24] =
|
||||
{
|
||||
0x0000000000000001, 0x0000000000008082, 0x800000000000808a,
|
||||
0x8000000080008000, 0x000000000000808b, 0x0000000080000001,
|
||||
0x8000000080008081, 0x8000000000008009, 0x000000000000008a,
|
||||
0x0000000000000088, 0x0000000080008009, 0x000000008000000a,
|
||||
0x000000008000808b, 0x800000000000008b, 0x8000000000008089,
|
||||
0x8000000000008003, 0x8000000000008002, 0x8000000000000080,
|
||||
0x000000000000800a, 0x800000008000000a, 0x8000000080008081,
|
||||
0x8000000000008080, 0x0000000080000001, 0x8000000080008008
|
||||
};
|
||||
constexpr int order[25] = { 1, 6, 9, 22, 14, 20, 2, 12, 13, 19, 23, 15, 4, 24, 21, 8, 16, 5, 3, 18, 17, 11, 7, 10, 1 };
|
||||
constexpr int shift[24] = { 44, 20, 61, 39, 18, 62, 43, 25, 8, 56, 41, 27, 14, 2, 55, 45, 36, 28, 21, 15, 10, 6, 3, 1 };
|
||||
|
||||
for (int round = 0; round < ROUNDS; ++round) {
|
||||
uint64_t bc[5] = {};
|
||||
|
||||
// Theta
|
||||
for (int i = 0; i < 5; ++i) bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] ^ st[i + 15] ^ st[i + 20];
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
const uint64_t t = bc[(i + 4) % 5] ^ ((bc[(i + 1) % 5] << 1) | (bc[(i + 1) % 5] >> 63));
|
||||
for (int j = 0; j < 25; j += 5) st[i + j] ^= t;
|
||||
}
|
||||
|
||||
// Rho Pi
|
||||
const auto st0 = st;
|
||||
for (int i = 0; i < 24; ++i) st[order[i]] = (st0[order[i + 1]] << shift[i]) | (st0[order[i + 1]] >> (64 - shift[i]));
|
||||
|
||||
// Chi
|
||||
for (int i = 0; i < 25; i += 5) {
|
||||
const uint64_t t[5] = { st[i], st[i + 1], st[i + 2], st[i + 3], st[i + 4] };
|
||||
for (int j = 0; j < 5; ++j) st[i + j] ^= ~t[(j + 1) % 5] & t[(j + 2) % 5];
|
||||
}
|
||||
|
||||
// Iota
|
||||
st[0] ^= round_constants[round];
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ConstexprKeccak
|
||||
|
||||
template<int len>
|
||||
static constexpr hash keccak(const char (&input)[len])
|
||||
{
|
||||
constexpr int rsiz = 136;
|
||||
constexpr int inlen = len - 1;
|
||||
static_assert(inlen < rsiz, "Too long input");
|
||||
|
||||
uint8_t temp[rsiz] = {};
|
||||
|
||||
for (int i = 0; i < inlen; ++i) {
|
||||
temp[i] = static_cast<uint8_t>(input[i]);
|
||||
}
|
||||
|
||||
temp[inlen] = 1;
|
||||
temp[rsiz - 1] |= 0x80;
|
||||
|
||||
std::array<uint64_t, 25> st = {};
|
||||
|
||||
for (int i = 0; i < rsiz / 8; i++) {
|
||||
uint64_t k = 0;
|
||||
for (int j = 0; j < 8; ++j) {
|
||||
k |= static_cast<uint64_t>(temp[i * 8 + j]) << (j * 8);
|
||||
}
|
||||
st[i] ^= k;
|
||||
}
|
||||
|
||||
ConstexprKeccak::keccakf<24>(st);
|
||||
|
||||
hash result{};
|
||||
|
||||
for (size_t i = 0; i < HASH_SIZE; ++i) {
|
||||
result.h[i] = static_cast<uint8_t>(st[i / 8] >> ((i % 8) * 8));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
constexpr hash keccak_0x00 = keccak("\0");
|
||||
constexpr hash keccak_subaddress_viewpub = keccak("subaddress_viewpub");
|
||||
constexpr hash keccak_onion_address_v3 = keccak("onion_address_v3");
|
||||
constexpr hash keccak_i2p_b32_address = keccak("i2p_b32_address");
|
||||
|
||||
static_assert(keccak_0x00.u64<0>() == 0x14281E7A9E7836BCULL, "constexpr keccak code check failed");
|
||||
|
||||
} // namespace p2pool
|
||||
+18
-10
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "common.h"
|
||||
#include "uv_util.h"
|
||||
#include "wallet.h"
|
||||
#include "params.h"
|
||||
#include <ctime>
|
||||
#include <fstream>
|
||||
#include <thread>
|
||||
@@ -118,7 +119,7 @@ public:
|
||||
BUF_SIZE = SLOT_SIZE * 8192,
|
||||
};
|
||||
|
||||
FORCEINLINE Worker()
|
||||
FORCEINLINE explicit Worker(const Params& p)
|
||||
: m_writePos(0)
|
||||
, m_readPos(0)
|
||||
, m_stopped(false)
|
||||
@@ -132,7 +133,7 @@ public:
|
||||
|
||||
std::setlocale(LC_ALL, "en_001");
|
||||
|
||||
m_logFilePath = DATA_DIR + log_file_name;
|
||||
m_logFilePath = p.m_logFilePath.empty() ? (p.m_dataDir + log_file_name) : p.m_logFilePath;
|
||||
|
||||
m_buf.resize(BUF_SIZE);
|
||||
|
||||
@@ -211,7 +212,7 @@ public:
|
||||
#endif
|
||||
|
||||
// Mark that everything is written into this log slot
|
||||
p[0] = buf[0] + 1;
|
||||
p[0] = static_cast<char>(buf[0] + 1);
|
||||
|
||||
// Signal the worker thread
|
||||
uv_cond_signal(&m_cond);
|
||||
@@ -453,7 +454,7 @@ static FORCEINLINE void writeCurrentTime(Stream& s)
|
||||
s.setNumberWidth(2);
|
||||
s << (t.tm_year + 1900) << '-' << (t.tm_mon + 1) << '-' << t.tm_mday << ' ' << t.tm_hour << ':' << t.tm_min << ':' << t.tm_sec << '.';
|
||||
|
||||
const int32_t mcs = time_point_cast<microseconds>(now).time_since_epoch().count() % 1000000;
|
||||
const int32_t mcs = static_cast<int32_t>(time_point_cast<microseconds>(now).time_since_epoch().count() % 1000000);
|
||||
|
||||
s.setNumberWidth(4);
|
||||
s << (mcs / 100);
|
||||
@@ -474,20 +475,27 @@ NOINLINE Writer::Writer(Severity severity) : Stream(m_stackBuf)
|
||||
NOINLINE Writer::~Writer()
|
||||
{
|
||||
const uint32_t size = static_cast<uint32_t>(m_pos + 1);
|
||||
m_buf[1] = static_cast<uint8_t>(size & 255);
|
||||
m_buf[2] = static_cast<uint8_t>(size >> 8);
|
||||
m_buf[1] = static_cast<char>(static_cast<uint8_t>(size & 255));
|
||||
m_buf[2] = static_cast<char>(static_cast<uint8_t>(size >> 8));
|
||||
m_buf[m_pos] = '\n';
|
||||
#ifndef P2POOL_LOG_DISABLE
|
||||
worker->write(m_buf, size);
|
||||
if (worker) {
|
||||
worker->write(m_buf, size);
|
||||
}
|
||||
else {
|
||||
fwrite(m_buf + 3, 1, size - 3, (m_buf[0] == 1) ? stdout : stderr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void start()
|
||||
void start(const Params& p)
|
||||
{
|
||||
#ifndef P2POOL_LOG_DISABLE
|
||||
worker = new Worker();
|
||||
worker = new Worker(p);
|
||||
|
||||
LOGINFO(0, "started");
|
||||
#else
|
||||
(void)p;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,6 +20,7 @@
|
||||
namespace p2pool {
|
||||
|
||||
class Wallet;
|
||||
struct Params;
|
||||
|
||||
namespace log {
|
||||
|
||||
@@ -184,6 +185,11 @@ template<> struct Stream::Entry<char>
|
||||
static FORCEINLINE void put(char c, Stream* wrapper) { wrapper->writeBuf(&c, 1); }
|
||||
};
|
||||
|
||||
template<> struct Stream::Entry<std::string_view>
|
||||
{
|
||||
static FORCEINLINE void put(const std::string_view& data, Stream* wrapper) { wrapper->writeBuf(data.data(), data.size()); }
|
||||
};
|
||||
|
||||
#define INT_ENTRY(x) \
|
||||
template<> struct Stream::Entry<x> { static FORCEINLINE void put(x data, Stream* wrapper) { wrapper->writeInt(data); } };
|
||||
|
||||
@@ -259,6 +265,13 @@ template<> struct Stream::Entry<hash>
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef WITH_INDEXED_HASHES
|
||||
template<> struct Stream::Entry<indexed_hash>
|
||||
{
|
||||
static FORCEINLINE void put(const indexed_hash& data, Stream* wrapper) { Stream::Entry<hash>::put(data, wrapper); }
|
||||
};
|
||||
#endif
|
||||
|
||||
template<> struct Stream::Entry<difficulty_type>
|
||||
{
|
||||
static NOINLINE void put(const difficulty_type& data, Stream* wrapper)
|
||||
@@ -584,7 +597,12 @@ struct DummyStream
|
||||
|
||||
#define LOGINFO(level, ...) SIDE_EFFECT_CHECK(level, log_category_prefix << __VA_ARGS__)
|
||||
#define LOGWARN(level, ...) SIDE_EFFECT_CHECK(level, log_category_prefix << __VA_ARGS__)
|
||||
|
||||
#ifdef P2POOL_ABORT_ON_LOG_ERROR
|
||||
#define LOGERR(level, ...) do { SIDE_EFFECT_CHECK(level, log_category_prefix << __VA_ARGS__); abort(); } while (0)
|
||||
#else
|
||||
#define LOGERR(level, ...) SIDE_EFFECT_CHECK(level, log_category_prefix << __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
@@ -605,7 +623,7 @@ struct DummyStream
|
||||
|
||||
#endif
|
||||
|
||||
void start();
|
||||
void start(const Params& p);
|
||||
void reopen();
|
||||
void stop();
|
||||
|
||||
|
||||
+111
-56
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -38,12 +38,15 @@
|
||||
#endif // WITH_GRPC
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
#ifdef WITH_RANDOMX
|
||||
#include "randomx.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_TLS
|
||||
#include "tls.h"
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && !defined(NDEBUG)
|
||||
|
||||
#include <DbgHelp.h>
|
||||
@@ -56,7 +59,8 @@ void p2pool_usage()
|
||||
{
|
||||
printf("P2Pool %s\n"
|
||||
"\nUsage:\n\n" \
|
||||
"--wallet Wallet address to mine to. Subaddresses and integrated addresses are not supported!\n"
|
||||
"--wallet Main wallet address (the one that starts with 4...). To mine to a subaddress of this wallet, use it together with --subaddress\n"
|
||||
"--subaddress Subaddress to mine to. It must belong to the same wallet that was specified with --wallet parameter\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"
|
||||
@@ -67,6 +71,7 @@ void p2pool_usage()
|
||||
"--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"
|
||||
"--log-file Path to the log file, default is \"p2pool.log\" in p2pool's working 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"
|
||||
@@ -84,6 +89,7 @@ void p2pool_usage()
|
||||
"--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"
|
||||
"--socks5-proxy-type The type of SOCKS5 proxy. Can be one of the following values: auto, plain, tor, i2p. Default is auto (auto-detected by the port number)\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
|
||||
@@ -99,8 +105,14 @@ void p2pool_usage()
|
||||
"--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
|
||||
"--stratum-proxy-protocol Enable HAProxy PROXY protocol v2 for incoming Stratum connections (use with HAProxy send-proxy-v2)\n"
|
||||
"--p2p-proxy-protocol Enable HAProxy PROXY protocol v2 for incoming P2P connections (use with HAProxy send-proxy-v2)\n"
|
||||
"--no-stratum-http Disable HTTP on Stratum ports\n"
|
||||
"--full-validation Enables full share validation / increases CPU usage\n"
|
||||
"--onion-address Tell other peers to use this .onion address to connect to this node through TOR\n"
|
||||
"--i2p-address Tell other peers to use this .b32.i2p address to connect to this node through I2P\n"
|
||||
"--no-clearnet-p2p Forces P2P server to listen on 127.0.0.1 and to not connect to clearnet IPs\n"
|
||||
"--params-file File name to load parameters from. It can't be used together with any other command line parameters\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",
|
||||
@@ -202,7 +214,7 @@ int p2pool_test()
|
||||
|
||||
constexpr char expected_hash[] = "3b5ecc2bb14f467161a04fe476b541194fba82dbbbfc7c320961f922a0294dee";
|
||||
|
||||
if (memcmp(buf, expected_hash, RANDOMX_HASH_SIZE * 2) != 0) {
|
||||
if (memcmp(buf, expected_hash, static_cast<int>(RANDOMX_HASH_SIZE * 2)) != 0) {
|
||||
printf("Invalid hash calculated: expected %s, got %s\n", expected_hash, buf);
|
||||
return 1;
|
||||
}
|
||||
@@ -215,6 +227,56 @@ int p2pool_test()
|
||||
return 0;
|
||||
}
|
||||
|
||||
static p2pool::Params get_params(int argc, const char* const argv[]) noexcept
|
||||
{
|
||||
try {
|
||||
std::vector<std::vector<std::string>> args;
|
||||
args.reserve(argc);
|
||||
|
||||
// Group command-line parameters by the pattern "--name [data1 data2 ... data_n]"
|
||||
// Each parameter starting with "--" can have 0 or more values attached to it
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
std::string_view arg = argv[i];
|
||||
|
||||
if ((arg.size() > 2) && (arg[0] == '-') && (arg[1] == '-')) {
|
||||
// Store the parameter name without the "--" prefix
|
||||
arg.remove_prefix(2);
|
||||
args.emplace_back(1, std::string(arg));
|
||||
}
|
||||
else if (!args.empty()) {
|
||||
args.back().emplace_back(std::move(arg));
|
||||
}
|
||||
}
|
||||
|
||||
p2pool::Params params(args);
|
||||
|
||||
if (params.valid()) {
|
||||
return params;
|
||||
}
|
||||
}
|
||||
catch (const std::exception&) {
|
||||
}
|
||||
|
||||
printf("Invalid or missing command line. Try \"p2pool --help\".\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
static p2pool::Params get_params(const std::string& params_file) noexcept
|
||||
{
|
||||
try {
|
||||
p2pool::Params params(p2pool::parse_config(params_file));
|
||||
|
||||
if (params.valid()) {
|
||||
return params;
|
||||
}
|
||||
}
|
||||
catch (const std::exception&) {
|
||||
}
|
||||
|
||||
printf("Invalid or missing command line. Try \"p2pool --help\".\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc == 1) {
|
||||
@@ -222,11 +284,10 @@ int main(int argc, char* argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool is_mini = false;
|
||||
bool is_nano = false;
|
||||
std::string params_file;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "/help") || !strcmp(argv[i], "-h") || !strcmp(argv[i], "/h")) {
|
||||
if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "/help") || !strcmp(argv[i], "-h") || !strcmp(argv[i], "/h") || !strcmp(argv[i], "/?")) {
|
||||
p2pool_usage();
|
||||
return 0;
|
||||
}
|
||||
@@ -240,52 +301,14 @@ int main(int argc, char* argv[])
|
||||
return p2pool_test();
|
||||
}
|
||||
|
||||
if ((strcmp(argv[i], "--data-dir") == 0) && (i + 1 < argc)) {
|
||||
std::string path = argv[++i];
|
||||
p2pool::DATA_DIR = std::move(path);
|
||||
p2pool::fixup_path(p2pool::DATA_DIR);
|
||||
}
|
||||
|
||||
if (!strcmp(argv[i], "--mini")) is_mini = true;
|
||||
if (!strcmp(argv[i], "--nano")) is_nano = true;
|
||||
}
|
||||
|
||||
// If the data directory is not set, check if P2Pool has write access to the current directory
|
||||
// If it doesn't, switch to user's home directory
|
||||
if (p2pool::DATA_DIR.empty()) {
|
||||
std::ofstream f("p2pool.tmp");
|
||||
if (f && f.put(' ')) {
|
||||
f.close();
|
||||
std::remove("p2pool.tmp");
|
||||
}
|
||||
else {
|
||||
char buf[1024];
|
||||
size_t size = sizeof(buf);
|
||||
|
||||
if (uv_os_homedir(buf, &size) == 0) {
|
||||
p2pool::DATA_DIR.assign(buf, size);
|
||||
p2pool::fixup_path(p2pool::DATA_DIR);
|
||||
|
||||
p2pool::DATA_DIR += ".p2pool/";
|
||||
|
||||
if (is_mini) {
|
||||
p2pool::DATA_DIR += "mini/";
|
||||
}
|
||||
else if (is_nano) {
|
||||
p2pool::DATA_DIR += "nano/";
|
||||
}
|
||||
}
|
||||
if (!strcmp(argv[i], "--params-file") && (i + 1 < argc)) {
|
||||
params_file = argv[++i];
|
||||
}
|
||||
}
|
||||
|
||||
if (!p2pool::DATA_DIR.empty()) {
|
||||
printf("Using \"%s\" for P2Pool files\n", p2pool::DATA_DIR.c_str());
|
||||
}
|
||||
|
||||
// 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 (!params_file.empty() && (argc != 3)) {
|
||||
fprintf(stderr, "--params-file can't be combined with other command line parameters\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && !defined(NDEBUG)
|
||||
@@ -296,24 +319,48 @@ int main(int argc, char* argv[])
|
||||
|
||||
memory_tracking_start();
|
||||
|
||||
// Create default loop here
|
||||
int result;
|
||||
{
|
||||
|
||||
// Create the default libuv loop and initialize libuv here
|
||||
// It will call the important stuff like WSAStartup and many other things
|
||||
// Some P2Pool code will not work without libuv initialized, so the code above this line must be minimal
|
||||
uv_default_loop();
|
||||
|
||||
p2pool::log::start();
|
||||
const p2pool::Params params = params_file.empty() ? get_params(argc, argv) : get_params(params_file);
|
||||
|
||||
if (!params.m_dataDir.empty()) {
|
||||
printf("Using \"%s\" for P2Pool files\n", params.m_dataDir.c_str());
|
||||
|
||||
// Try to create it if it doesn't exist
|
||||
std::error_code err;
|
||||
std::filesystem::create_directories(params.m_dataDir, err);
|
||||
}
|
||||
|
||||
p2pool::log::start(params);
|
||||
|
||||
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));
|
||||
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));
|
||||
if (result != CURLE_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef WITH_GRPC
|
||||
grpc_init();
|
||||
if (params.grpc_needed()) {
|
||||
grpc_init();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_TLS
|
||||
if (!p2pool::ServerTls::global_init()) {
|
||||
printf("ServerTls::global_init failed\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
try {
|
||||
p2pool::p2pool pool(argc, argv);
|
||||
p2pool::p2pool pool(params);
|
||||
result = pool.run();
|
||||
}
|
||||
catch (...) {
|
||||
@@ -321,13 +368,19 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
#ifdef WITH_GRPC
|
||||
grpc_shutdown();
|
||||
if (params.grpc_needed()) {
|
||||
grpc_shutdown();
|
||||
}
|
||||
#endif
|
||||
|
||||
curl_global_cleanup();
|
||||
|
||||
p2pool::destroy_crypto_cache();
|
||||
|
||||
#ifdef WITH_INDEXED_HASHES
|
||||
p2pool::indexed_hash::cleanup_storage();
|
||||
#endif
|
||||
|
||||
p2pool::log::stop();
|
||||
|
||||
uv_loop_close(uv_default_loop());
|
||||
@@ -336,6 +389,8 @@ int main(int argc, char* argv[])
|
||||
uv_library_shutdown();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
if (!memory_tracking_stop()) {
|
||||
result = 1;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -395,5 +395,5 @@ char* strdup_hook(const char* s) noexcept
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace p2pool
|
||||
#endif
|
||||
|
||||
+16
-2
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -41,7 +41,7 @@ void Mempool::add(const TxMempoolData& tx)
|
||||
}
|
||||
}
|
||||
|
||||
void Mempool::swap(std::vector<TxMempoolData>& transactions)
|
||||
void Mempool::swap_transactions(std::vector<TxMempoolData>& transactions)
|
||||
{
|
||||
const uint64_t cur_time = seconds_since_epoch();
|
||||
|
||||
@@ -59,10 +59,24 @@ void Mempool::swap(std::vector<TxMempoolData>& transactions)
|
||||
}
|
||||
|
||||
m_transactions.clear();
|
||||
m_transactions.reserve(transactions.size());
|
||||
|
||||
for (TxMempoolData& data : transactions) {
|
||||
m_transactions.emplace(data.id, data);
|
||||
}
|
||||
}
|
||||
|
||||
void Mempool::remove(const std::vector<hash>& tx_hashes)
|
||||
{
|
||||
if (tx_hashes.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
WriteLock lock(m_lock);
|
||||
|
||||
for (const hash& h : tx_hashes) {
|
||||
m_transactions.erase(h);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace p2pool
|
||||
|
||||
+4
-2
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
~Mempool();
|
||||
|
||||
void add(const TxMempoolData& tx);
|
||||
void swap(std::vector<TxMempoolData>& transactions);
|
||||
void swap_transactions(std::vector<TxMempoolData>& transactions);
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
@@ -56,6 +56,8 @@ public:
|
||||
m_transactions.clear();
|
||||
}
|
||||
|
||||
void remove(const std::vector<hash>& tx_hashes);
|
||||
|
||||
private:
|
||||
mutable uv_rwlock_t m_lock;
|
||||
unordered_map<hash, TxMempoolData> m_transactions;
|
||||
|
||||
+265
-6
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,10 +23,19 @@
|
||||
#include "merge_mining_client_tari.h"
|
||||
#endif
|
||||
|
||||
LOG_CATEGORY(MergeMiningClient)
|
||||
#include "p2pool.h"
|
||||
#include "params.h"
|
||||
#include "pool_block.h"
|
||||
#include "keccak_constexpr.h"
|
||||
#include "side_chain.h"
|
||||
#include "merkle.h"
|
||||
|
||||
static thread_local const char* log_category_prefix = "MergeMiningClient ";
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
static constexpr hash Tari_ChainID{ "01f0cf665bd4cd31cbb2b2470236389c483522b350335e10a4a5dca34cb85990" };
|
||||
|
||||
IMergeMiningClient* IMergeMiningClient::create(p2pool* pool, const std::string& host, const std::string& wallet) noexcept
|
||||
{
|
||||
try {
|
||||
@@ -34,11 +43,8 @@ IMergeMiningClient* IMergeMiningClient::create(p2pool* pool, const std::string&
|
||||
if (host.find(MergeMiningClientTari::TARI_PREFIX) == 0) {
|
||||
return new MergeMiningClientTari(pool, host, wallet);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
return new MergeMiningClientJSON_RPC(pool, host, wallet);
|
||||
}
|
||||
return new MergeMiningClientJSON_RPC(pool, host, wallet);
|
||||
}
|
||||
catch (...) {
|
||||
LOGERR(1, "Failed to create merge mining client for " << host);
|
||||
@@ -46,4 +52,257 @@ IMergeMiningClient* IMergeMiningClient::create(p2pool* pool, const std::string&
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MergeMiningClientShared::MergeMiningClientShared(p2pool* pool, const std::string& wallet)
|
||||
: m_chainParamsLock{}
|
||||
, m_chainParams{}
|
||||
, m_chainParamsTimestamp(0)
|
||||
, m_auxWallet(wallet)
|
||||
, m_pool(pool)
|
||||
, m_previousAuxHashes{}
|
||||
, m_previousAuxHashesIndex(0)
|
||||
, m_previousAuxHashesFoundIndex(std::numeric_limits<uint32_t>::max())
|
||||
{
|
||||
uv_rwlock_init_checked(&m_chainParamsLock);
|
||||
}
|
||||
|
||||
MergeMiningClientShared::~MergeMiningClientShared()
|
||||
{
|
||||
uv_rwlock_destroy(&m_chainParamsLock);
|
||||
}
|
||||
|
||||
void MergeMiningClientShared::on_external_block(const PoolBlock& block)
|
||||
{
|
||||
#ifdef WITH_MERGE_MINING_DONATION
|
||||
// The rest of the code is needed only when this node is sending donation messages
|
||||
if (m_pool->params().m_authorKeyFile.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const char* old_log_category_prefix = log_category_prefix;
|
||||
log_category_prefix = get_log_category();
|
||||
ON_SCOPE_LEAVE([old_log_category_prefix]() { log_category_prefix = old_log_category_prefix; });
|
||||
|
||||
// Sanity check
|
||||
if (block.m_transactions.empty() || block.m_hashingBlob.empty() || (block.m_hashingBlob.size() > 128)) {
|
||||
LOGWARN(3, "on_external_block: sanity check failed - " << block.m_transactions.size() << " transactions, hashing blob size = " << block.m_hashingBlob.size());
|
||||
return;
|
||||
}
|
||||
|
||||
ChainParameters chain_params;
|
||||
hash previous_aux_hashes[NUM_PREVIOUS_HASHES];
|
||||
{
|
||||
ReadLock lock(m_chainParamsLock);
|
||||
|
||||
chain_params = m_chainParams;
|
||||
std::copy(m_previousAuxHashes, m_previousAuxHashes + NUM_PREVIOUS_HASHES, previous_aux_hashes);
|
||||
}
|
||||
|
||||
// Don't continue if our aux chain is not there
|
||||
if (block.m_mergeMiningExtra.find(chain_params.aux_id) == block.m_mergeMiningExtra.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// All aux chains in this block + the P2Pool sidechain
|
||||
std::vector<hash> aux_ids;
|
||||
|
||||
// All aux chains in this block
|
||||
std::vector<AuxChainData> aux_chains;
|
||||
|
||||
aux_ids.reserve(block.m_mergeMiningExtra.size() + 1);
|
||||
aux_chains.reserve(block.m_mergeMiningExtra.size() + 1);
|
||||
|
||||
uint64_t mm_extra_size = 0;
|
||||
|
||||
for (const auto& i : block.m_mergeMiningExtra) {
|
||||
// Filter aux chain data only
|
||||
if ((i.first == keccak_subaddress_viewpub) || (i.first == keccak_onion_address_v3) || (i.first == keccak_i2p_b32_address)) {
|
||||
continue;
|
||||
}
|
||||
++mm_extra_size;
|
||||
|
||||
hash data;
|
||||
difficulty_type diff;
|
||||
{
|
||||
const std::vector<uint8_t>& v = i.second;
|
||||
|
||||
if (v.size() < HASH_SIZE) {
|
||||
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '1');
|
||||
return;
|
||||
}
|
||||
|
||||
const uint8_t* p = v.data();
|
||||
const uint8_t* e = v.data() + v.size();
|
||||
|
||||
memcpy(data.h, p, HASH_SIZE);
|
||||
p += HASH_SIZE;
|
||||
|
||||
p = readVarint(p, e, diff.lo);
|
||||
if (!p) {
|
||||
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '2');
|
||||
diff.lo = 0;
|
||||
}
|
||||
else {
|
||||
p = readVarint(p, e, diff.hi);
|
||||
if (!p) {
|
||||
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '3');
|
||||
diff.hi = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If it's our aux chain, check that it's the same job and that there is enough PoW
|
||||
if (i.first == chain_params.aux_id) {
|
||||
const bool different_hash = (data != chain_params.aux_hash);
|
||||
|
||||
if (different_hash || (diff != chain_params.aux_diff)) {
|
||||
uint32_t index = std::numeric_limits<uint32_t>::max();
|
||||
|
||||
if (different_hash) {
|
||||
for (uint32_t k = 0; k < NUM_PREVIOUS_HASHES; ++k) {
|
||||
if (previous_aux_hashes[k] == data) {
|
||||
index = k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_previousAuxHashesFoundIndex = index;
|
||||
|
||||
if (different_hash && (index == std::numeric_limits<uint32_t>::max())) {
|
||||
LOGINFO(4, "External aux job solution found, but it's for another miner");
|
||||
return;
|
||||
}
|
||||
|
||||
LOGINFO(4, "External aux job solution found, but it's stale");
|
||||
chain_params.aux_hash = data;
|
||||
chain_params.aux_diff = diff;
|
||||
}
|
||||
else {
|
||||
m_previousAuxHashesFoundIndex = std::numeric_limits<uint32_t>::max();
|
||||
}
|
||||
|
||||
if (!diff.check_pow(block.m_powHash)) {
|
||||
#ifndef P2POOL_LOG_DISABLE
|
||||
const char* name = ((chain_params.aux_id == Tari_ChainID) ? "Tari" : "aux");
|
||||
#endif
|
||||
LOGINFO(4, "External aux job solution found, but it doesn't have enough PoW (block diff = " << block.m_difficulty << ", " << name << " diff = " << diff << ')');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
aux_ids.emplace_back(i.first);
|
||||
aux_chains.emplace_back(i.first, data, diff);
|
||||
}
|
||||
|
||||
aux_ids.emplace_back(m_pool->side_chain().consensus_hash());
|
||||
|
||||
LOGINFO(0, log::LightGreen() << "External aux job solution found. Processing it!");
|
||||
|
||||
// coinbase_merkle_proof
|
||||
root_hash root;
|
||||
std::vector<hash> proof;
|
||||
uint32_t path;
|
||||
|
||||
#ifdef WITH_INDEXED_HASHES
|
||||
std::vector<hash> transactions;
|
||||
transactions.reserve(block.m_transactions.size());
|
||||
|
||||
for (const auto& h : block.m_transactions) {
|
||||
transactions.emplace_back(h);
|
||||
}
|
||||
#else
|
||||
const std::vector<hash>& transactions = block.m_transactions;
|
||||
#endif
|
||||
|
||||
if (!merkle_hash_with_proof(transactions, 0, proof, path, root)) {
|
||||
LOGWARN(3, "on_external_block: merkle_hash_with_proof failed for coinbase transaction");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!verify_merkle_proof(transactions[0], proof, path, root)) {
|
||||
LOGWARN(3, "on_external_block: verify_merkle_proof failed for coinbase transaction");
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> coinbase_merkle_proof;
|
||||
coinbase_merkle_proof.reserve(proof.size() * HASH_SIZE);
|
||||
|
||||
for (const hash& h : proof) {
|
||||
coinbase_merkle_proof.insert(coinbase_merkle_proof.end(), h.h, h.h + HASH_SIZE);
|
||||
}
|
||||
|
||||
// hashing_blob
|
||||
|
||||
uint8_t hashing_blob[128] = {};
|
||||
memcpy(hashing_blob, block.m_hashingBlob.data(), block.m_hashingBlob.size());
|
||||
|
||||
// nonce_offset and blob
|
||||
|
||||
size_t header_size = 0;
|
||||
const std::vector<uint8_t> blob = block.serialize_mainchain_data(&header_size);
|
||||
|
||||
if (header_size <= NONCE_SIZE) {
|
||||
LOGWARN(3, "on_external_block: invalid header_size");
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32_t nonce_offset = static_cast<uint32_t>(header_size - NONCE_SIZE);
|
||||
|
||||
// aux_merkle_proof, aux_merkle_proof_path
|
||||
|
||||
std::vector<hash> aux_merkle_proof;
|
||||
uint32_t aux_merkle_proof_path = 0;
|
||||
|
||||
const hash sidechain_id = block.m_sidechainId;
|
||||
const uint32_t n_aux_chains = static_cast<uint32_t>(mm_extra_size + 1);
|
||||
|
||||
std::vector<hash> hashes(n_aux_chains);
|
||||
|
||||
uint32_t aux_nonce;
|
||||
if (!find_aux_nonce(aux_ids, aux_nonce, 1000)) {
|
||||
LOGWARN(3, "on_external_block: failed to find aux_nonce");
|
||||
return;
|
||||
}
|
||||
|
||||
for (const AuxChainData& aux_data : aux_chains) {
|
||||
const uint32_t aux_slot = get_aux_slot(aux_data.unique_id, aux_nonce, n_aux_chains);
|
||||
|
||||
if (!hashes[aux_slot].empty()) {
|
||||
LOGWARN(3, "on_external_block: found an incorrect aux_nonce " << '1');
|
||||
return;
|
||||
}
|
||||
|
||||
hashes[aux_slot] = aux_data.data;
|
||||
}
|
||||
|
||||
const uint32_t aux_slot = get_aux_slot(m_pool->side_chain().consensus_hash(), aux_nonce, n_aux_chains);
|
||||
|
||||
if (!hashes[aux_slot].empty()) {
|
||||
LOGWARN(3, "on_external_block: found an incorrect aux_nonce " << '2');
|
||||
return;
|
||||
}
|
||||
|
||||
hashes[aux_slot] = sidechain_id;
|
||||
|
||||
if (!merkle_hash_with_proof(hashes, chain_params.aux_hash, aux_merkle_proof, aux_merkle_proof_path, root)) {
|
||||
LOGWARN(3, "on_external_block: merkle_hash_with_proof failed for the aux hash");
|
||||
return;
|
||||
}
|
||||
|
||||
if (root != block.m_merkleRoot) {
|
||||
LOGWARN(3, "on_external_block: merkle root didn't match");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!verify_merkle_proof(chain_params.aux_hash, aux_merkle_proof, aux_merkle_proof_path, root)) {
|
||||
LOGWARN(3, "on_external_block: verify_merkle_proof failed for the aux hash");
|
||||
return;
|
||||
}
|
||||
|
||||
submit_solution(coinbase_merkle_proof, hashing_blob, nonce_offset, block.m_seed, blob, aux_merkle_proof, aux_merkle_proof_path);
|
||||
#else // WITH_MERGE_MINING_DONATION
|
||||
(void)block;
|
||||
#endif // WITH_MERGE_MINING_DONATION
|
||||
}
|
||||
|
||||
} // namespace p2pool
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "uv_util.h"
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
class p2pool;
|
||||
@@ -53,4 +55,34 @@ public:
|
||||
virtual void api_status(log::Stream&) const = 0;
|
||||
};
|
||||
|
||||
class MergeMiningClientShared : public IMergeMiningClient, public nocopy_nomove
|
||||
{
|
||||
public:
|
||||
MergeMiningClientShared(p2pool* pool, const std::string& wallet);
|
||||
~MergeMiningClientShared() override;
|
||||
|
||||
void on_external_block(const PoolBlock& block) override;
|
||||
|
||||
virtual const char* get_log_category() const = 0;
|
||||
|
||||
protected:
|
||||
mutable uv_rwlock_t m_chainParamsLock;
|
||||
ChainParameters m_chainParams;
|
||||
|
||||
uint64_t m_chainParamsTimestamp;
|
||||
|
||||
std::string m_auxWallet;
|
||||
|
||||
p2pool* m_pool;
|
||||
|
||||
enum {
|
||||
NUM_PREVIOUS_HASHES = 8,
|
||||
};
|
||||
|
||||
hash m_previousAuxHashes[NUM_PREVIOUS_HASHES];
|
||||
uint32_t m_previousAuxHashesIndex;
|
||||
|
||||
std::atomic<uint32_t> m_previousAuxHashesFoundIndex;
|
||||
};
|
||||
|
||||
} // namespace p2pool
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -29,12 +29,9 @@ LOG_CATEGORY(MergeMiningClientJSON_RPC)
|
||||
namespace p2pool {
|
||||
|
||||
MergeMiningClientJSON_RPC::MergeMiningClientJSON_RPC(p2pool* pool, const std::string& host, const std::string& wallet)
|
||||
: m_host(host)
|
||||
: MergeMiningClientShared(pool, wallet)
|
||||
, m_host(host)
|
||||
, m_port(80)
|
||||
, m_chainParamsTimestamp(0)
|
||||
, m_auxWallet(wallet)
|
||||
, m_ping(0.0)
|
||||
, m_pool(pool)
|
||||
, m_loop{}
|
||||
, m_loopThread{}
|
||||
, m_timer{}
|
||||
@@ -44,10 +41,17 @@ MergeMiningClientJSON_RPC::MergeMiningClientJSON_RPC(p2pool* pool, const std::st
|
||||
const size_t k = host.find_last_of(':');
|
||||
if (k != std::string::npos) {
|
||||
m_host = host.substr(0, k);
|
||||
m_port = std::stoul(host.substr(k + 1), nullptr, 10);
|
||||
|
||||
// Handle IPv6 addresses
|
||||
if ((m_host.length() > 2) && (m_host.find_first_of(':') != std::string::npos) && (m_host.front() == '[') && (m_host.back() == ']')) {
|
||||
m_host.erase(m_host.begin());
|
||||
m_host.pop_back();
|
||||
}
|
||||
|
||||
m_port = static_cast<int32_t>(std::stol(host.substr(k + 1), nullptr, 10));
|
||||
}
|
||||
|
||||
if (m_host.empty() || (m_port == 0) || (m_port >= 65536)) {
|
||||
if (m_host.empty() || (m_port <= 0) || (m_port >= 65536)) {
|
||||
LOGERR(1, "Invalid host " << host);
|
||||
throw std::exception();
|
||||
}
|
||||
@@ -77,8 +81,6 @@ MergeMiningClientJSON_RPC::MergeMiningClientJSON_RPC(p2pool* pool, const std::st
|
||||
}
|
||||
m_timer.data = this;
|
||||
|
||||
uv_rwlock_init_checked(&m_lock);
|
||||
|
||||
err = uv_thread_create(&m_loopThread, loop, this);
|
||||
if (err) {
|
||||
LOGERR(1, "failed to start event loop thread, error " << uv_err_name(err));
|
||||
@@ -94,8 +96,6 @@ MergeMiningClientJSON_RPC::~MergeMiningClientJSON_RPC()
|
||||
uv_async_send(&m_shutdownAsync);
|
||||
uv_thread_join(&m_loopThread);
|
||||
|
||||
uv_rwlock_destroy(&m_lock);
|
||||
|
||||
LOGINFO(1, "stopped");
|
||||
}
|
||||
|
||||
@@ -115,15 +115,14 @@ void MergeMiningClientJSON_RPC::merge_mining_get_chain_id()
|
||||
|
||||
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);
|
||||
WriteLock lock(m_chainParamsLock);
|
||||
|
||||
if (parse_merge_mining_get_chain_id(data, size)) {
|
||||
if (ping > 0.0) {
|
||||
m_ping = ping;
|
||||
}
|
||||
|
||||
LOGINFO(1, m_host << ':' << m_port << " uses chain_id " << log::LightCyan() << m_chainParams.aux_id);
|
||||
LOGINFO(1, m_host << ':' << m_port << " ping is " << m_ping << " ms");
|
||||
|
||||
if (ping > 0.0) {
|
||||
LOGINFO(1, m_host << ':' << m_port << " ping is " << ping << " ms");
|
||||
}
|
||||
|
||||
// Chain ID received successfully, we can start polling for new mining jobs now
|
||||
const int err = uv_timer_start(&m_timer, on_timer, 0, 500);
|
||||
@@ -191,7 +190,7 @@ void MergeMiningClientJSON_RPC::merge_mining_get_aux_block(uint64_t height, cons
|
||||
|
||||
hash aux_hash;
|
||||
{
|
||||
ReadLock lock(m_lock);
|
||||
ReadLock lock(m_chainParamsLock);
|
||||
aux_hash = m_chainParams.aux_hash;
|
||||
}
|
||||
|
||||
@@ -207,14 +206,29 @@ void MergeMiningClientJSON_RPC::merge_mining_get_aux_block(uint64_t height, cons
|
||||
bool changed = false;
|
||||
hash chain_id;
|
||||
|
||||
hash prev_aux_hash;
|
||||
std::vector<uint8_t> prev_aux_blob;
|
||||
{
|
||||
WriteLock lock(m_lock);
|
||||
WriteLock lock(m_chainParamsLock);
|
||||
|
||||
prev_aux_hash = m_chainParams.aux_hash;
|
||||
prev_aux_blob = m_chainParams.aux_blob;
|
||||
|
||||
if (parse_merge_mining_get_aux_block(data, size, changed)) {
|
||||
chain_id = m_chainParams.aux_id;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed && !chain_id.empty()) {
|
||||
{
|
||||
WriteLock lock(m_chainParamsLock);
|
||||
|
||||
const uint32_t index = (m_previousAuxHashesIndex++) % NUM_PREVIOUS_HASHES;
|
||||
|
||||
m_previousAuxHashes[index] = prev_aux_hash;
|
||||
m_previousAuxBlobs[index] = prev_aux_blob;
|
||||
}
|
||||
|
||||
m_pool->update_aux_data(chain_id);
|
||||
}
|
||||
},
|
||||
@@ -293,14 +307,19 @@ bool MergeMiningClientJSON_RPC::parse_merge_mining_get_aux_block(const char* dat
|
||||
|
||||
void MergeMiningClientJSON_RPC::submit_solution(const std::vector<uint8_t>& /*coinbase_merkle_proof*/, const uint8_t (&/*hashing_blob*/)[128], size_t /*nonce_offset*/, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path)
|
||||
{
|
||||
ReadLock lock(m_lock);
|
||||
ReadLock lock(m_chainParamsLock);
|
||||
|
||||
std::vector<char> buf((m_chainParams.aux_blob.size() + HASH_SIZE + blob.size()) * 2 + merkle_proof.size() * (HASH_SIZE * 2 + 3) + 256);
|
||||
const uint32_t index = m_previousAuxHashesFoundIndex.exchange(std::numeric_limits<uint32_t>::max());
|
||||
|
||||
const std::vector<uint8_t>& aux_blob = (index < NUM_PREVIOUS_HASHES) ? m_previousAuxBlobs[index] : m_chainParams.aux_blob;
|
||||
const hash& aux_hash = (index < NUM_PREVIOUS_HASHES) ? m_previousAuxHashes[index] : m_chainParams.aux_hash;
|
||||
|
||||
std::vector<char> buf((aux_blob.size() + HASH_SIZE + blob.size()) * 2 + merkle_proof.size() * (HASH_SIZE * 2 + 3) + 256);
|
||||
log::Stream s(buf.data(), buf.size());
|
||||
|
||||
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"merge_mining_submit_solution\",\"params\":{"
|
||||
<< "\"aux_blob\":\"" << log::hex_buf(m_chainParams.aux_blob.data(), m_chainParams.aux_blob.size()) << '"'
|
||||
<< ",\"aux_hash\":\"" << m_chainParams.aux_hash << '"'
|
||||
<< "\"aux_blob\":\"" << log::hex_buf(aux_blob.data(), aux_blob.size()) << '"'
|
||||
<< ",\"aux_hash\":\"" << aux_hash << '"'
|
||||
<< ",\"blob\":\"" << log::hex_buf(blob.data(), blob.size()) << '"'
|
||||
<< ",\"merkle_proof\":[";
|
||||
|
||||
@@ -329,7 +348,7 @@ void MergeMiningClientJSON_RPC::submit_solution(const std::vector<uint8_t>& /*co
|
||||
|
||||
void MergeMiningClientJSON_RPC::print_status() const
|
||||
{
|
||||
ReadLock lock(m_lock);
|
||||
ReadLock lock(m_chainParamsLock);
|
||||
|
||||
LOGINFO(0, "status" <<
|
||||
"\nHost = " << m_host << ':' << m_port <<
|
||||
@@ -340,7 +359,7 @@ void MergeMiningClientJSON_RPC::print_status() const
|
||||
|
||||
void MergeMiningClientJSON_RPC::api_status(log::Stream& s) const
|
||||
{
|
||||
ReadLock lock(m_lock);
|
||||
ReadLock lock(m_chainParamsLock);
|
||||
|
||||
s << '{'
|
||||
<< "\"api\":\"JSON RPC\","
|
||||
@@ -356,7 +375,7 @@ bool MergeMiningClientJSON_RPC::get_params(ChainParameters& out_params) const
|
||||
{
|
||||
const uint64_t t = seconds_since_epoch();
|
||||
|
||||
ReadLock lock(m_lock);
|
||||
ReadLock lock(m_chainParamsLock);
|
||||
|
||||
if (m_chainParams.aux_id.empty() || m_chainParams.aux_diff.empty()) {
|
||||
return false;
|
||||
@@ -390,12 +409,10 @@ bool MergeMiningClientJSON_RPC::parse_merge_mining_submit_solution(const char* d
|
||||
if (error_result.IsString()) {
|
||||
return err(error_result.GetString());
|
||||
}
|
||||
else if (error_result.IsObject() && error_result.HasMember("message") && error_result["message"].IsString()) {
|
||||
if (error_result.IsObject() && error_result.HasMember("message") && error_result["message"].IsString()) {
|
||||
return err(error_result["message"].GetString());
|
||||
}
|
||||
else {
|
||||
return err("an unknown error occurred");
|
||||
}
|
||||
return err("an unknown error occurred");
|
||||
}
|
||||
|
||||
if (!doc.HasMember("result")) {
|
||||
@@ -450,4 +467,9 @@ void MergeMiningClientJSON_RPC::on_shutdown()
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&m_timer), nullptr);
|
||||
}
|
||||
|
||||
const char* MergeMiningClientJSON_RPC::get_log_category() const
|
||||
{
|
||||
return log_category_prefix;
|
||||
}
|
||||
|
||||
} // namespace p2pool
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -24,19 +24,20 @@ namespace p2pool {
|
||||
class p2pool;
|
||||
struct PoolBlock;
|
||||
|
||||
class MergeMiningClientJSON_RPC : public IMergeMiningClient
|
||||
class MergeMiningClientJSON_RPC : public MergeMiningClientShared
|
||||
{
|
||||
public:
|
||||
MergeMiningClientJSON_RPC(p2pool* pool, const std::string& host, const std::string& wallet);
|
||||
~MergeMiningClientJSON_RPC() override;
|
||||
|
||||
bool get_params(ChainParameters& out_params) const override;
|
||||
void on_external_block(const PoolBlock& /*block*/) override {}
|
||||
void submit_solution(const std::vector<uint8_t>& coinbase_merkle_proof, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) override;
|
||||
|
||||
void print_status() const override;
|
||||
void api_status(log::Stream&) const override;
|
||||
|
||||
const char* get_log_category() const override;
|
||||
|
||||
private:
|
||||
static void loop(void* data);
|
||||
|
||||
@@ -51,19 +52,10 @@ private:
|
||||
|
||||
bool parse_merge_mining_submit_solution(const char* data, size_t size) const;
|
||||
|
||||
std::vector<uint8_t> m_previousAuxBlobs[NUM_PREVIOUS_HASHES];
|
||||
|
||||
std::string m_host;
|
||||
uint32_t m_port;
|
||||
|
||||
mutable uv_rwlock_t m_lock;
|
||||
ChainParameters m_chainParams;
|
||||
|
||||
uint64_t m_chainParamsTimestamp;
|
||||
|
||||
std::string m_auxWallet;
|
||||
|
||||
double m_ping;
|
||||
|
||||
p2pool* m_pool;
|
||||
int32_t m_port;
|
||||
|
||||
uv_loop_t m_loop;
|
||||
uv_thread_t m_loopThread;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -34,15 +34,9 @@ using namespace tari::rpc;
|
||||
namespace p2pool {
|
||||
|
||||
MergeMiningClientTari::MergeMiningClientTari(p2pool* pool, std::string host, const std::string& wallet)
|
||||
: m_chainParams{}
|
||||
, m_chainParamsTimestamp(0)
|
||||
, m_previousAuxHashes{}
|
||||
, m_previousAuxHashesIndex(0)
|
||||
, m_previousAuxHashesFoundIndex(std::numeric_limits<uint32_t>::max())
|
||||
, m_auxWallet(wallet)
|
||||
, m_pool(pool)
|
||||
: MergeMiningClientShared(pool, wallet)
|
||||
, m_tariJobParams{}
|
||||
, m_server(new TariServer(pool->params().m_socks5Proxy))
|
||||
, m_server(new TariServer(pool->params().m_socks5Proxy, pool->params().m_socks5ProxyType))
|
||||
, m_hostStr(host)
|
||||
, m_workerStop(0)
|
||||
, m_pushBlockStop(0)
|
||||
@@ -78,8 +72,6 @@ MergeMiningClientTari::MergeMiningClientTari(p2pool* pool, std::string host, con
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
uv_rwlock_init_checked(&m_chainParamsLock);
|
||||
|
||||
if (!m_server->start()) {
|
||||
throw std::exception();
|
||||
}
|
||||
@@ -89,27 +81,28 @@ MergeMiningClientTari::MergeMiningClientTari(p2pool* pool, std::string host, con
|
||||
s << "127.0.0.1:" << m_server->external_listen_port();
|
||||
|
||||
m_channelArgs.SetInt(GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS, 1000);
|
||||
|
||||
|
||||
m_channelArgs.SetInt(GRPC_ARG_MIN_RECONNECT_BACKOFF_MS, 1000);
|
||||
m_channelArgs.SetInt(GRPC_ARG_MAX_RECONNECT_BACKOFF_MS, 10000);
|
||||
|
||||
m_channelArgs.SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, -1);
|
||||
m_channelArgs.SetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, -1);
|
||||
|
||||
m_TariNode = new BaseNode::Stub(grpc::CreateCustomChannel(buf, grpc::InsecureChannelCredentials(), m_channelArgs));
|
||||
m_channel = grpc::CreateCustomChannel(buf, grpc::InsecureChannelCredentials(), m_channelArgs);
|
||||
m_TariNode.reset(new BaseNode::Stub(m_channel));
|
||||
|
||||
uv_mutex_init_checked(&m_workerLock);
|
||||
uv_cond_init_checked(&m_workerCond);
|
||||
|
||||
uv_mutex_init_checked(&m_pushBlockLock);
|
||||
uv_cond_init_checked(&m_pushBlockCond);
|
||||
|
||||
int err = uv_thread_create(&m_worker, run_wrapper, this);
|
||||
if (err) {
|
||||
LOGERR(1, "failed to start worker thread, error " << uv_err_name(err));
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
uv_mutex_init_checked(&m_pushBlockLock);
|
||||
uv_cond_init_checked(&m_pushBlockCond);
|
||||
|
||||
std::ifstream f("tari_nodes.txt");
|
||||
|
||||
if (f.is_open()) {
|
||||
@@ -166,9 +159,8 @@ MergeMiningClientTari::~MergeMiningClientTari()
|
||||
m_server->shutdown_tcp();
|
||||
delete m_server;
|
||||
|
||||
delete m_TariNode;
|
||||
|
||||
uv_rwlock_destroy(&m_chainParamsLock);
|
||||
m_TariNode.reset();
|
||||
m_channel.reset();
|
||||
|
||||
uv_mutex_destroy(&m_workerLock);
|
||||
uv_cond_destroy(&m_workerCond);
|
||||
@@ -181,6 +173,13 @@ MergeMiningClientTari::~MergeMiningClientTari()
|
||||
|
||||
bool MergeMiningClientTari::get_params(ChainParameters& out_params) const
|
||||
{
|
||||
const grpc_connectivity_state channel_state = m_channel->GetState(false);
|
||||
|
||||
if (channel_state != GRPC_CHANNEL_READY) {
|
||||
LOGWARN(4, m_hostStr << " is not ready (" << channel_state << ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
const uint64_t t = seconds_since_epoch();
|
||||
|
||||
ReadLock lock(m_chainParamsLock);
|
||||
@@ -198,203 +197,6 @@ bool MergeMiningClientTari::get_params(ChainParameters& out_params) const
|
||||
return true;
|
||||
}
|
||||
|
||||
void MergeMiningClientTari::on_external_block(const PoolBlock& block)
|
||||
{
|
||||
#ifdef WITH_MERGE_MINING_DONATION
|
||||
// The rest of the code is needed only when this node is sending donation messages
|
||||
if (m_pool->params().m_authorKeyFile.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sanity check
|
||||
if (block.m_transactions.empty() || block.m_hashingBlob.empty() || (block.m_hashingBlob.size() > 128)) {
|
||||
LOGWARN(3, "on_external_block: sanity check failed - " << block.m_transactions.size() << " transactions, hashing blob size = " << block.m_hashingBlob.size());
|
||||
return;
|
||||
}
|
||||
|
||||
ChainParameters chain_params;
|
||||
uint64_t previous_aux_hashes[NUM_PREVIOUS_HASHES];
|
||||
{
|
||||
ReadLock lock(m_chainParamsLock);
|
||||
|
||||
chain_params = m_chainParams;
|
||||
memcpy(previous_aux_hashes, m_previousAuxHashes, sizeof(m_previousAuxHashes));
|
||||
}
|
||||
|
||||
// Don't continue if our aux chain is not there
|
||||
if (block.m_mergeMiningExtra.find(chain_params.aux_id) == block.m_mergeMiningExtra.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<hash> aux_ids;
|
||||
std::vector<AuxChainData> aux_chains;
|
||||
|
||||
// All aux chains in this block + the P2Pool sidechain
|
||||
aux_ids.reserve(block.m_mergeMiningExtra.size() + 1);
|
||||
|
||||
// All aux chains in this block
|
||||
aux_chains.reserve(block.m_mergeMiningExtra.size());
|
||||
|
||||
for (const auto& i : block.m_mergeMiningExtra) {
|
||||
const std::vector<uint8_t>& v = i.second;
|
||||
|
||||
const uint8_t* p = v.data();
|
||||
const uint8_t* e = v.data() + v.size();
|
||||
|
||||
if (p + HASH_SIZE > e) {
|
||||
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '1');
|
||||
return;
|
||||
}
|
||||
|
||||
hash data;
|
||||
memcpy(data.h, p, HASH_SIZE);
|
||||
p += HASH_SIZE;
|
||||
|
||||
difficulty_type diff;
|
||||
p = readVarint(p, e, diff.lo);
|
||||
if (!p) {
|
||||
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '2');
|
||||
return;
|
||||
}
|
||||
|
||||
p = readVarint(p, e, diff.hi);
|
||||
if (!p) {
|
||||
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '3');
|
||||
return;
|
||||
}
|
||||
|
||||
// If it's our aux chain, check that it's the same job and that there is enough PoW
|
||||
if (i.first == chain_params.aux_id) {
|
||||
if ((data != chain_params.aux_hash) || (diff != chain_params.aux_diff)) {
|
||||
uint32_t index = std::numeric_limits<uint32_t>::max();
|
||||
|
||||
for (uint32_t k = 0; k < NUM_PREVIOUS_HASHES; ++k) {
|
||||
if (previous_aux_hashes[k] == *data.u64()) {
|
||||
index = k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_previousAuxHashesFoundIndex = index;
|
||||
|
||||
if (index == std::numeric_limits<uint32_t>::max()) {
|
||||
LOGINFO(4, "External aux job solution found, but it's for another miner");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
LOGINFO(4, "External aux job solution found, but it's stale");
|
||||
chain_params.aux_hash = data;
|
||||
chain_params.aux_diff = diff;
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_previousAuxHashesFoundIndex = std::numeric_limits<uint32_t>::max();
|
||||
}
|
||||
|
||||
if (!diff.check_pow(block.m_powHash)) {
|
||||
LOGINFO(4, "External aux job solution found, but it doesn't have enough PoW (block diff = " << block.m_difficulty << ", Tari diff = " << diff << ')');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
aux_ids.emplace_back(i.first);
|
||||
aux_chains.emplace_back(i.first, data, diff);
|
||||
}
|
||||
|
||||
aux_ids.emplace_back(m_pool->side_chain().consensus_hash());
|
||||
|
||||
LOGINFO(0, log::LightGreen() << "External aux job solution found. Processing it!");
|
||||
|
||||
// coinbase_merkle_proof
|
||||
|
||||
std::vector<std::vector<hash>> tree;
|
||||
|
||||
merkle_hash_full_tree(block.m_transactions, tree);
|
||||
|
||||
std::vector<hash> proof;
|
||||
uint32_t path;
|
||||
|
||||
if (!get_merkle_proof(tree, block.m_transactions[0], proof, path)) {
|
||||
LOGWARN(3, "on_external_block: get_merkle_proof failed for coinbase transaction");
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> coinbase_merkle_proof;
|
||||
for (const hash& h : proof) {
|
||||
coinbase_merkle_proof.insert(coinbase_merkle_proof.end(), h.h, h.h + HASH_SIZE);
|
||||
}
|
||||
|
||||
// hashing_blob
|
||||
|
||||
uint8_t hashing_blob[128] = {};
|
||||
memcpy(hashing_blob, block.m_hashingBlob.data(), block.m_hashingBlob.size());
|
||||
|
||||
// nonce_offset and blob
|
||||
|
||||
size_t header_size = 0;
|
||||
const std::vector<uint8_t> blob = block.serialize_mainchain_data(&header_size);
|
||||
|
||||
if (header_size <= NONCE_SIZE) {
|
||||
LOGWARN(3, "on_external_block: invalid header_size");
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32_t nonce_offset = static_cast<uint32_t>(header_size - NONCE_SIZE);
|
||||
|
||||
// aux_merkle_proof, aux_merkle_proof_path
|
||||
|
||||
std::vector<hash> aux_merkle_proof;
|
||||
uint32_t aux_merkle_proof_path = 0;
|
||||
|
||||
const hash sidechain_id = block.m_sidechainId;
|
||||
const uint32_t n_aux_chains = static_cast<uint32_t>(block.m_mergeMiningExtra.size() + 1);
|
||||
|
||||
std::vector<hash> hashes(n_aux_chains);
|
||||
|
||||
uint32_t aux_nonce;
|
||||
if (!find_aux_nonce(aux_ids, aux_nonce, 1000)) {
|
||||
LOGWARN(3, "on_external_block: failed to find aux_nonce");
|
||||
return;
|
||||
}
|
||||
|
||||
for (const AuxChainData& aux_data : aux_chains) {
|
||||
const uint32_t aux_slot = get_aux_slot(aux_data.unique_id, aux_nonce, n_aux_chains);
|
||||
|
||||
if (!hashes[aux_slot].empty()) {
|
||||
LOGWARN(3, "on_external_block: found an incorrect aux_nonce " << '1');
|
||||
return;
|
||||
}
|
||||
|
||||
hashes[aux_slot] = aux_data.data;
|
||||
}
|
||||
|
||||
const uint32_t aux_slot = get_aux_slot(m_pool->side_chain().consensus_hash(), aux_nonce, n_aux_chains);
|
||||
|
||||
if (!hashes[aux_slot].empty()) {
|
||||
LOGWARN(3, "on_external_block: found an incorrect aux_nonce " << '2');
|
||||
return;
|
||||
}
|
||||
|
||||
hashes[aux_slot] = sidechain_id;
|
||||
|
||||
merkle_hash_full_tree(hashes, tree);
|
||||
|
||||
if (tree.empty() || tree.back().empty() || (tree.back().front() != block.m_merkleRoot)) {
|
||||
LOGWARN(3, "on_external_block: merkle root didn't match");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!get_merkle_proof(tree, chain_params.aux_hash, aux_merkle_proof, aux_merkle_proof_path)) {
|
||||
LOGWARN(3, "on_external_block: get_merkle_proof failed for the aux hash");
|
||||
return;
|
||||
}
|
||||
|
||||
submit_solution(coinbase_merkle_proof, hashing_blob, nonce_offset, block.m_seed, blob, aux_merkle_proof, aux_merkle_proof_path);
|
||||
#else // WITH_MERGE_MINING_DONATION
|
||||
(void) block;
|
||||
#endif // WITH_MERGE_MINING_DONATION
|
||||
}
|
||||
|
||||
void MergeMiningClientTari::submit_solution(const std::vector<uint8_t>& coinbase_merkle_proof, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path)
|
||||
{
|
||||
Block block;
|
||||
@@ -490,10 +292,10 @@ void MergeMiningClientTari::submit_solution(const std::vector<uint8_t>& coinbase
|
||||
data.append(reinterpret_cast<const char*>(keccak_state.data()), sizeof(keccak_state));
|
||||
|
||||
// coinbase_tx_hasher.offset
|
||||
data.append(1, static_cast<uint8_t>(offset));
|
||||
data.append(1, static_cast<char>(static_cast<uint8_t>(offset)));
|
||||
|
||||
// coinbase_tx_hasher.rate
|
||||
data.append(1, static_cast<uint8_t>(KeccakParams::HASH_DATA_AREA));
|
||||
data.append(1, static_cast<char>(static_cast<uint8_t>(KeccakParams::HASH_DATA_AREA)));
|
||||
|
||||
// coinbase_tx_hasher.mode
|
||||
data.append(1, 1);
|
||||
@@ -505,7 +307,7 @@ void MergeMiningClientTari::submit_solution(const std::vector<uint8_t>& coinbase
|
||||
// aux_chain_merkle_proof
|
||||
data.append(1, static_cast<char>(merkle_proof.size()));
|
||||
data.append(reinterpret_cast<const char*>(merkle_proof.data()), merkle_proof.size() * HASH_SIZE);
|
||||
writeVarint(merkle_proof_path, [&data](uint8_t value) { data.append(1, value); });
|
||||
writeVarint(merkle_proof_path, [&data](uint8_t value) { data.append(1, static_cast<char>(value)); });
|
||||
|
||||
pow->set_pow_data(data);
|
||||
}
|
||||
@@ -606,12 +408,31 @@ template<> struct log::Stream::Entry<TariAmount>
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct log::Stream::Entry<grpc_connectivity_state>
|
||||
{
|
||||
static NOINLINE void put(grpc_connectivity_state value, Stream* wrapper)
|
||||
{
|
||||
switch (value) {
|
||||
#define X(name) case GRPC_CHANNEL_##name: *wrapper << #name; return;
|
||||
X(IDLE)
|
||||
X(CONNECTING)
|
||||
X(READY)
|
||||
X(TRANSIENT_FAILURE)
|
||||
X(SHUTDOWN)
|
||||
#undef X
|
||||
}
|
||||
*wrapper << "unknown (" << static_cast<int>(value) << ')';
|
||||
}
|
||||
};
|
||||
|
||||
void MergeMiningClientTari::print_status() const
|
||||
{
|
||||
const grpc_connectivity_state channel_state = m_channel->GetState(false);
|
||||
|
||||
ReadLock lock(m_chainParamsLock);
|
||||
|
||||
LOGINFO(0, "status" <<
|
||||
"\nHost = " << m_hostStr <<
|
||||
"\nHost = " << m_hostStr << " (" << channel_state << ')' <<
|
||||
"\nWallet = " << m_auxWallet <<
|
||||
"\nHeight = " << m_tariJobParams.height <<
|
||||
"\nDifficulty = " << m_tariJobParams.diff <<
|
||||
@@ -622,12 +443,15 @@ void MergeMiningClientTari::print_status() const
|
||||
|
||||
void MergeMiningClientTari::api_status(log::Stream& s) const
|
||||
{
|
||||
const grpc_connectivity_state channel_state = m_channel->GetState(false);
|
||||
|
||||
ReadLock lock(m_chainParamsLock);
|
||||
|
||||
s << '{'
|
||||
<< "\"api\":\"Tari gRPC\","
|
||||
<< "\"id\":\"" << m_chainParams.aux_id << "\","
|
||||
<< "\"host\":\"" << m_hostStr << "\","
|
||||
<< "\"channel_state\":\"" << channel_state << "\","
|
||||
<< "\"wallet\":\"" << m_auxWallet << "\","
|
||||
<< "\"height\":" << m_tariJobParams.height << ","
|
||||
<< "\"difficulty\":" << m_tariJobParams.diff << ","
|
||||
@@ -681,7 +505,9 @@ void MergeMiningClientTari::run()
|
||||
const grpc::Status get_tip_info_status = m_TariNode->GetTipInfo(&get_tip_info_ctx, get_tip_info_request, &cur_tip_info);
|
||||
|
||||
if (!get_tip_info_status.ok()) {
|
||||
LOGWARN(4, "GetTipInfo failed: " << get_tip_info_status.error_message());
|
||||
const grpc_connectivity_state channel_state = m_channel->GetState(false);
|
||||
LOGWARN(4, "GetTipInfo failed: " << get_tip_info_status.error_message() << ", channel state = " << channel_state);
|
||||
|
||||
if (!get_tip_info_status.error_details().empty()) {
|
||||
LOGWARN(4, "GetTipInfo failed: " << get_tip_info_status.error_details());
|
||||
}
|
||||
@@ -760,7 +586,7 @@ void MergeMiningClientTari::run()
|
||||
|
||||
const uint32_t index = (m_previousAuxHashesIndex++) % NUM_PREVIOUS_HASHES;
|
||||
|
||||
m_previousAuxHashes[index] = *m_chainParams.aux_hash.u64();
|
||||
m_previousAuxHashes[index] = m_chainParams.aux_hash;
|
||||
m_previousTariBlocks[index] = std::move(m_tariBlock);
|
||||
|
||||
std::copy(mm_hash.begin(), mm_hash.end(), m_chainParams.aux_hash.h);
|
||||
@@ -803,8 +629,8 @@ void MergeMiningClientTari::run()
|
||||
// TariServer and TariClient are simply a proxy from a localhost TCP port to the external Tari node
|
||||
// This is needed for SOCKS5 proxy support (gRPC library doesn't support it natively)
|
||||
|
||||
MergeMiningClientTari::TariServer::TariServer(const std::string& socks5Proxy)
|
||||
: TCPServer(1, MergeMiningClientTari::TariClient::allocate, socks5Proxy)
|
||||
MergeMiningClientTari::TariServer::TariServer(const std::string& socks5Proxy, Params::ProxyType socks5ProxyType)
|
||||
: TCPServer(1, MergeMiningClientTari::TariClient::allocate, socks5Proxy, socks5ProxyType)
|
||||
, m_TariNodeIsV6(false)
|
||||
, m_TariNodeHost()
|
||||
, m_TariNodePort(0)
|
||||
@@ -819,7 +645,7 @@ bool MergeMiningClientTari::TariServer::start()
|
||||
std::mt19937_64 rng(rd());
|
||||
|
||||
for (size_t i = 0; i < 10; ++i) {
|
||||
if (start_listening(false, "127.0.0.1", 49152 + (rng() % 16384))) {
|
||||
if (start_listening(false, "127.0.0.1", 49152 + static_cast<int>((rng() % 16384)))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -849,7 +675,7 @@ bool MergeMiningClientTari::TariServer::connect_upstream(TariClient* downstream)
|
||||
|
||||
upstream->m_owner = this;
|
||||
upstream->m_port = port;
|
||||
upstream->m_isV6 = is_v6;
|
||||
upstream->m_addressType = is_v6 ? Client::AddressType::IPv6 : Client::AddressType::IPv4;
|
||||
|
||||
if (!str_to_ip(is_v6, ip.c_str(), upstream->m_addr)) {
|
||||
return_client(upstream);
|
||||
@@ -934,6 +760,10 @@ bool MergeMiningClientTari::TariClient::on_connect()
|
||||
// Check if the incoming connection (downstream) has already sent something that needs to be relayed
|
||||
TariClient* downstream = m_pairedClient;
|
||||
|
||||
if (!downstream) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::vector<uint8_t>& v = downstream->m_pendingData;
|
||||
|
||||
if (!v.empty()) {
|
||||
@@ -1021,6 +851,8 @@ void MergeMiningClientTari::push_blocks_to(const std::string& node_address)
|
||||
LOGINFO(4, node_address << " is at block height " << tip_info.metadata().best_block_height());
|
||||
}
|
||||
|
||||
std::string prev_header_hash;
|
||||
|
||||
while (!m_pushBlockStop) {
|
||||
Block block;
|
||||
{
|
||||
@@ -1035,6 +867,13 @@ void MergeMiningClientTari::push_blocks_to(const std::string& node_address)
|
||||
}
|
||||
|
||||
const std::string& h = block.header().hash();
|
||||
|
||||
// Don't push the same block twice
|
||||
if (h == prev_header_hash) {
|
||||
continue;
|
||||
}
|
||||
prev_header_hash = h;
|
||||
|
||||
LOGINFO(4, "Pushing block " << log::hex_buf(h.data(), h.size()) << " to " << node_address);
|
||||
|
||||
grpc::ClientContext ctx;
|
||||
@@ -1055,4 +894,9 @@ void MergeMiningClientTari::push_blocks_to(const std::string& node_address)
|
||||
}
|
||||
}
|
||||
|
||||
const char* MergeMiningClientTari::get_log_category() const
|
||||
{
|
||||
return log_category_prefix;
|
||||
}
|
||||
|
||||
} // namespace p2pool
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,7 +25,7 @@ namespace p2pool {
|
||||
class p2pool;
|
||||
struct PoolBlock;
|
||||
|
||||
class MergeMiningClientTari : public IMergeMiningClient, public nocopy_nomove
|
||||
class MergeMiningClientTari : public MergeMiningClientShared
|
||||
{
|
||||
public:
|
||||
MergeMiningClientTari(p2pool* pool, std::string host, const std::string& wallet);
|
||||
@@ -34,33 +34,18 @@ public:
|
||||
static constexpr char TARI_PREFIX[] = "tari://";
|
||||
|
||||
bool get_params(ChainParameters& out_params) const override;
|
||||
void on_external_block(const PoolBlock& block) override;
|
||||
void submit_solution(const std::vector<uint8_t>& coinbase_merkle_proof, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) override;
|
||||
|
||||
void print_status() const override;
|
||||
void api_status(log::Stream&) const override;
|
||||
|
||||
const char* get_log_category() const override;
|
||||
|
||||
private:
|
||||
mutable uv_rwlock_t m_chainParamsLock;
|
||||
ChainParameters m_chainParams;
|
||||
|
||||
uint64_t m_chainParamsTimestamp;
|
||||
|
||||
enum {
|
||||
NUM_PREVIOUS_HASHES = 8,
|
||||
};
|
||||
|
||||
uint64_t m_previousAuxHashes[NUM_PREVIOUS_HASHES];
|
||||
tari::rpc::Block m_previousTariBlocks[NUM_PREVIOUS_HASHES];
|
||||
uint32_t m_previousAuxHashesIndex;
|
||||
|
||||
std::atomic<uint32_t> m_previousAuxHashesFoundIndex;
|
||||
|
||||
tari::rpc::Block m_tariBlock;
|
||||
|
||||
std::string m_auxWallet;
|
||||
p2pool* m_pool;
|
||||
|
||||
struct TariJobParams
|
||||
{
|
||||
uint64_t height;
|
||||
@@ -83,7 +68,7 @@ private:
|
||||
|
||||
struct TariServer : public TCPServer
|
||||
{
|
||||
explicit TariServer(const std::string& socks5Proxy);
|
||||
TariServer(const std::string& socks5Proxy, Params::ProxyType socks5ProxyType);
|
||||
~TariServer() {}
|
||||
|
||||
[[nodiscard]] bool start();
|
||||
@@ -103,7 +88,8 @@ private:
|
||||
const std::string m_hostStr;
|
||||
|
||||
grpc::ChannelArguments m_channelArgs;
|
||||
tari::rpc::BaseNode::Stub* m_TariNode;
|
||||
std::shared_ptr<grpc::Channel> m_channel;
|
||||
std::unique_ptr<tari::rpc::BaseNode::Stub> m_TariNode;
|
||||
|
||||
struct TariClient : public TCPServer::Client
|
||||
{
|
||||
|
||||
+96
-3
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -128,6 +128,98 @@ void merkle_hash_full_tree(const std::vector<hash>& hashes, std::vector<std::vec
|
||||
}
|
||||
}
|
||||
|
||||
bool merkle_hash_with_proof(const std::vector<hash>& hashes, const hash& hash_to_prove, std::vector<hash>& proof, uint32_t& path, root_hash& root)
|
||||
{
|
||||
for (size_t i = 0, n = hashes.size(); i < n; ++i) {
|
||||
if (hashes[i] == hash_to_prove) {
|
||||
return merkle_hash_with_proof(hashes, i, proof, path, root);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool merkle_hash_with_proof(const std::vector<hash>& hashes, size_t index_to_prove, std::vector<hash>& proof, uint32_t& path, root_hash& root)
|
||||
{
|
||||
const size_t count = hashes.size();
|
||||
|
||||
proof.clear();
|
||||
path = 0;
|
||||
|
||||
if ((count == 0) || (index_to_prove >= count)) {
|
||||
root.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
const uint8_t* h = hashes[0].h;
|
||||
|
||||
if (count == 1) {
|
||||
root = root_hash(hashes[0]);
|
||||
}
|
||||
else if (count == 2) {
|
||||
keccak(h, HASH_SIZE * 2, root.h);
|
||||
|
||||
proof.reserve(1);
|
||||
proof.emplace_back(hashes[index_to_prove ^ 1]);
|
||||
path = static_cast<uint32_t>(index_to_prove);
|
||||
}
|
||||
else {
|
||||
hash h2 = hashes[index_to_prove];
|
||||
|
||||
size_t cnt = 1, proof_max_size = 0;
|
||||
do {
|
||||
cnt <<= 1;
|
||||
++proof_max_size;
|
||||
} while (cnt <= count);
|
||||
cnt >>= 1;
|
||||
|
||||
proof.reserve(proof_max_size);
|
||||
|
||||
std::vector<hash> tmp_ints(cnt);
|
||||
|
||||
const size_t k = cnt * 2 - count;
|
||||
memcpy(tmp_ints.data(), h, k * HASH_SIZE);
|
||||
|
||||
for (size_t i = k, j = k; j < cnt; i += 2, ++j) {
|
||||
keccak(h + i * HASH_SIZE, HASH_SIZE * 2, tmp_ints[j].h);
|
||||
|
||||
if (hashes[i] == h2) {
|
||||
proof.emplace_back(hashes[i + 1]);
|
||||
h2 = tmp_ints[j];
|
||||
}
|
||||
else if (hashes[i + 1] == h2) {
|
||||
proof.emplace_back(hashes[i]);
|
||||
h2 = tmp_ints[j];
|
||||
path = 1;
|
||||
}
|
||||
}
|
||||
|
||||
while (cnt >= 2) {
|
||||
cnt >>= 1;
|
||||
for (size_t i = 0, j = 0; j < cnt; i += 2, ++j) {
|
||||
hash tmp;
|
||||
keccak(tmp_ints[i].h, HASH_SIZE * 2, tmp.h);
|
||||
|
||||
if (tmp_ints[i] == h2) {
|
||||
proof.emplace_back(tmp_ints[i + 1]);
|
||||
h2 = tmp;
|
||||
path <<= 1;
|
||||
}
|
||||
else if (tmp_ints[i + 1] == h2) {
|
||||
proof.emplace_back(tmp_ints[i]);
|
||||
h2 = tmp;
|
||||
path = (path << 1) | 1;
|
||||
}
|
||||
|
||||
tmp_ints[j] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
root = static_cast<root_hash>(tmp_ints[0]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool get_merkle_proof(const std::vector<std::vector<hash>>& tree, const hash& h, std::vector<hash>& proof, uint32_t& path)
|
||||
{
|
||||
if (tree.empty()) {
|
||||
@@ -153,9 +245,10 @@ bool get_merkle_proof(const std::vector<std::vector<hash>>& tree, const hash& h,
|
||||
if (count == 1) {
|
||||
return true;
|
||||
}
|
||||
else if (count == 2) {
|
||||
|
||||
if (count == 2) {
|
||||
proof.emplace_back(hashes[index ^ 1]);
|
||||
path = index & 1;
|
||||
path = static_cast<uint32_t>(index);
|
||||
}
|
||||
else {
|
||||
size_t cnt = 1;
|
||||
|
||||
+4
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -22,6 +22,9 @@ namespace p2pool {
|
||||
void merkle_hash(const std::vector<hash>& hashes, root_hash& root);
|
||||
void merkle_hash_full_tree(const std::vector<hash>& hashes, std::vector<std::vector<hash>>& tree);
|
||||
|
||||
bool merkle_hash_with_proof(const std::vector<hash>& hashes, const hash& hash_to_prove, std::vector<hash>& proof, uint32_t& path, root_hash& root);
|
||||
bool merkle_hash_with_proof(const std::vector<hash>& hashes, size_t index_to_prove, std::vector<hash>& proof, uint32_t& path, root_hash& root);
|
||||
|
||||
bool get_merkle_proof(const std::vector<std::vector<hash>>& tree, const hash& h, std::vector<hash>& proof, uint32_t& path);
|
||||
|
||||
root_hash get_root_from_proof(hash h, const std::vector<hash>& proof, size_t index, size_t count);
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -121,7 +121,7 @@ void Miner::on_block(const BlockTemplate& block)
|
||||
m_totalHashes += hash_count;
|
||||
|
||||
if (m_pool->api() && m_pool->params().m_localStats && !m_pool->stopped()) {
|
||||
const double block_reward_share_percent = m_pool->side_chain().get_reward_share(m_pool->params().m_wallet) * 100.0;
|
||||
const double block_reward_share_percent = m_pool->side_chain().get_reward_share(m_pool->params().m_miningWallet) * 100.0;
|
||||
|
||||
m_pool->api()->set(p2pool_api::Category::LOCAL, "miner",
|
||||
[cur_ts, hash_count, dt, block_reward_share_percent, this](log::Stream& s)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
+435
-97
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "rapidjson_wrapper.h"
|
||||
#include "merge_mining_client.h"
|
||||
#include "sha256.h"
|
||||
#include "i2p.h"
|
||||
|
||||
#ifdef WITH_TLS
|
||||
#include <openssl/curve25519.h>
|
||||
@@ -47,9 +48,11 @@
|
||||
LOG_CATEGORY(P2PServer)
|
||||
|
||||
static constexpr char saved_peer_list_file_name[] = "p2pool_peers.txt";
|
||||
static const char* seed_nodes[] = { "seeds.p2pool.io", "main.p2poolpeers.net", "main.gupax.io", "" };
|
||||
static const char* seed_nodes_mini[] = { "seeds-mini.p2pool.io", "mini.p2poolpeers.net", "mini.gupax.io", "" };
|
||||
static const char* seed_nodes_nano[] = { "seeds-nano.p2pool.io", "nano.p2poolpeers.net", "nano.gupax.io", ""};
|
||||
static constexpr char saved_onion_peer_list_file_name[] = "p2pool_onion_peers.txt";
|
||||
static constexpr char saved_i2p_peer_list_file_name[] = "p2pool_i2p_peers.txt";
|
||||
static const char* seed_nodes[] = { "seeds.p2pool.io", "main.p2poolpeers.net", "" };
|
||||
static const char* seed_nodes_mini[] = { "seeds-mini.p2pool.io", "mini.p2poolpeers.net", "" };
|
||||
static const char* seed_nodes_nano[] = { "seeds-nano.p2pool.io", "nano.p2poolpeers.net", ""};
|
||||
|
||||
static constexpr int DEFAULT_BACKLOG = 16;
|
||||
static constexpr uint64_t DEFAULT_BAN_TIME = 600;
|
||||
@@ -57,10 +60,19 @@ static constexpr uint64_t PEER_REQUEST_DELAY = 60;
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
static constexpr hash seed_onion_nodes[] = {
|
||||
from_onion_v3_const("p2pseeds5qoenuuseyuqxhzzefzxpbhiq4z4h5hfbry5dxd5y2fwudyd.onion"),
|
||||
from_onion_v3_const("p2pseedtwyepi4crkf4akceen4twejcptnsbm6gjmzdfgxua57hiijid.onion")
|
||||
};
|
||||
|
||||
static constexpr hash seed_i2p_nodes[] = {
|
||||
from_i2p_b32_const("h6jrh53yvlvzqqyy7abzjp2t4kidtheee7e7nfbynecroc7yvbjq.b32.i2p")
|
||||
};
|
||||
|
||||
P2PServer::P2PServer(p2pool* pool)
|
||||
: TCPServer(DEFAULT_BACKLOG, P2PClient::allocate, pool->params().m_socks5Proxy)
|
||||
: TCPServer(DEFAULT_BACKLOG, P2PClient::allocate, pool->params().m_socks5Proxy, pool->params().m_socks5ProxyType, pool->params().m_p2pProxyProtocol)
|
||||
, m_pool(pool)
|
||||
, m_cache(pool->params().m_blockCache ? new BlockCache() : nullptr)
|
||||
, m_cache(pool->params().m_blockCache ? new BlockCache(pool->params()) : nullptr)
|
||||
, m_cacheLoaded(false)
|
||||
, m_initialPeerList(pool->params().m_p2pPeerList)
|
||||
, m_cachedBlocks(nullptr)
|
||||
@@ -72,6 +84,9 @@ P2PServer::P2PServer(p2pool* pool)
|
||||
, m_timerInterval(2)
|
||||
, m_seenGoodPeers(false)
|
||||
, m_peerListLastSaved(0)
|
||||
, m_numOnionConnections(0)
|
||||
, m_numI2PConnections(0)
|
||||
, m_isI2P(pool->params().m_socks5ProxyType == Params::ProxyType::I2P)
|
||||
, m_lookForMissingBlocks(true)
|
||||
, m_fastestPeer(nullptr)
|
||||
, m_newP2PoolVersionDetected(false)
|
||||
@@ -86,7 +101,10 @@ P2PServer::P2PServer(p2pool* pool)
|
||||
// Diffuse the initial state in case it has low quality
|
||||
m_rng.discard(10000);
|
||||
|
||||
m_peerId = m_rng();
|
||||
// Make sure peer IDs are not 0
|
||||
do { m_peerId = m_rng(); } while (!m_peerId);
|
||||
do { m_peerId_TOR = m_rng(); } while (!m_peerId_TOR);
|
||||
do { m_peerId_I2P = m_rng(); } while (!m_peerId_I2P);
|
||||
|
||||
const Params& params = pool->params();
|
||||
|
||||
@@ -274,7 +292,15 @@ void P2PServer::connect_to_peers(const std::string& peer_list)
|
||||
parse_address_list(peer_list,
|
||||
[this](bool is_v6, const std::string& /*address*/, std::string ip, int port)
|
||||
{
|
||||
if (!m_pool->params().m_dns || resolve_host(ip, is_v6)) {
|
||||
const Params& params = m_pool->params();
|
||||
|
||||
if (!m_socks5Proxy.empty() && (ip.find_first_not_of("0123456789.:") != std::string::npos)) {
|
||||
// Assume it's a domain name and use the proxy to resolve it
|
||||
if (!connect_to_peer(ip, port)) {
|
||||
LOGERR(5, "connect_to_peers: failed to connect to " << ip);
|
||||
}
|
||||
}
|
||||
else if (!params.m_noClearnetP2P && (!params.m_dns || resolve_host(ip, is_v6))) {
|
||||
if (!connect_to_peer(is_v6, ip.c_str(), port)) {
|
||||
LOGERR(5, "connect_to_peers: failed to connect to " << ip);
|
||||
}
|
||||
@@ -311,15 +337,23 @@ void P2PServer::update_peer_connections()
|
||||
uint64_t newer_version_p2pool = 0;
|
||||
|
||||
unordered_set<raw_ip> connected_clients;
|
||||
unordered_set<std::string_view> connected_clients_domain;
|
||||
|
||||
connected_clients.reserve(m_numConnections);
|
||||
|
||||
if (!m_socks5Proxy.empty()) {
|
||||
connected_clients_domain.reserve(m_numConnections);
|
||||
}
|
||||
|
||||
for (P2PClient* client = static_cast<P2PClient*>(m_connectedClientsList->m_next); client != m_connectedClientsList; client = static_cast<P2PClient*>(client->m_next)) {
|
||||
const int timeout = client->m_handshakeComplete ? 300 : 10;
|
||||
if ((cur_time >= client->m_lastAlive + timeout) && (client->m_socks5ProxyState == Client::Socks5ProxyState::Default)) {
|
||||
const uint64_t idle_time = static_cast<uint64_t>(cur_time - client->m_lastAlive);
|
||||
LOGWARN(5, "peer " << static_cast<char*>(client->m_addrString) << " has been idle for " << idle_time << " seconds, disconnecting");
|
||||
client->close();
|
||||
continue;
|
||||
if (client->m_lastAlive && (cur_time >= client->m_lastAlive + timeout)) {
|
||||
if (client->m_socks5ProxyState == Client::Socks5ProxyState::Default) {
|
||||
const uint64_t idle_time = static_cast<uint64_t>(cur_time - client->m_lastAlive);
|
||||
LOGWARN(5, "peer " << static_cast<char*>(client->m_addrString) << " has been idle for " << idle_time << " seconds, disconnecting");
|
||||
client->close();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (client->m_handshakeComplete && client->m_lastBroadcastTimestamp) {
|
||||
@@ -337,7 +371,19 @@ void P2PServer::update_peer_connections()
|
||||
}
|
||||
}
|
||||
|
||||
connected_clients.insert(client->m_addr);
|
||||
if ((client->m_addressType == Client::AddressType::IPv4) || (client->m_addressType == Client::AddressType::IPv6)) {
|
||||
connected_clients.insert(client->m_addr);
|
||||
}
|
||||
else if (!m_socks5Proxy.empty() && (client->m_addressType == Client::AddressType::DomainName)) {
|
||||
const char* c = strchr(client->m_addrString, ':');
|
||||
if (c) {
|
||||
connected_clients_domain.emplace(client->m_addrString, c - client->m_addrString);
|
||||
}
|
||||
else {
|
||||
connected_clients_domain.emplace(client->m_addrString);
|
||||
}
|
||||
}
|
||||
|
||||
if (client->is_good()) {
|
||||
has_good_peers = true;
|
||||
if ((client->m_pingTime >= 0) && (!m_fastestPeer || (m_fastestPeer->m_pingTime > client->m_pingTime))) {
|
||||
@@ -388,19 +434,87 @@ void P2PServer::update_peer_connections()
|
||||
N = static_cast<uint32_t>(peer_list.size());
|
||||
}
|
||||
|
||||
uint32_t num_outgoing = m_numConnections - m_numIncomingConnections;
|
||||
|
||||
// Try to have at least N/2 (or N if clearnet P2P is disabled) outgoing onion connections
|
||||
if (!m_socks5Proxy.empty() && (m_socks5ProxyType == Params::ProxyType::TOR)) {
|
||||
std::vector<hash> pubkeys = m_pool->side_chain().seen_onion_pubkeys();
|
||||
|
||||
// Add seed nodes
|
||||
pubkeys.insert(pubkeys.end(), seed_onion_nodes, seed_onion_nodes + array_size(seed_onion_nodes));
|
||||
|
||||
const uint32_t n = m_pool->params().m_noClearnetP2P ? N : (N / 2);
|
||||
|
||||
for (uint32_t i = m_numOnionConnections; (i < n) && !pubkeys.empty();) {
|
||||
const uint64_t k = get_random64() % pubkeys.size();
|
||||
const std::string addr = to_onion_v3(pubkeys[k]);
|
||||
|
||||
int port = DEFAULT_P2P_PORT_ONION;
|
||||
|
||||
for (const hash& seed_onion : seed_onion_nodes) {
|
||||
if (pubkeys[k] == seed_onion) {
|
||||
const SideChain& s = m_pool->side_chain();
|
||||
port = s.is_mini() ? DEFAULT_P2P_PORT_MINI : (s.is_nano() ? DEFAULT_P2P_PORT_NANO : DEFAULT_P2P_PORT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((connected_clients_domain.find(addr) == connected_clients_domain.end()) && connect_to_peer(addr, port)) {
|
||||
++i;
|
||||
++num_outgoing;
|
||||
}
|
||||
|
||||
pubkeys[k] = pubkeys.back();
|
||||
pubkeys.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
// Try to have at least N/2 (or N if clearnet P2P is disabled) outgoing I2P connections
|
||||
if (!m_socks5Proxy.empty() && (m_socks5ProxyType == Params::ProxyType::I2P)) {
|
||||
std::vector<hash> dest_hashes = m_pool->side_chain().seen_i2p_dest_hashes();
|
||||
|
||||
// Add seed nodes
|
||||
dest_hashes.insert(dest_hashes.end(), seed_i2p_nodes, seed_i2p_nodes + array_size(seed_i2p_nodes));
|
||||
|
||||
const uint32_t n = m_pool->params().m_noClearnetP2P ? N : (N / 2);
|
||||
|
||||
for (uint32_t i = m_numI2PConnections; (i < n) && !dest_hashes.empty();) {
|
||||
const uint64_t k = get_random64() % dest_hashes.size();
|
||||
const std::string addr = to_i2p_b32(dest_hashes[k]);
|
||||
|
||||
int port = DEFAULT_P2P_PORT_I2P;
|
||||
|
||||
for (const hash& seed_i2p : seed_i2p_nodes) {
|
||||
if (dest_hashes[k] == seed_i2p) {
|
||||
const SideChain& s = m_pool->side_chain();
|
||||
port = s.is_mini() ? DEFAULT_P2P_PORT_MINI : (s.is_nano() ? DEFAULT_P2P_PORT_NANO : DEFAULT_P2P_PORT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((connected_clients_domain.find(addr) == connected_clients_domain.end()) && connect_to_peer(addr, port)) {
|
||||
++i;
|
||||
++num_outgoing;
|
||||
}
|
||||
|
||||
dest_hashes[k] = dest_hashes.back();
|
||||
dest_hashes.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
// Try to have at least N outgoing connections (N defaults to 10, can be set via --out-peers command line parameter)
|
||||
for (uint32_t i = m_numConnections - m_numIncomingConnections; (i < N) && !peer_list.empty();) {
|
||||
const uint64_t k = get_random64() % peer_list.size();
|
||||
const Peer& peer = peer_list[k];
|
||||
if (!m_pool->params().m_noClearnetP2P) {
|
||||
while ((num_outgoing < N) && !peer_list.empty()) {
|
||||
const uint64_t k = get_random64() % peer_list.size();
|
||||
const Peer& peer = peer_list[k];
|
||||
|
||||
if ((connected_clients.find(peer.m_addr) == connected_clients.end()) && connect_to_peer(peer.m_isV6, peer.m_addr, peer.m_port)) {
|
||||
++i;
|
||||
}
|
||||
if ((connected_clients.find(peer.m_addr) == connected_clients.end()) && connect_to_peer(peer.m_isV6, peer.m_addr, peer.m_port)) {
|
||||
++num_outgoing;
|
||||
}
|
||||
|
||||
if (k + 1 < peer_list.size()) {
|
||||
peer_list[k] = peer_list.back();
|
||||
peer_list.pop_back();
|
||||
}
|
||||
peer_list.pop_back();
|
||||
}
|
||||
|
||||
if (!has_good_peers && ((m_timerCounter % 10) == 0) && (SideChain::network_type() == NetworkType::Mainnet)) {
|
||||
@@ -492,7 +606,9 @@ void P2PServer::save_peer_list_async()
|
||||
|
||||
void P2PServer::save_peer_list()
|
||||
{
|
||||
const std::string path = DATA_DIR + saved_peer_list_file_name;
|
||||
const Params& params = m_pool->params();
|
||||
|
||||
const std::string path = params.m_dataDir + saved_peer_list_file_name;
|
||||
|
||||
std::ofstream f(path, std::ios::binary);
|
||||
|
||||
@@ -533,6 +649,53 @@ void P2PServer::save_peer_list()
|
||||
f.close();
|
||||
|
||||
LOGINFO(5, "peer list saved (" << peer_list.size() << " peers)");
|
||||
|
||||
const SideChain& s = m_pool->side_chain();
|
||||
|
||||
if (s.onion_pubkeys_count() > 0) {
|
||||
const std::string onion_path = params.m_dataDir + saved_onion_peer_list_file_name;
|
||||
|
||||
f.open(onion_path, std::ios::binary);
|
||||
|
||||
if (!f.is_open()) {
|
||||
LOGERR(1, "failed to save onion peer list " << onion_path << ": error " << errno);
|
||||
}
|
||||
else {
|
||||
const std::vector<hash> pubkeys = s.seen_onion_pubkeys();
|
||||
|
||||
for (const hash& h : pubkeys) {
|
||||
f << to_onion_v3(h) << '\n';
|
||||
}
|
||||
|
||||
f.flush();
|
||||
f.close();
|
||||
|
||||
LOGINFO(5, "onion peer list saved (" << pubkeys.size() << " peers)");
|
||||
}
|
||||
}
|
||||
|
||||
if (s.i2p_dest_hashes_count() > 0) {
|
||||
const std::string i2p_path = params.m_dataDir + saved_i2p_peer_list_file_name;
|
||||
|
||||
f.open(i2p_path, std::ios::binary);
|
||||
|
||||
if (!f.is_open()) {
|
||||
LOGERR(1, "failed to save I2P peer list " << i2p_path << ": error " << errno);
|
||||
}
|
||||
else {
|
||||
const std::vector<hash> dest_hashes = s.seen_i2p_dest_hashes();
|
||||
|
||||
for (const hash& h : dest_hashes) {
|
||||
f << to_i2p_b32(h) << '\n';
|
||||
}
|
||||
|
||||
f.flush();
|
||||
f.close();
|
||||
|
||||
LOGINFO(5, "I2P peer list saved (" << dest_hashes.size() << " peers)");
|
||||
}
|
||||
}
|
||||
|
||||
m_peerListLastSaved = seconds_since_epoch();
|
||||
}
|
||||
|
||||
@@ -616,34 +779,82 @@ void P2PServer::load_peer_list()
|
||||
}
|
||||
};
|
||||
|
||||
SideChain& s = m_pool->side_chain();
|
||||
|
||||
if (m_pool->params().m_dns) {
|
||||
if (m_pool->side_chain().is_default()) {
|
||||
if (s.is_default()) {
|
||||
load_from_seed_nodes(seed_nodes, DEFAULT_P2P_PORT);
|
||||
}
|
||||
else if (m_pool->side_chain().is_mini()) {
|
||||
else if (s.is_mini()) {
|
||||
load_from_seed_nodes(seed_nodes_mini, DEFAULT_P2P_PORT_MINI);
|
||||
}
|
||||
else if (m_pool->side_chain().is_nano()) {
|
||||
else if (s.is_nano()) {
|
||||
load_from_seed_nodes(seed_nodes_nano, DEFAULT_P2P_PORT_NANO);
|
||||
}
|
||||
}
|
||||
|
||||
// Finally load peers from p2pool_peers.txt
|
||||
const std::string path = DATA_DIR + saved_peer_list_file_name;
|
||||
// Finally load peers from p2pool_peers.txt and p2pool_onion_peers.txt
|
||||
std::vector<std::string> paths;
|
||||
paths.resize(Params::ProxyType::MAX);
|
||||
|
||||
std::ifstream f(path);
|
||||
if (f.is_open()) {
|
||||
std::string address;
|
||||
while (f.good()) {
|
||||
std::getline(f, address);
|
||||
if (!address.empty()) {
|
||||
if (!saved_list.empty()) {
|
||||
saved_list += ',';
|
||||
const Params& params = m_pool->params();
|
||||
|
||||
paths[Params::ProxyType::PLAIN] = params.m_dataDir + saved_peer_list_file_name;
|
||||
|
||||
if (!m_socks5Proxy.empty() && (m_socks5ProxyType == Params::ProxyType::TOR)) {
|
||||
paths[Params::ProxyType::TOR] = params.m_dataDir + saved_onion_peer_list_file_name;
|
||||
}
|
||||
|
||||
if (!m_socks5Proxy.empty() && (m_socks5ProxyType == Params::ProxyType::I2P)) {
|
||||
paths[Params::ProxyType::I2P] = params.m_dataDir + saved_i2p_peer_list_file_name;
|
||||
}
|
||||
|
||||
for (int i = Params::ProxyType::PLAIN; i < Params::ProxyType::MAX; ++i) {
|
||||
const std::string& path = paths[i];
|
||||
|
||||
if (path.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::ifstream f(path);
|
||||
|
||||
if (f.is_open()) {
|
||||
std::string address;
|
||||
std::vector<hash> pubkeys;
|
||||
|
||||
while (f.good()) {
|
||||
std::getline(f, address);
|
||||
|
||||
if (!address.empty()) {
|
||||
if (i == Params::ProxyType::TOR) {
|
||||
const hash h = from_onion_v3(address);
|
||||
if (!h.empty()) {
|
||||
pubkeys.emplace_back(h);
|
||||
}
|
||||
}
|
||||
else if (i == Params::ProxyType::I2P) {
|
||||
const hash h = from_i2p_b32(address);
|
||||
if (!h.empty()) {
|
||||
pubkeys.emplace_back(h);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!saved_list.empty()) {
|
||||
saved_list += ',';
|
||||
}
|
||||
saved_list += address;
|
||||
}
|
||||
}
|
||||
saved_list += address;
|
||||
}
|
||||
f.close();
|
||||
|
||||
if (i == Params::ProxyType::TOR) {
|
||||
s.add_onion_pubkeys(pubkeys);
|
||||
}
|
||||
else if (i == Params::ProxyType::I2P) {
|
||||
s.add_i2p_dest_hashes(pubkeys);
|
||||
}
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
|
||||
if (saved_list.empty()) {
|
||||
@@ -791,7 +1002,7 @@ void P2PServer::remove_peer_from_list(const P2PClient* client)
|
||||
|
||||
for (auto it = m_peerList.begin(); it != m_peerList.end(); ++it) {
|
||||
const Peer& p = *it;
|
||||
if ((p.m_isV6 == client->m_isV6) && (p.m_port == client->m_listenPort) && (p.m_addr == client->m_addr)) {
|
||||
if ((p.m_isV6 == client->isV6()) && (p.m_port == client->m_listenPort) && (p.m_addr == client->m_addr)) {
|
||||
m_peerList.erase(it);
|
||||
return;
|
||||
}
|
||||
@@ -842,7 +1053,7 @@ P2PServer::Broadcast::Broadcast(const PoolBlock& block, const PoolBlock* parent)
|
||||
// 0 outputs in the pruned blob
|
||||
data->pruned_blob.push_back(0);
|
||||
|
||||
const uint64_t total_reward = std::accumulate(block.m_outputs.begin(), block.m_outputs.end(), 0ULL,
|
||||
const uint64_t total_reward = std::accumulate(block.m_outputAmounts.begin(), block.m_outputAmounts.end(), 0ULL,
|
||||
[](uint64_t a, const PoolBlock::TxOutput& b)
|
||||
{
|
||||
return a + b.m_reward;
|
||||
@@ -867,7 +1078,7 @@ P2PServer::Broadcast::Broadcast(const PoolBlock& block, const PoolBlock* parent)
|
||||
data->compact_blob.reserve(data->pruned_blob.capacity() + (N - 1));
|
||||
|
||||
// Copy pruned_blob without the transaction list
|
||||
data->compact_blob.assign(data->pruned_blob.begin(), data->pruned_blob.end() - (N - 1) * HASH_SIZE);
|
||||
data->compact_blob.assign(data->pruned_blob.begin(), data->pruned_blob.end() - static_cast<uint32_t>((N - 1) * HASH_SIZE));
|
||||
|
||||
// Process transaction hashes one by one
|
||||
size_t num_found = 0;
|
||||
@@ -1082,12 +1293,19 @@ uint64_t P2PServer::get_random64()
|
||||
|
||||
void P2PServer::print_status()
|
||||
{
|
||||
const uint64_t onion_list_size = m_pool->side_chain().onion_pubkeys_count();
|
||||
const uint64_t i2p_list_size = m_pool->side_chain().i2p_dest_hashes_count();
|
||||
|
||||
MutexLock lock(m_peerListLock);
|
||||
|
||||
LOGINFO(0, "status" <<
|
||||
"\nConnections = " << m_numConnections.load() << " (" << m_numIncomingConnections.load() << " incoming)" <<
|
||||
"\nPeer list size = " << m_peerList.size() <<
|
||||
"\nUptime = " << log::Duration(seconds_since_epoch() - m_pool->start_time())
|
||||
"\nConnections = " << m_numConnections.load() <<
|
||||
" (" << m_numIncomingConnections.load() <<
|
||||
" incoming, " << m_numOnionConnections.load() << " onion, " << m_numI2PConnections.load() << " I2P)" <<
|
||||
"\nPeer list size = " << m_peerList.size() <<
|
||||
"\nOnion list size = " << onion_list_size <<
|
||||
"\nI2P list size = " << i2p_list_size <<
|
||||
"\nUptime = " << log::Duration(seconds_since_epoch() - m_pool->start_time())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1178,11 +1396,12 @@ void P2PServer::on_timer()
|
||||
return;
|
||||
}
|
||||
|
||||
++m_timerCounter;
|
||||
const uint64_t t = ++m_timerCounter;
|
||||
|
||||
if (!m_initialPeerList.empty()) {
|
||||
if ((t == 1) && !m_initialPeerList.empty()) {
|
||||
connect_to_peers(m_initialPeerList);
|
||||
m_initialPeerList.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
flush_cache();
|
||||
@@ -1416,6 +1635,7 @@ P2PServer::P2PClient::P2PClient()
|
||||
, m_lastBlockrequestTimestamp(0)
|
||||
, m_broadcastedHashes{}
|
||||
, m_broadcastedHashesIndex(0)
|
||||
, m_lastMoneroBlockBroadcastDigest{}
|
||||
{
|
||||
m_p2pReadBuf[0] = '\0';
|
||||
}
|
||||
@@ -1602,7 +1822,7 @@ void P2PServer::clean_aux_job_messages()
|
||||
|
||||
for (auto it = m_auxJobMessages.begin(); it != m_auxJobMessages.end();) {
|
||||
// Delete old messages only after 3x the timeout to give some leeway for system clock adjustments
|
||||
if (cur_time > it->second + AUX_JOB_TIMEOUT * 3) {
|
||||
if (cur_time > it->second + static_cast<uint64_t>(AUX_JOB_TIMEOUT * 3)) {
|
||||
it = m_auxJobMessages.erase(it);
|
||||
}
|
||||
else {
|
||||
@@ -1645,6 +1865,8 @@ void P2PServer::submit_monero_blocks()
|
||||
|
||||
const Params::Host& host = m_pool->current_host();
|
||||
|
||||
const uint64_t t1 = microseconds_since_epoch();
|
||||
|
||||
JSONRPCRequest::call(
|
||||
host.m_address,
|
||||
host.m_rpcPort,
|
||||
@@ -1654,10 +1876,13 @@ void P2PServer::submit_monero_blocks()
|
||||
host.m_rpcSSL,
|
||||
host.m_rpcSSL_Fingerprint,
|
||||
JSONRPCRequest::dummy_callback,
|
||||
[this](const char* data, size_t size, double)
|
||||
[this, t1](const char* data, size_t size, double)
|
||||
{
|
||||
if (size > 0) {
|
||||
LOGERR(3, "on_monero_block_broadcast: submit_block RPC request failed, error " << log::const_buf(data, size));
|
||||
LOGERR(3, "submit_monero_blocks: submit_block RPC request failed, error " << log::const_buf(data, size));
|
||||
}
|
||||
else {
|
||||
LOGINFO(4, "submit_monero_blocks: submit_block RPC completed in " << static_cast<double>(microseconds_since_epoch() - t1) / 1e3 << " ms");
|
||||
}
|
||||
|
||||
if (!m_MoneroBlocksToSubmit.empty()) {
|
||||
@@ -1707,13 +1932,19 @@ void P2PServer::broadcast_monero_block(const uint8_t* data, uint32_t data_size,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!duplicate_check_done && !store_monero_block_broadcast(data + sizeof(MoneroBlockBroadcastHeader), data_size - sizeof(MoneroBlockBroadcastHeader))) {
|
||||
hash digest;
|
||||
sha256(data + sizeof(MoneroBlockBroadcastHeader), data_size - sizeof(MoneroBlockBroadcastHeader), digest.h);
|
||||
|
||||
if (!duplicate_check_done && !store_monero_block_broadcast(digest)) {
|
||||
LOGINFO(6, "broadcast_monero_block: skipping duplicate broadcast");
|
||||
return;
|
||||
}
|
||||
|
||||
for (P2PClient* client = static_cast<P2PClient*>(m_connectedClientsList->m_next); client != m_connectedClientsList; client = static_cast<P2PClient*>(client->m_next)) {
|
||||
if ((source && (client == source)) || !client->is_good() || (client->m_protocolVersion < PROTOCOL_VERSION_1_4)) {
|
||||
if ((source && (client == source)) ||
|
||||
!client->is_good() ||
|
||||
(client->m_protocolVersion < PROTOCOL_VERSION_1_4) ||
|
||||
(client->m_lastMoneroBlockBroadcastDigest == digest)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1744,11 +1975,8 @@ void P2PServer::broadcast_monero_block(const uint8_t* data, uint32_t data_size,
|
||||
}
|
||||
}
|
||||
|
||||
bool P2PServer::store_monero_block_broadcast(const uint8_t* data, uint32_t data_size)
|
||||
bool P2PServer::store_monero_block_broadcast(const hash& digest)
|
||||
{
|
||||
hash digest;
|
||||
sha256(data, data_size, digest.h);
|
||||
|
||||
// Every message can be received from multiple peers, so broadcast it only once
|
||||
MutexLock lock(m_MoneroBlockBroadcastsLock);
|
||||
return m_MoneroBlockBroadcasts.emplace(*digest.u64(), seconds_since_epoch()).second;
|
||||
@@ -1762,8 +1990,17 @@ void P2PServer::P2PClient::reset()
|
||||
{
|
||||
P2PServer* server = static_cast<P2PServer*>(m_owner);
|
||||
|
||||
if (server && (server->m_fastestPeer == this)) {
|
||||
server->m_fastestPeer = nullptr;
|
||||
if (server) {
|
||||
if (server->m_fastestPeer == this) {
|
||||
server->m_fastestPeer = nullptr;
|
||||
}
|
||||
if ((m_addressType == AddressType::DomainName) && m_connectedTime) {
|
||||
if (server->m_isI2P == true) {
|
||||
--server->m_numI2PConnections;
|
||||
} else {
|
||||
--server->m_numOnionConnections;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Client::reset();
|
||||
@@ -1794,11 +2031,13 @@ void P2PServer::P2PClient::reset()
|
||||
h = {};
|
||||
}
|
||||
m_broadcastedHashesIndex = 0;
|
||||
|
||||
m_lastMoneroBlockBroadcastDigest = {};
|
||||
}
|
||||
|
||||
bool P2PServer::P2PClient::on_connect()
|
||||
{
|
||||
const P2PServer* server = static_cast<P2PServer*>(m_owner);
|
||||
P2PServer* server = static_cast<P2PServer*>(m_owner);
|
||||
|
||||
if (!server) {
|
||||
return false;
|
||||
@@ -1819,6 +2058,14 @@ bool P2PServer::P2PClient::on_connect()
|
||||
}
|
||||
}
|
||||
|
||||
if (m_addressType == AddressType::DomainName) {
|
||||
if (server->m_isI2P == true) {
|
||||
++server->m_numI2PConnections;
|
||||
} else {
|
||||
++server->m_numOnionConnections;
|
||||
}
|
||||
}
|
||||
|
||||
const uint64_t cur_time = seconds_since_epoch();
|
||||
m_connectedTime = cur_time;
|
||||
m_lastAlive = cur_time;
|
||||
@@ -1859,7 +2106,7 @@ bool P2PServer::P2PClient::on_read(const char* data, uint32_t size)
|
||||
const MessageId id = static_cast<MessageId>(buf[0]);
|
||||
|
||||
// Peer must complete the handshake challenge before sending any other messages
|
||||
if (!m_handshakeComplete && (id != m_expectedMessage)) {
|
||||
if ((!m_handshakeComplete || m_handshakeInvalid) && (id != m_expectedMessage)) {
|
||||
LOGWARN(5, "peer " << static_cast<char*>(m_addrString) << " didn't send handshake messages first");
|
||||
ban(DEFAULT_BAN_TIME);
|
||||
server->remove_peer_from_list(this);
|
||||
@@ -2153,7 +2400,18 @@ bool P2PServer::P2PClient::send_handshake_challenge()
|
||||
k >>= 8;
|
||||
}
|
||||
|
||||
k = owner->get_peerId();
|
||||
bool is_tor = false;
|
||||
|
||||
if ((m_addressType == AddressType::DomainName) && (strstr(m_addrString, ".onion:"))) {
|
||||
// We're connecting to an .onion address
|
||||
is_tor = true;
|
||||
}
|
||||
else if (!owner->m_pool->params().m_onionPubkey.empty() && m_isIncoming && (m_addressType != AddressType::DomainName) && m_addr.is_localhost()) {
|
||||
// We published our .onion address, and it's an incoming connection on localhost interface, so it's likely an incoming tor connection
|
||||
is_tor = true;
|
||||
}
|
||||
|
||||
k = owner->get_peerId(is_tor, owner->m_isI2P);
|
||||
memcpy(p, &k, sizeof(uint64_t));
|
||||
p += sizeof(uint64_t);
|
||||
|
||||
@@ -2346,7 +2604,7 @@ bool P2PServer::P2PClient::on_handshake_challenge(const uint8_t* buf)
|
||||
uint64_t peer_id;
|
||||
memcpy(&peer_id, buf + CHALLENGE_SIZE, sizeof(uint64_t));
|
||||
|
||||
if (peer_id == server->get_peerId()) {
|
||||
if ((peer_id == server->m_peerId) || (peer_id == server->m_peerId_TOR) || (peer_id == server->m_peerId_I2P)) {
|
||||
LOGWARN(5, "tried to connect to self at " << static_cast<const char*>(m_addrString));
|
||||
return false;
|
||||
}
|
||||
@@ -2444,14 +2702,14 @@ bool P2PServer::P2PClient::on_listen_port(const uint8_t* buf)
|
||||
int32_t port;
|
||||
memcpy(&port, buf, sizeof(port));
|
||||
|
||||
if ((port < 0) || (port >= 65536)) {
|
||||
if ((port <= 0) || (port >= 65536)) {
|
||||
LOGWARN(5, "peer " << static_cast<char*>(m_addrString) << " sent an invalid listen port number");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_listenPort = port;
|
||||
|
||||
static_cast<P2PServer*>(m_owner)->update_peer_in_list(m_isV6, m_addr, port);
|
||||
static_cast<P2PServer*>(m_owner)->update_peer_in_list(isV6(), m_addr, port);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2664,7 +2922,7 @@ bool P2PServer::P2PClient::on_peer_list_request(const uint8_t*)
|
||||
continue;
|
||||
}
|
||||
|
||||
const Peer p{ client->m_isV6, client->m_addr, client->m_listenPort, 0, 0 };
|
||||
const Peer p{ client->isV6(), client->m_addr, client->m_listenPort, 0, 0 };
|
||||
++n;
|
||||
|
||||
// Use https://en.wikipedia.org/wiki/Reservoir_sampling algorithm
|
||||
@@ -2888,7 +3146,7 @@ bool P2PServer::P2PClient::on_aux_job_donation(const uint8_t* buf, uint32_t size
|
||||
const time_t cur_time = time(nullptr);
|
||||
|
||||
// Layout of the message:
|
||||
//
|
||||
//
|
||||
// 32 bytes | Secondary public key
|
||||
// 8 bytes | Secondary public key's expiration timestamp
|
||||
// 64 bytes | Master key signature signing the above 40 bytes
|
||||
@@ -2907,11 +3165,11 @@ bool P2PServer::P2PClient::on_aux_job_donation(const uint8_t* buf, uint32_t size
|
||||
}
|
||||
|
||||
// Layout of the data:
|
||||
//
|
||||
//
|
||||
// 8 bytes | timestamp
|
||||
//
|
||||
//
|
||||
// Next come one or multiple data entries:
|
||||
//
|
||||
//
|
||||
// 32 bytes | aux_id
|
||||
// 32 bytes | aux_hash
|
||||
// 16 bytes | aux_diff
|
||||
@@ -2958,6 +3216,11 @@ bool P2PServer::P2PClient::on_aux_job_donation(const uint8_t* buf, uint32_t size
|
||||
p += sizeof(int64_t);
|
||||
|
||||
// Ignore outdated messages
|
||||
if (data_timestamp > std::numeric_limits<int64_t>::max() - AUX_JOB_TIMEOUT) {
|
||||
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent an invalid AUX_JOB_DONATION message (timestamp = " << data_timestamp << ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cur_time >= data_timestamp + AUX_JOB_TIMEOUT) {
|
||||
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent an outdated AUX_JOB_DONATION message (" << cur_time << " >= " << data_timestamp << " + " << static_cast<int>(AUX_JOB_TIMEOUT) << ')');
|
||||
return true;
|
||||
@@ -2965,7 +3228,7 @@ bool P2PServer::P2PClient::on_aux_job_donation(const uint8_t* buf, uint32_t size
|
||||
|
||||
if ((data_end - p) % DATA_ENTRY_SIZE) {
|
||||
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent an invalid AUX_JOB_DONATION message (" << (data_end - p) << " is not a multiple of " << DATA_ENTRY_SIZE << ')');
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
hash digest;
|
||||
@@ -3005,7 +3268,7 @@ bool P2PServer::P2PClient::on_aux_job_donation(const uint8_t* buf, uint32_t size
|
||||
return true;
|
||||
}
|
||||
|
||||
bool P2PServer::P2PClient::on_monero_block_broadcast(const uint8_t* buf, uint32_t size) const
|
||||
bool P2PServer::P2PClient::on_monero_block_broadcast(const uint8_t* buf, uint32_t size)
|
||||
{
|
||||
P2PServer* server = static_cast<P2PServer*>(m_owner);
|
||||
|
||||
@@ -3064,8 +3327,10 @@ bool P2PServer::P2PClient::on_monero_block_broadcast(const uint8_t* buf, uint32_
|
||||
return true;
|
||||
}
|
||||
|
||||
sha256(buf, size, m_lastMoneroBlockBroadcastDigest.h);
|
||||
|
||||
// Ignore repeated old messages
|
||||
if (!server->store_monero_block_broadcast(buf, size)) {
|
||||
if (!server->store_monero_block_broadcast(m_lastMoneroBlockBroadcastDigest)) {
|
||||
LOGINFO(6, "Repeated MONERO_BLOCK_BROADCAST - ignored");
|
||||
return true;
|
||||
}
|
||||
@@ -3105,42 +3370,115 @@ bool P2PServer::P2PClient::on_monero_block_broadcast(const uint8_t* buf, uint32_
|
||||
|
||||
std::vector<uint8_t> blob;
|
||||
blob.reserve(data.header_size + HASH_SIZE + 2);
|
||||
|
||||
|
||||
blob.insert(blob.end(), buf, buf + data.header_size);
|
||||
blob.insert(blob.end(), root.h, root.h + HASH_SIZE);
|
||||
writeVarint(num_transactions + 1, blob);
|
||||
|
||||
hash pow_hash;
|
||||
if (!pool->hasher()->calculate(blob.data(), blob.size(), height, seed, pow_hash, false)) {
|
||||
LOGWARN(3, "Invalid MONERO_BLOCK_BROADCAST: failed to calculate PoW hash");
|
||||
return false;
|
||||
}
|
||||
struct Work
|
||||
{
|
||||
uv_work_t req;
|
||||
|
||||
if (!diff.check_pow(pow_hash)) {
|
||||
LOGWARN(3, "Invalid MONERO_BLOCK_BROADCAST: diff check failed, PoW hash = " << pow_hash);
|
||||
return false;
|
||||
}
|
||||
P2PServer* server;
|
||||
P2PClient* client;
|
||||
|
||||
server->broadcast_monero_block(buf0, size0, this, true);
|
||||
uint32_t reset_counter;
|
||||
bool is_v6;
|
||||
raw_ip addr;
|
||||
|
||||
std::string request;
|
||||
request.reserve(size * 2 + 128);
|
||||
RandomX_Hasher_Base* hasher;
|
||||
|
||||
request.append("{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"submit_block\",\"params\":[\"");
|
||||
std::vector<uint8_t> blob;
|
||||
uint64_t height;
|
||||
hash seed;
|
||||
difficulty_type diff;
|
||||
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
request.append(1, "0123456789abcdef"[buf[i] >> 4]);
|
||||
request.append(1, "0123456789abcdef"[buf[i] & 15]);
|
||||
}
|
||||
std::vector<uint8_t> message;
|
||||
|
||||
request.append("\"]}");
|
||||
bool pow_check_passed;
|
||||
};
|
||||
|
||||
server->m_MoneroBlocksToSubmit.emplace_back(std::move(request));
|
||||
Work* work = new Work{ {}, server, this, m_resetCounter, isV6(), m_addr, pool->hasher(), std::move(blob), height, seed, diff, { buf0, buf0 + size0 }, false };
|
||||
work->req.data = work;
|
||||
|
||||
// Kick the JSON RPC request loop only when the first request arrives
|
||||
// The other requests will be queued and submit_monero_blocks() will process them one by one
|
||||
if (server->m_MoneroBlocksToSubmit.size() == 1) {
|
||||
server->submit_monero_blocks();
|
||||
const int err = uv_queue_work(&server->m_loop, &work->req,
|
||||
[](uv_work_t* req)
|
||||
{
|
||||
BACKGROUND_JOB_START(P2PServer::on_monero_block_broadcast);
|
||||
|
||||
Work* work = reinterpret_cast<Work*>(req->data);
|
||||
|
||||
hash pow_hash;
|
||||
if (!work->hasher->calculate(work->blob.data(), work->blob.size(), work->height, work->seed, pow_hash, false)) {
|
||||
LOGWARN(3, "Invalid MONERO_BLOCK_BROADCAST: failed to calculate PoW hash for height = " << work->height);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!work->diff.check_pow(pow_hash)) {
|
||||
LOGWARN(3, "Invalid MONERO_BLOCK_BROADCAST: diff check failed for height = " << work->height << ", PoW hash = " << pow_hash);
|
||||
return;
|
||||
}
|
||||
|
||||
LOGINFO(6, "on_monero_block_broadcast: PoW check passed for height = " << work->height);
|
||||
work->pow_check_passed = true;
|
||||
},
|
||||
[](uv_work_t* req, int /*status*/)
|
||||
{
|
||||
Work* work = reinterpret_cast<Work*>(req->data);
|
||||
|
||||
P2PServer* server = work->server;
|
||||
|
||||
if (work->pow_check_passed) {
|
||||
const uint8_t* buf0 = work->message.data();
|
||||
const uint32_t size0 = static_cast<uint32_t>(work->message.size());
|
||||
|
||||
const uint8_t* buf = buf0 + sizeof(MoneroBlockBroadcastHeader);
|
||||
const uint32_t size = static_cast<uint32_t>(size0 - sizeof(MoneroBlockBroadcastHeader));
|
||||
|
||||
server->broadcast_monero_block(buf0, size0, work->client, true);
|
||||
|
||||
std::string request;
|
||||
request.reserve(size * 2 + 128);
|
||||
|
||||
request.append("{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"submit_block\",\"params\":[\"");
|
||||
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
request.append(1, "0123456789abcdef"[buf[i] >> 4]);
|
||||
request.append(1, "0123456789abcdef"[buf[i] & 15]);
|
||||
}
|
||||
|
||||
request.append("\"]}");
|
||||
|
||||
server->m_MoneroBlocksToSubmit.emplace_back(std::move(request));
|
||||
|
||||
// Kick the JSON RPC request loop only when the first request arrives
|
||||
// The other requests will be queued and submit_monero_blocks() will process them one by one
|
||||
if (server->m_MoneroBlocksToSubmit.size() == 1) {
|
||||
server->submit_monero_blocks();
|
||||
}
|
||||
}
|
||||
else {
|
||||
P2PClient* client = work->client;
|
||||
|
||||
if (client->m_resetCounter == work->reset_counter) {
|
||||
client->close();
|
||||
LOGWARN(3, "peer " << static_cast<const char*>(client->m_addrString) << " banned for " << DEFAULT_BAN_TIME << " seconds");
|
||||
}
|
||||
else {
|
||||
LOGWARN(3, work->addr << " banned for " << DEFAULT_BAN_TIME << " seconds");
|
||||
}
|
||||
|
||||
server->ban(work->is_v6, work->addr, DEFAULT_BAN_TIME);
|
||||
server->remove_peer_from_list(work->addr);
|
||||
}
|
||||
|
||||
delete work;
|
||||
BACKGROUND_JOB_STOP(P2PServer::on_monero_block_broadcast);
|
||||
});
|
||||
|
||||
if (err) {
|
||||
LOGERR(1, "on_monero_block_broadcast: uv_queue_work failed, error " << uv_err_name(err));
|
||||
delete work;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -3215,7 +3553,7 @@ bool P2PServer::P2PClient::handle_incoming_block_async(const PoolBlock* block, u
|
||||
bool result;
|
||||
};
|
||||
|
||||
Work* work = new Work{ {}, *block, this, server, m_resetCounter.load(), m_isV6, m_addr, {}, true };
|
||||
Work* work = new Work{ {}, *block, this, server, m_resetCounter.load(), isV6(), m_addr, {}, true };
|
||||
work->req.data = work;
|
||||
|
||||
const int err = uv_queue_work(&server->m_loop, &work->req,
|
||||
@@ -3283,7 +3621,7 @@ void P2PServer::P2PClient::post_handle_incoming_block(p2pool* pool, const PoolBl
|
||||
P2PClient* c = server->m_fastestPeer;
|
||||
if (c && (c != this) && (c->m_broadcastMaxHeight >= block.m_sidechainHeight)) {
|
||||
LOGINFO(5, "peer " << static_cast<char*>(c->m_addrString) << " is faster, sending BLOCK_REQUEST to it instead");
|
||||
c->post_handle_incoming_block(pool, block, c->m_resetCounter.load(), c->m_isV6, c->m_addr, missing_blocks, true);
|
||||
c->post_handle_incoming_block(pool, block, c->m_resetCounter.load(), c->isV6(), c->m_addr, missing_blocks, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+17
-6
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -36,6 +36,9 @@ static constexpr int DEFAULT_P2P_PORT = 37889;
|
||||
static constexpr int DEFAULT_P2P_PORT_MINI = 37888;
|
||||
static constexpr int DEFAULT_P2P_PORT_NANO = 37890;
|
||||
|
||||
static constexpr int DEFAULT_P2P_PORT_ONION = 28722;
|
||||
static constexpr int DEFAULT_P2P_PORT_I2P = 28723;
|
||||
|
||||
static constexpr uint32_t PROTOCOL_VERSION_1_0 = 0x00010000UL;
|
||||
static constexpr uint32_t PROTOCOL_VERSION_1_1 = 0x00010001UL;
|
||||
static constexpr uint32_t PROTOCOL_VERSION_1_2 = 0x00010002UL;
|
||||
@@ -93,9 +96,9 @@ public:
|
||||
// Both peers send handshake challenge immediately after a connection is established
|
||||
// Both peers must have the same consensus ID for handshake to succeed
|
||||
// Consensus ID is never sent over the network
|
||||
//
|
||||
//
|
||||
// Handshake sequence:
|
||||
//
|
||||
//
|
||||
// - Both peers send 8-byte random challenges (and 8 bytes of peer ID) to each other
|
||||
// - Each peer receives 8-byte challenge, chooses 8-byte random SALT and calculates H = KECCAK(CHALLENGE|CONSENSUS_ID|SALT)
|
||||
// - Both peers send their H and SALT, calculate H of the other peer and check if it matches with what other peer calculated
|
||||
@@ -121,7 +124,7 @@ public:
|
||||
void on_peer_list_response(const uint8_t* buf);
|
||||
void on_block_notify(const uint8_t* buf);
|
||||
[[nodiscard]] bool on_aux_job_donation(const uint8_t* buf, uint32_t size);
|
||||
[[nodiscard]] bool on_monero_block_broadcast(const uint8_t* buf, uint32_t size) const;
|
||||
[[nodiscard]] bool on_monero_block_broadcast(const uint8_t* buf, uint32_t size);
|
||||
|
||||
[[nodiscard]] bool handle_incoming_block_async(const PoolBlock* block, uint64_t max_time_delta = 0);
|
||||
static void handle_incoming_block(p2pool* pool, PoolBlock& block, std::vector<hash>& missing_blocks, bool& result);
|
||||
@@ -162,6 +165,8 @@ public:
|
||||
hash m_broadcastedHashes[8];
|
||||
uint32_t m_broadcastedHashesIndex;
|
||||
|
||||
hash m_lastMoneroBlockBroadcastDigest;
|
||||
|
||||
// log::Stream wrapper
|
||||
struct SoftwareDisplayName
|
||||
{
|
||||
@@ -187,7 +192,7 @@ public:
|
||||
|
||||
void broadcast(const PoolBlock& block, const PoolBlock* parent);
|
||||
[[nodiscard]] uint64_t get_random64();
|
||||
[[nodiscard]] uint64_t get_peerId() const { return m_peerId; }
|
||||
[[nodiscard]] uint64_t get_peerId(bool is_tor, bool is_i2p) const { return is_tor ? m_peerId_TOR : (is_i2p ? m_peerId_I2P : m_peerId); }
|
||||
|
||||
void print_status() override;
|
||||
void show_peers_async();
|
||||
@@ -220,7 +225,7 @@ public:
|
||||
void broadcast_monero_block_handler();
|
||||
void broadcast_monero_block(const uint8_t* data, uint32_t data_size, const P2PClient* source, bool duplicate_check_done);
|
||||
|
||||
bool store_monero_block_broadcast(const uint8_t* data, uint32_t data_size);
|
||||
bool store_monero_block_broadcast(const hash& digest);
|
||||
|
||||
private:
|
||||
[[nodiscard]] const char* get_log_category() const override;
|
||||
@@ -266,6 +271,8 @@ private:
|
||||
uint64_t m_timerInterval;
|
||||
|
||||
uint64_t m_peerId;
|
||||
uint64_t m_peerId_TOR;
|
||||
uint64_t m_peerId_I2P;
|
||||
|
||||
mutable uv_mutex_t m_peerListLock;
|
||||
|
||||
@@ -285,6 +292,10 @@ private:
|
||||
std::vector<Peer> m_peerListMonero;
|
||||
std::atomic<uint64_t> m_peerListLastSaved;
|
||||
|
||||
std::atomic<uint32_t> m_numOnionConnections;
|
||||
std::atomic<uint32_t> m_numI2PConnections;
|
||||
bool m_isI2P;
|
||||
|
||||
uv_mutex_t m_broadcastLock;
|
||||
uv_async_t m_broadcastAsync;
|
||||
std::vector<Broadcast*> m_broadcastQueue;
|
||||
|
||||
+104
-95
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
|
||||
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "keccak.h"
|
||||
#include "merkle.h"
|
||||
#include "merge_mining_client.h"
|
||||
#include "sha256.h"
|
||||
|
||||
#ifdef WITH_TLS
|
||||
#include <openssl/curve25519.h>
|
||||
@@ -62,8 +63,9 @@ namespace p2pool {
|
||||
|
||||
static uint64_t BLOCK_HEADERS_REQUIRED = 720;
|
||||
|
||||
p2pool::p2pool(int argc, char* argv[])
|
||||
p2pool::p2pool(const Params& params)
|
||||
: m_stopped(false)
|
||||
, m_params(params)
|
||||
, m_updateSeed(true)
|
||||
, m_submitBlockData{}
|
||||
, m_zmqLastActive(0)
|
||||
@@ -72,49 +74,33 @@ p2pool::p2pool(int argc, char* argv[])
|
||||
{
|
||||
LOGINFO(1, log::LightCyan() << VERSION);
|
||||
|
||||
Params* p = new Params(argc, argv);
|
||||
|
||||
if (!p->valid()) {
|
||||
LOGERR(1, "Invalid or missing command line. Try \"p2pool --help\".");
|
||||
delete p;
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
m_params = p;
|
||||
|
||||
// P2Pool-nano requires more Monero blocks for the initial sync
|
||||
if (m_params->m_nano) {
|
||||
if (m_params.m_nano) {
|
||||
BLOCK_HEADERS_REQUIRED = 1440;
|
||||
}
|
||||
|
||||
bkg_jobs_tracker = new BackgroundJobTracker();
|
||||
|
||||
#ifdef WITH_UPNP
|
||||
if (p->m_upnp) {
|
||||
if (m_params.m_upnp) {
|
||||
init_upnp();
|
||||
}
|
||||
#endif
|
||||
|
||||
for (Params::Host& h : p->m_hosts) {
|
||||
if (!h.init_display_name(*p)) {
|
||||
throw std::exception();
|
||||
}
|
||||
}
|
||||
|
||||
m_currentHostIndex = 0;
|
||||
|
||||
m_hostPing.resize(p->m_hosts.size());
|
||||
m_hostPing.resize(m_params.m_hosts.size());
|
||||
|
||||
hash pub, sec, eph_public_key;
|
||||
generate_keys(pub, sec);
|
||||
|
||||
uint8_t view_tag;
|
||||
if (!p->m_wallet.get_eph_public_key(sec, 0, eph_public_key, view_tag)) {
|
||||
if (!m_params.m_miningWallet.get_eph_public_key(sec, 0, eph_public_key, view_tag)) {
|
||||
LOGERR(1, "Invalid wallet address: get_eph_public_key failed");
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
const NetworkType type = p->m_wallet.type();
|
||||
const NetworkType type = m_params.m_miningWallet.type();
|
||||
|
||||
if (type == NetworkType::Testnet) {
|
||||
LOGWARN(1, "Mining to a testnet wallet address");
|
||||
@@ -188,27 +174,24 @@ p2pool::p2pool(int argc, char* argv[])
|
||||
|
||||
uv_mutex_init_checked(&m_missingHeightsLock);
|
||||
|
||||
m_api = p->m_apiPath.empty() ? nullptr : new p2pool_api(p->m_apiPath, p->m_localStats);
|
||||
err = uv_timer_init(uv_default_loop_checked(), &m_timer);
|
||||
if (err) {
|
||||
LOGERR(1, "uv_timer_init failed, error " << uv_err_name(err));
|
||||
throw std::exception();
|
||||
}
|
||||
m_timer.data = this;
|
||||
|
||||
if (p->m_localStats && !m_api) {
|
||||
m_api = m_params.m_apiPath.empty() ? nullptr : new p2pool_api(m_params.m_apiPath, m_params.m_localStats);
|
||||
|
||||
if (m_params.m_localStats && !m_api) {
|
||||
LOGERR(1, "--local-api and --stratum-api command line parameters can't be used without --data-api");
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
m_sideChain = new SideChain(this, type, p->m_mini ? "mini" : (p->m_nano ? "nano" : nullptr));
|
||||
|
||||
if (p->m_p2pAddresses.empty()) {
|
||||
const int p2p_port = m_sideChain->is_mini() ? DEFAULT_P2P_PORT_MINI : (m_sideChain->is_nano() ? DEFAULT_P2P_PORT_NANO : DEFAULT_P2P_PORT);
|
||||
|
||||
char buf[48] = {};
|
||||
log::Stream s(buf);
|
||||
s << "[::]:" << p2p_port << ",0.0.0.0:" << p2p_port;
|
||||
|
||||
p->m_p2pAddresses = buf;
|
||||
}
|
||||
m_sideChain = new SideChain(this, type, m_params.m_mini ? "mini" : (m_params.m_nano ? "nano" : nullptr));
|
||||
|
||||
#ifdef WITH_RANDOMX
|
||||
if (p->m_disableRandomX) {
|
||||
if (m_params.m_disableRandomX) {
|
||||
m_hasher = new RandomX_Hasher_RPC(this);
|
||||
}
|
||||
else {
|
||||
@@ -237,7 +220,7 @@ p2pool::p2pool(int argc, char* argv[])
|
||||
p2pool::~p2pool()
|
||||
{
|
||||
#ifdef WITH_UPNP
|
||||
if (m_params->m_upnp) {
|
||||
if (m_params.m_upnp) {
|
||||
destroy_upnp();
|
||||
}
|
||||
#endif
|
||||
@@ -280,15 +263,14 @@ p2pool::~p2pool()
|
||||
delete m_hasher;
|
||||
delete m_blockTemplate;
|
||||
delete m_mempool;
|
||||
delete m_params;
|
||||
|
||||
{
|
||||
auto p = bkg_jobs_tracker;
|
||||
auto* p = bkg_jobs_tracker;
|
||||
bkg_jobs_tracker = nullptr;
|
||||
delete p;
|
||||
}
|
||||
{
|
||||
auto p = PoolBlock::s_precalculatedSharesLock;
|
||||
auto* p = PoolBlock::s_precalculatedSharesLock;
|
||||
PoolBlock::s_precalculatedSharesLock = nullptr;
|
||||
delete p;
|
||||
}
|
||||
@@ -303,7 +285,7 @@ void p2pool::update_host_ping(const std::string& display_name, double ping)
|
||||
LOGWARN(1, display_name << " ping is " << ping << " ms, this is too high for an efficient mining. Try to use a different node, or your own local node.");
|
||||
}
|
||||
|
||||
const std::vector<Params::Host>& v = m_params->m_hosts;
|
||||
const std::vector<Params::Host>& v = m_params.m_hosts;
|
||||
|
||||
for (size_t i = 0, n = v.size(); i < n; ++i) {
|
||||
if (v[i].m_displayName == display_name) {
|
||||
@@ -317,8 +299,8 @@ void p2pool::print_hosts() const
|
||||
{
|
||||
const Params::Host& host = current_host();
|
||||
|
||||
for (size_t i = 0, n = m_params->m_hosts.size(); i < n; ++i) {
|
||||
const Params::Host& h = m_params->m_hosts[i];
|
||||
for (size_t i = 0, n = m_params.m_hosts.size(); i < n; ++i) {
|
||||
const Params::Host& h = m_params.m_hosts[i];
|
||||
|
||||
char buf[64] = {};
|
||||
if (m_hostPing[i] > 0.0) {
|
||||
@@ -402,7 +384,7 @@ void p2pool::handle_tx(TxMempoolData& tx)
|
||||
}
|
||||
|
||||
#if TEST_MEMPOOL_PICKING_ALGORITHM
|
||||
m_blockTemplate->update(miner_data(), *m_mempool, &m_params->m_wallet);
|
||||
m_blockTemplate->update(miner_data(), *m_mempool, &m_params.m_wallet);
|
||||
#endif
|
||||
|
||||
m_zmqLastActive = seconds_since_epoch();
|
||||
@@ -415,7 +397,7 @@ void p2pool::handle_miner_data(MinerData& data)
|
||||
m_mempool->swap(data.tx_backlog);
|
||||
}
|
||||
#else
|
||||
m_mempool->swap(data.tx_backlog);
|
||||
m_mempool->swap_transactions(data.tx_backlog);
|
||||
#endif
|
||||
|
||||
{
|
||||
@@ -538,11 +520,11 @@ void p2pool::get_missing_heights()
|
||||
|
||||
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";
|
||||
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_header_by_height\",\"params\":{\"height\":" << h << "}}" << '\0';
|
||||
|
||||
const Params::Host& host = current_host();
|
||||
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
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;
|
||||
@@ -577,8 +559,11 @@ const char* BLOCK_FOUND = "\n\
|
||||
| ###### ####### ####### ##### # # # ####### ##### # # ###### |\n\
|
||||
-----------------------------------------------------------------------------------------------";
|
||||
|
||||
void p2pool::handle_chain_main(ChainMain& data, const char* extra)
|
||||
void p2pool::handle_chain_main(ChainMain& data, const char* extra, const std::vector<hash>& tx_hashes_in_block)
|
||||
{
|
||||
// These transactions were already mined, so remove them from mempool if any of them slipped through
|
||||
m_mempool->remove(tx_hashes_in_block);
|
||||
|
||||
{
|
||||
WriteLock lock(m_mainchainLock);
|
||||
|
||||
@@ -618,17 +603,17 @@ void p2pool::handle_chain_main(ChainMain& data, const char* extra)
|
||||
if (!merkle_root.empty()) {
|
||||
const PoolBlock* block = side_chain().find_block_by_merkle_root(merkle_root);
|
||||
if (block) {
|
||||
const Wallet& w = params().m_wallet;
|
||||
const Wallet& w = params().m_miningWallet;
|
||||
|
||||
const char* who = (block->m_minerWallet == w) ? "you" : "someone else in this p2pool";
|
||||
LOGINFO(0, log::LightGreen() << "BLOCK FOUND: main chain block at height " << data.height << " was mined by " << who << BLOCK_FOUND);
|
||||
|
||||
const uint64_t payout = block->get_payout(w);
|
||||
if (payout) {
|
||||
LOGINFO(0, log::LightCyan() << "Your wallet " << log::LightGreen() << w << log::LightCyan() << " got a payout of " << log::LightGreen() << log::XMRAmount(payout) << log::LightCyan() << " in block " << log::LightGreen() << data.height);
|
||||
LOGINFO(0, log::LightCyan() << "Your wallet " << log::LightGreen() << params().m_displayWallet << log::LightCyan() << " got a payout of " << log::LightGreen() << log::XMRAmount(payout) << log::LightCyan() << " in block " << log::LightGreen() << data.height);
|
||||
}
|
||||
else {
|
||||
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");
|
||||
LOGINFO(0, log::LightCyan() << "Your wallet " << log::LightYellow() << params().m_displayWallet << 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, false);
|
||||
@@ -783,21 +768,22 @@ void p2pool::update_aux_data(const hash& chain_id)
|
||||
void p2pool::send_aux_job_donation()
|
||||
{
|
||||
#ifdef WITH_TLS
|
||||
if (m_params->m_authorKeyFile.empty()) {
|
||||
if (m_params.m_authorKeyFile.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::ifstream f(m_params->m_authorKeyFile, std::ios::binary | std::ios::ate);
|
||||
std::ifstream f(m_params.m_authorKeyFile, std::ios::binary | std::ios::ate);
|
||||
|
||||
if (!f.good()) {
|
||||
LOGERR(1, "send_aux_job_donation: failed to open " << m_params->m_authorKeyFile);
|
||||
LOGERR(1, "send_aux_job_donation: failed to open " << m_params.m_authorKeyFile);
|
||||
return;
|
||||
}
|
||||
|
||||
Params::AuthorKey key;
|
||||
ON_SCOPE_LEAVE([&key](){ secure_zero_memory(key); });
|
||||
|
||||
if (f.tellg() != static_cast<std::streampos>(sizeof(key))) {
|
||||
LOGERR(1, "send_aux_job_donation: " << m_params->m_authorKeyFile << " has an invalid size");
|
||||
LOGERR(1, "send_aux_job_donation: " << m_params.m_authorKeyFile << " has an invalid size");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -805,21 +791,21 @@ void p2pool::send_aux_job_donation()
|
||||
f.read(reinterpret_cast<char*>(&key), sizeof(key));
|
||||
|
||||
if (!f.good()) {
|
||||
LOGERR(1, "send_aux_job_donation: failed to read data from " << m_params->m_authorKeyFile);
|
||||
LOGERR(1, "send_aux_job_donation: failed to read data from " << m_params.m_authorKeyFile);
|
||||
return;
|
||||
}
|
||||
|
||||
const uint64_t timestamp = time(nullptr);
|
||||
|
||||
if (timestamp >= read_unaligned(reinterpret_cast<uint64_t*>(key.expiration_time))) {
|
||||
LOGERR(1, "send_aux_job_donation: " << m_params->m_authorKeyFile << " is expired");
|
||||
LOGERR(1, "send_aux_job_donation: " << m_params.m_authorKeyFile << " is expired");
|
||||
return;
|
||||
}
|
||||
|
||||
const uint8_t* p = reinterpret_cast<uint8_t*>(&key);
|
||||
|
||||
if (!ED25519_verify(p, sizeof(key.pub_key) + sizeof(key.expiration_time), key.master_key_signature, ED25519_MASTER_PUBLIC_KEY)) {
|
||||
LOGERR(1, "send_aux_job_donation: " << m_params->m_authorKeyFile << ": signature verification failed");
|
||||
LOGERR(1, "send_aux_job_donation: " << m_params.m_authorKeyFile << ": signature verification failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -858,8 +844,6 @@ void p2pool::send_aux_job_donation()
|
||||
return;
|
||||
}
|
||||
|
||||
OPENSSL_cleanse(&key, sizeof(key));
|
||||
|
||||
job.insert(job.end(), signature, signature + sizeof(signature));
|
||||
|
||||
m_p2pServer->broadcast_aux_job_donation_async(job.data(), static_cast<uint32_t>(job.size()), timestamp);
|
||||
@@ -1023,6 +1007,22 @@ void p2pool::on_stop(uv_async_t* async)
|
||||
{
|
||||
p2pool* pool = reinterpret_cast<p2pool*>(async->data);
|
||||
|
||||
const std::vector<std::pair<const char*, int32_t>> bkg_jobs = bkg_jobs_tracker->get_jobs();
|
||||
|
||||
if (!bkg_jobs.empty()) {
|
||||
for (const auto& job : bkg_jobs) {
|
||||
LOGINFO(1, "waiting for " << job.second << " \"" << job.first << "\" jobs to finish");
|
||||
}
|
||||
|
||||
// There are still some background jobs running. Wait for 1 second and call on_stop again.
|
||||
uv_timer_start(&pool->m_timer, [](uv_timer_t* timer) {
|
||||
p2pool* pool = reinterpret_cast<p2pool*>(timer->data);
|
||||
pool->on_stop(&pool->m_stopAsync);
|
||||
}, 1000, 0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef P2POOL_UNIT_TESTS
|
||||
delete pool->m_consoleCommands;
|
||||
#endif
|
||||
@@ -1038,6 +1038,9 @@ void p2pool::on_stop(uv_async_t* async)
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&pool->m_reconnectToHostAsync), nullptr);
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&pool->m_getMissingHeightsAsync), nullptr);
|
||||
|
||||
uv_timer_stop(&pool->m_timer);
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&pool->m_timer), nullptr);
|
||||
|
||||
init_signals(pool, false);
|
||||
|
||||
DeleteLoopUserData(uv_default_loop_checked());
|
||||
@@ -1117,11 +1120,16 @@ void p2pool::submit_block() const
|
||||
}
|
||||
request.append("\"]}");
|
||||
|
||||
m_p2pServer->store_monero_block_broadcast(blob.data(), static_cast<uint32_t>(blob.size()));
|
||||
hash digest;
|
||||
sha256(blob.data(), static_cast<uint32_t>(blob.size()), digest.h);
|
||||
|
||||
m_p2pServer->store_monero_block_broadcast(digest);
|
||||
|
||||
const Params::Host& host = current_host();
|
||||
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, request, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
const uint64_t t1 = microseconds_since_epoch();
|
||||
|
||||
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;
|
||||
@@ -1166,7 +1174,7 @@ void p2pool::submit_block() const
|
||||
|
||||
LOGWARN(0, "submit_block: daemon sent unrecognizable reply: " << log::const_buf(data, size));
|
||||
},
|
||||
[is_external](const char* data, size_t size, double)
|
||||
[is_external, t1](const char* data, size_t size, double)
|
||||
{
|
||||
if (size > 0) {
|
||||
if (is_external) {
|
||||
@@ -1176,6 +1184,9 @@ void p2pool::submit_block() const
|
||||
LOGERR(0, "submit_block: RPC request failed, error " << log::const_buf(data, size));
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOGINFO(4, "submit_block RPC completed in " << static_cast<double>(microseconds_since_epoch() - t1) / 1e3 << " ms");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1209,7 +1220,7 @@ void p2pool::update_block_template()
|
||||
if (m_updateSeed.exchange(false)) {
|
||||
m_hasher->set_seed_async(data.seed_hash);
|
||||
}
|
||||
m_blockTemplate->update(data, *m_mempool, &m_params->m_wallet);
|
||||
m_blockTemplate->update(data, *m_mempool, m_params);
|
||||
stratum_on_block();
|
||||
api_update_pool_stats();
|
||||
|
||||
@@ -1235,9 +1246,9 @@ void p2pool::download_block_headers1(uint64_t current_height)
|
||||
const Params::Host& host = current_host();
|
||||
|
||||
s.m_pos = 0;
|
||||
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_header_by_height\",\"params\":{\"height\":" << prev_seed_height << "}}\0";
|
||||
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_header_by_height\",\"params\":{\"height\":" << prev_seed_height << "}}" << '\0';
|
||||
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
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, current_height](const char* data, size_t size, double) {
|
||||
ChainMain block;
|
||||
if (parse_block_header(data, size, block)) {
|
||||
@@ -1268,9 +1279,9 @@ void p2pool::download_block_headers2(uint64_t current_height)
|
||||
const Params::Host& host = current_host();
|
||||
|
||||
s.m_pos = 0;
|
||||
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_header_by_height\",\"params\":{\"height\":" << seed_height << "}}\0";
|
||||
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_header_by_height\",\"params\":{\"height\":" << seed_height << "}}" << '\0';
|
||||
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params.m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
[this, seed_height, current_height](const char* data, size_t size, double) {
|
||||
ChainMain block;
|
||||
if (parse_block_header(data, size, block)) {
|
||||
@@ -1304,10 +1315,10 @@ void p2pool::download_block_headers3(uint64_t start_height, uint64_t current_hei
|
||||
const uint64_t next_height = start_height + RESTRICTED_BLOCK_HEADER_RANGE;
|
||||
|
||||
s.m_pos = 0;
|
||||
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_headers_range\",\"params\":{\"start_height\":" << start_height << ",\"end_height\":" << next_height << "}}\0";
|
||||
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_headers_range\",\"params\":{\"start_height\":" << start_height << ",\"end_height\":" << next_height << "}}" << '\0';
|
||||
|
||||
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, next_height, host, current_height](const char* data, size_t size, double) {
|
||||
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, next_height, current_height](const char* data, size_t size, double) {
|
||||
if (parse_block_headers_range(data, size) == next_height - start_height + 1) {
|
||||
download_block_headers3(next_height + 1, current_height);
|
||||
}
|
||||
@@ -1337,9 +1348,9 @@ void p2pool::download_block_headers4(uint64_t start_height, uint64_t current_hei
|
||||
const Params::Host& host = current_host();
|
||||
|
||||
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";
|
||||
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, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
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) {
|
||||
@@ -1348,14 +1359,14 @@ void p2pool::download_block_headers4(uint64_t start_height, uint64_t current_hei
|
||||
m_p2pServer = new P2PServer(this);
|
||||
m_stratumServer = new StratumServer(this);
|
||||
#if defined(WITH_RANDOMX) && !defined(P2POOL_UNIT_TESTS)
|
||||
if (m_params->m_minerThreads) {
|
||||
start_mining(m_params->m_minerThreads);
|
||||
if (m_params.m_minerThreads) {
|
||||
start_mining(m_params.m_minerThreads);
|
||||
}
|
||||
{
|
||||
WriteLock lock(m_ZMQReaderLock);
|
||||
|
||||
try {
|
||||
m_ZMQReader = new ZMQReader(host.m_address, host.m_zmqPort, m_params->m_socks5Proxy, this);
|
||||
m_ZMQReader = new ZMQReader(host.m_address, host.m_zmqPort, m_params.m_socks5Proxy, this);
|
||||
m_zmqLastActive = seconds_since_epoch();
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
@@ -1369,10 +1380,10 @@ void p2pool::download_block_headers4(uint64_t start_height, uint64_t current_hei
|
||||
get_miner_data();
|
||||
|
||||
// Get ping times for all other hosts
|
||||
for (const Params::Host& h : m_params->m_hosts) {
|
||||
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, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
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) {});
|
||||
}
|
||||
@@ -1380,7 +1391,7 @@ void p2pool::download_block_headers4(uint64_t start_height, uint64_t current_hei
|
||||
|
||||
std::vector<IMergeMiningClient*> merge_mining_clients;
|
||||
|
||||
for (const auto& h : m_params->m_mergeMiningHosts) {
|
||||
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);
|
||||
@@ -1481,7 +1492,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, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
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);
|
||||
@@ -1505,7 +1516,7 @@ void p2pool::load_found_blocks()
|
||||
return;
|
||||
}
|
||||
|
||||
std::ifstream f(DATA_DIR + FOUND_BLOCKS_FILE);
|
||||
std::ifstream f(m_params.m_dataDir + FOUND_BLOCKS_FILE);
|
||||
if (!f.is_open()) {
|
||||
return;
|
||||
}
|
||||
@@ -1600,7 +1611,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, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
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);
|
||||
@@ -1677,7 +1688,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, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
|
||||
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);
|
||||
@@ -1829,7 +1840,7 @@ uint32_t p2pool::parse_block_headers_range(const char* data, size_t size)
|
||||
auto headers = it2->value.GetArray();
|
||||
uint64_t min_height = std::numeric_limits<uint64_t>::max();
|
||||
uint64_t max_height = 0;
|
||||
for (auto i = headers.begin(); i != headers.end(); ++i) {
|
||||
for (auto* i = headers.begin(); i != headers.end(); ++i) {
|
||||
if (!i->IsObject()) {
|
||||
continue;
|
||||
}
|
||||
@@ -2041,7 +2052,7 @@ void p2pool::api_update_block_found(const ChainMain* data, const PoolBlock* bloc
|
||||
difficulty_type diff;
|
||||
|
||||
if (data && get_difficulty_at_height(data->height, diff)) {
|
||||
const std::string path = DATA_DIR + FOUND_BLOCKS_FILE;
|
||||
const std::string path = m_params.m_dataDir + 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';
|
||||
@@ -2059,7 +2070,7 @@ void p2pool::api_update_block_found(const ChainMain* data, const PoolBlock* bloc
|
||||
if (data) {
|
||||
m_foundBlocks.emplace_back(cur_time, data->height, data->id, diff, total_hashes);
|
||||
}
|
||||
found_blocks.assign(m_foundBlocks.end() - std::min<size_t>(m_foundBlocks.size(), 51), m_foundBlocks.end());
|
||||
found_blocks.assign(m_foundBlocks.end() - std::min<int>(static_cast<int>(m_foundBlocks.size()), 51), m_foundBlocks.end());
|
||||
}
|
||||
|
||||
m_api->set(p2pool_api::Category::POOL, "blocks",
|
||||
@@ -2097,7 +2108,7 @@ void p2pool::on_external_block(const PoolBlock& block)
|
||||
|
||||
void p2pool::api_update_aux_data()
|
||||
{
|
||||
if (!m_api || !m_params->m_localStats || m_stopped) {
|
||||
if (!m_api || !m_params.m_localStats || m_stopped) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2247,7 +2258,7 @@ bool p2pool::zmq_running() const
|
||||
|
||||
const Params::Host& p2pool::switch_host()
|
||||
{
|
||||
const std::vector<Params::Host>& v = m_params->m_hosts;
|
||||
const std::vector<Params::Host>& v = m_params.m_hosts;
|
||||
return v[++m_currentHostIndex % v.size()];
|
||||
}
|
||||
|
||||
@@ -2272,7 +2283,7 @@ void p2pool::reconnect_to_host()
|
||||
m_ZMQReader = nullptr;
|
||||
|
||||
try {
|
||||
ZMQReader* new_reader = new ZMQReader(new_host.m_address, new_host.m_zmqPort, m_params->m_socks5Proxy, this);
|
||||
ZMQReader* new_reader = new ZMQReader(new_host.m_address, new_host.m_zmqPort, m_params.m_socks5Proxy, this);
|
||||
m_zmqLastActive = seconds_since_epoch();
|
||||
m_ZMQReader = new_reader;
|
||||
}
|
||||
@@ -2288,7 +2299,7 @@ void p2pool::reconnect_to_host()
|
||||
|
||||
int p2pool::run()
|
||||
{
|
||||
if (!m_params->valid()) {
|
||||
if (!m_params.valid()) {
|
||||
LOGERR(1, "Invalid or missing command line. Try \"p2pool --help\".");
|
||||
return 1;
|
||||
}
|
||||
@@ -2299,8 +2310,8 @@ int p2pool::run()
|
||||
}
|
||||
|
||||
#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())) {
|
||||
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;
|
||||
}
|
||||
@@ -2334,8 +2345,6 @@ int p2pool::run()
|
||||
|
||||
m_stopped = true;
|
||||
|
||||
bkg_jobs_tracker->wait();
|
||||
|
||||
#if defined(WITH_RANDOMX) && !defined(P2POOL_UNIT_TESTS)
|
||||
{
|
||||
MutexLock lock(m_minerLock);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user