Compare commits

...

20 Commits

Author SHA1 Message Date
SChernykh 837a33480e p2pool v3.8
C/C++ CI / build-alpine-static (map[arch:aarch64 flags:-flto=2 -fuse-linker-plugin -ffunction-sections -Wno-error=inline -mfix-cortex-a53-835769 -mfix-cortex-a53-843419]) (push) Has been cancelled
C/C++ CI / build-alpine-static (map[arch:x86_64 flags:-flto=2 -fuse-linker-plugin -ffunction-sections -Wno-error=inline]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-11 cpp:g++-11 os:ubuntu-20.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-12 cpp:g++-12 os:ubuntu-22.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu-static-libs (map[flags:-flto=2 -fuse-linker-plugin -ffunction-sections -Wno-error=inline]) (push) Has been cancelled
C/C++ CI / build-ubuntu-aarch64 (map[flags:-flto=2 -fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 os:ubuntu-20.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu-aarch64 (map[flags:-flto=2 -fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 os:ubuntu-22.04]) (push) Has been cancelled
C/C++ CI / build-windows-msys2 (map[c:clang cxx:clang++ flags:-flto -ffunction-sections -fuse-ld=lld -Wno-unused-command-line-argument]) (push) Has been cancelled
C/C++ CI / build-windows-msys2 (map[c:gcc cxx:g++ flags:-flto=2 -fuse-linker-plugin -ffunction-sections -Wno-error=maybe-uninitialized -Wno-error=attributes]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[os:2019 rx:OFF upnp:OFF vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[os:2019 rx:OFF upnp:ON vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[os:2019 rx:ON upnp:ON vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Has been cancelled
C/C++ CI / build-macos (push) Has been cancelled
C/C++ CI / build-macos-aarch64 (push) Has been cancelled
C/C++ CI / build-freebsd (map[architecture:x86-64 host:ubuntu-22.04 name:freebsd version:12.4]) (push) Has been cancelled
C/C++ CI / build-openbsd (map[architecture:x86-64 host:ubuntu-22.04 name:openbsd version:7.2]) (push) Has been cancelled
clang-tidy / clang-tidy (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
cppcheck / cppcheck-ubuntu (push) Has been cancelled
cppcheck / cppcheck-windows (push) Has been cancelled
Microsoft C++ Code Analysis / Analyze (push) Has been cancelled
source-snapshot / source-snapshot (push) Has been cancelled
Sync test / sync-test-ubuntu-tsan (push) Has been cancelled
Sync test / sync-test-ubuntu-msan (push) Has been cancelled
Sync test / sync-test-ubuntu-ubsan (push) Has been cancelled
Sync test / sync-test-ubuntu-asan (push) Has been cancelled
Sync test / sync-test-macos (push) Has been cancelled
Sync test / sync-test-windows-debug-asan (push) Has been cancelled
Sync test / sync-test-windows-leaks (push) Has been cancelled
2023-10-31 12:32:36 +01:00
SChernykh 7b02c3d24a Documentation: recommend more in-peers
This will balance out peers which can only have outgoing connections.
2023-10-30 09:49:36 +01:00
SChernykh c59845e746 Fixed cppcheck errors 2023-10-29 09:43:22 +01:00
SChernykh 119782920a Warn if there are too many background jobs 2023-10-20 21:12:26 +02:00
SChernykh 30ba38c2b3 macOS aarch64 build: switch to clang 15 2023-10-19 19:57:37 +02:00
SChernykh 87547576de Update RandomX 2023-10-19 18:08:40 +02:00
SChernykh 5febb8c4e2 Self-test: multithreaded dataset initialization 2023-10-18 13:43:40 +02:00
SChernykh ddc6986401 Self-test: calculate 100 hashes instead of just 1 2023-10-18 11:18:57 +02:00
SChernykh c0cabc9739 Check for Windows 7 compatibility 2023-10-17 18:04:46 +02:00
SChernykh 9a1da5b7c2 Update README.md 2023-10-16 13:44:07 +02:00
SChernykh 5daa2b9dff Removed -Wcast-align
Not necessary because misaligned accesses will be detected by UB sanitizer
2023-10-11 19:59:14 +02:00
SChernykh 5988acb12b Fix CVE-2023-38545 2023-10-11 08:17:35 +02:00
SChernykh 011d05f7b6 Update RandomX 2023-10-09 18:42:45 +02:00
SChernykh 294d1a525e Update check now also checks for connected peer versions 2023-10-09 11:08:51 +02:00
SChernykh e5770a5343 Fixed cppcheck errors 2023-10-08 23:33:06 +02:00
SChernykh 7a65e1feb5 Check for updates in status and version commands 2023-10-08 21:01:50 +02:00
SChernykh 4e55f53fb4 Notify about new P2Pool versions 2023-10-08 18:52:06 +02:00
SChernykh 4d944d3dc3 HTML: added latest release URL 2023-10-08 18:11:07 +02:00
SChernykh 3d3b4837ff Update rapidjson 2023-10-05 13:33:59 +02:00
SChernykh 8270e0898b StratumServer: fixed memory leak on shutdown 2023-10-02 08:19:28 +02:00
21 changed files with 463 additions and 46 deletions
+19 -11
View File
@@ -405,9 +405,9 @@ jobs:
strategy:
matrix:
config:
- {vs: Visual Studio 16 2019, os: 2019, msbuild: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\amd64\\", rx: "ON", upnp: "ON"}
- {vs: Visual Studio 16 2019, os: 2019, msbuild: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\amd64\\", rx: "OFF", upnp: "ON"}
- {vs: Visual Studio 16 2019, os: 2019, msbuild: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\amd64\\", rx: "OFF", upnp: "OFF"}
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "ON", upnp: "ON"}
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "OFF", upnp: "ON"}
- {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "OFF", upnp: "OFF"}
steps:
- name: Checkout repository
@@ -423,14 +423,22 @@ jobs:
mkdir build
cd build
cmake .. -G "${{ matrix.config.vs }}" -DWITH_RANDOMX=${{ matrix.config.rx }} -DWITH_UPNP=${{ matrix.config.upnp }}
& "${{ matrix.config.msbuild }}msbuild" -v:m /m /p:Configuration=Release p2pool.vcxproj
& "${{ matrix.config.vspath }}\\MSBuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Release p2pool.vcxproj
- name: Check Windows 7 compatibility
shell: cmd
run: |
call "${{ matrix.config.vspath }}\\VC\\Auxiliary\\Build\\vcvarsall.bat" amd64
dumpbin /IMPORTS build/Release/p2pool.exe > 1.txt
findstr /R /C:"^ *[0-9A-F][0-9A-F]* [a-zA-Z][a-zA-Z0-9]*$" 1.txt > 2.txt
python tests/src/check_win7.py 2.txt
- name: Run RandomX tests
if: matrix.config.rx == 'ON'
run: |
build/Release/p2pool.exe --test
cd build/external/src/RandomX
& "${{ matrix.config.msbuild }}msbuild" -v:m /m /p:Configuration=Release randomx-tests.vcxproj
& "${{ matrix.config.vspath }}\\MSBuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Release randomx-tests.vcxproj
Release/randomx-tests.exe
- name: Build tests
@@ -439,7 +447,7 @@ jobs:
mkdir build
cd build
cmake .. -G "${{ matrix.config.vs }}"
& "${{ matrix.config.msbuild }}msbuild" -v:m /m /p:Configuration=Debug p2pool_tests.vcxproj
& "${{ matrix.config.vspath }}\\MSBuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Debug p2pool_tests.vcxproj
- name: Run tests
run: |
@@ -450,7 +458,7 @@ jobs:
- name: Archive binary
uses: actions/upload-artifact@v3
with:
name: p2pool-msbuild-${{ matrix.config.os }}-randomx-${{ matrix.config.rx }}-upnp-${{ matrix.config.upnp }}.exe
name: p2pool-vs-${{ matrix.config.os }}-randomx-${{ matrix.config.rx }}-upnp-${{ matrix.config.upnp }}.exe
path: build/Release/p2pool.exe
build-macos:
@@ -533,7 +541,7 @@ jobs:
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_C_FLAGS="-Os -target arm64-apple-macos-11" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF
cmake . -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-Os -target arm64-apple-macos-11" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF
make -j3
cd lib && mkdir .libs && cp libcurl.a .libs
@@ -542,7 +550,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_C_FLAGS='-Os -target arm64-apple-macos-11' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -target arm64-apple-macos-11' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
make -j3
- name: Build libzmq
@@ -550,14 +558,14 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -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_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -target arm64-apple-macos-11' -DCMAKE_CXX_FLAGS='-Os -target arm64-apple-macos-11' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
make -j3
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_C_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_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-target arm64-apple-macos-11" -DCMAKE_CXX_FLAGS="-target arm64-apple-macos-11" -DSTATIC_LIBS=ON -DWITH_LTO=OFF -DARCH_ID=aarch64
make -j3
- name: Archive binary
+7 -7
View File
@@ -47,7 +47,7 @@ Here's the comparison table of the different ways of mining. While pool mining i
* Decentralized: no central server that can be shutdown/blocked. P2Pool uses a separate blockchain to merge mine with Monero. Pool admin can't go rogue or be pressured to do an attack on the network because there is no pool admin!
* Permissionless: there is no one to decide who can mine on the pool and who can't.
* Trustless: there is no pool wallet, funds are never in custody. All pool blocks pay out to miners immediately.
* Trustless: there is no pool wallet, funds are never in custody. All pool blocks pay out to miners directly.
* PPLNS payout scheme
* **0% fee**
* **0 XMR payout fee**
@@ -80,7 +80,7 @@ In order to continue mining on P2Pool, you must update both Monero and P2Pool so
|Monero protocol version|Required Monero software version|Required P2Pool version
|-|-|-|
|v15, v16 (active after August 13th, 2022)|v0.18.0.0 or newer, v0.18.2.2 recommended|v3.0 or newer
|v15, v16 (active after August 13th, 2022)|v0.18.0.0 or newer, v0.18.3.1 is recommended|v3.0 or newer
## How to mine on P2Pool
@@ -119,12 +119,12 @@ 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:
```
./monerod --zmq-pub tcp://127.0.0.1:18083 --out-peers 64 --in-peers 32 --add-priority-node=p2pmd.xmrvsbeast.com:18080 --add-priority-node=nodes.hashvault.pro:18080 --disable-dns-checkpoints --enable-dns-blocklist
./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 --disable-dns-checkpoints --enable-dns-blocklist
```
**Note:**
The `--zmq-pub` option is required for P2Pool to work properly.
`--out-peers 64 --in-peers 32` is needed to (1) have many connections to other nodes and (2) limit incoming connection count because it can grow uncontrollably and cause problems when it goes above 1000 (open files limit in Linux). If your network connection's **upload** bandwidth is less than **10 Mbit**, use `--out-peers 16 --in-peers 8` instead.
`--out-peers 32 --in-peers 64` is needed to (1) have many connections to other nodes and (2) limit incoming connection count because it can grow uncontrollably and cause problems when it goes above 1000 (open files limit in Linux). If your network connection's **upload** bandwidth is less than **10 Mbit**, use `--out-peers 8 --in-peers 16` instead.
`--add-priority-node=p2pmd.xmrvsbeast.com:18080 --add-priority-node=nodes.hashvault.pro:18080` is needed to have guaranteed good working nodes in your connected peers.
@@ -187,12 +187,12 @@ nocreate
8. Start `monerod` with the following command/options:
```
.\Monero\monerod.exe --zmq-pub tcp://127.0.0.1:18083 --out-peers 64 --in-peers 32 --add-priority-node=p2pmd.xmrvsbeast.com:18080 --add-priority-node=nodes.hashvault.pro:18080 --disable-dns-checkpoints --enable-dns-blocklist
.\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 --disable-dns-checkpoints --enable-dns-blocklist
```
**Note:**
The `--zmq-pub` option is required for P2Pool to work properly.
`--out-peers 64 --in-peers 32` is needed to (1) have many connections to other nodes and (2) limit incoming connection count because it can grow uncontrollably and cause problems when it goes above 1000 (open files limit in Linux). If your network connection's **upload** bandwidth is less than **10 Mbit**, use `--out-peers 16 --in-peers 8` instead.
`--out-peers 32 --in-peers 64` is needed to (1) have many connections to other nodes and (2) limit incoming connection count because it can grow uncontrollably and cause problems when it goes above 1000 (open files limit in Linux). If your network connection's **upload** bandwidth is less than **10 Mbit**, use `--out-peers 8 --in-peers 16` instead.
`--add-priority-node=p2pmd.xmrvsbeast.com:18080 --add-priority-node=nodes.hashvault.pro:18080` is needed to have guaranteed good working nodes in your connected peers.
@@ -218,7 +218,7 @@ The `--zmq-pub` option is required for P2Pool to work properly.
13. *(Optional but highly recommended)* You can create a Quickstart by creating a batch (.bat) file with the following contents and placing it in your P2Pool directory along with `xmrig.exe`.
```
@ECHO OFF
start cmd /k %~dp0\Monero\monerod.exe --zmq-pub tcp://127.0.0.1:18083 --out-peers 64 --in-peers 32 --add-priority-node=p2pmd.xmrvsbeast.com:18080 --add-priority-node=nodes.hashvault.pro:18080 --disable-dns-checkpoints --enable-dns-blocklist
start cmd /k %~dp0\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 --disable-dns-checkpoints --enable-dns-blocklist
ECHO Wait until the Monero daemon shows fully synced before continuing. This can take some time. Type 'status' in other window to check progress.
PAUSE
start cmd /k %~dp0\p2pool.exe --wallet YOUR_WALLET_ADDRESS --mini
+1 -1
View File
@@ -35,7 +35,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(GENERAL_FLAGS "${GENERAL_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
endif()
set(WARNING_FLAGS "-Wall -Wextra -Wcast-align -Wcast-qual -Wlogical-op -Wstrict-overflow=2 -Wundef -Wformat=2 -Wpointer-arith -Werror")
set(WARNING_FLAGS "-Wall -Wextra -Wcast-qual -Wlogical-op -Wstrict-overflow=2 -Wundef -Wformat=2 -Wpointer-arith -Werror")
if (DEV_WITH_TSAN OR DEV_WITH_UBSAN OR DEV_WITH_ASAN)
set(OPTIMIZATION_FLAGS "-O2 -g")
+2 -2
View File
@@ -120,8 +120,8 @@ services:
--zmq-pub tcp://0.0.0.0:18083
--disable-dns-checkpoints
--enable-dns-blocklist
--out-peers 32
--in-peers 16
--out-peers 16
--in-peers 32
--add-priority-node=nodes.hashvault.pro:18080
--add-priority-node=p2pmd.xmrvsbeast.com:18080
--non-interactive
+2 -2
View File
@@ -96,8 +96,8 @@ services:
--zmq-pub tcp://0.0.0.0:18083
--disable-dns-checkpoints
--enable-dns-blocklist
--out-peers 32
--in-peers 16
--out-peers 16
--in-peers 32
--add-priority-node=nodes.hashvault.pro:18080
--add-priority-node=p2pmd.xmrvsbeast.com:18080
--non-interactive
+8 -2
View File
@@ -80,9 +80,12 @@ async function load_data() {
let pool_stats_req = await fetch('api/pool/stats');
let pool_blocks_req = await fetch('api/pool/blocks');
let network_stats_req = await fetch('api/network/stats');
let latest_release_req = await fetch('api/latest_release');
let pool_stats = JSON.parse(await pool_stats_req.text());
let pool_blocks = JSON.parse(await pool_blocks_req.text());
let network_stats = JSON.parse(await network_stats_req.text());
let latest_release = JSON.parse(await latest_release_req.text());
let pool_hashrate = pool_stats.pool_statistics.hashRate / 1e6;
let pplns_duration = pool_stats.pool_statistics.pplnsWeight / pool_stats.pool_statistics.hashRate;
@@ -92,6 +95,7 @@ async function load_data() {
document.getElementById("pplns_duration").innerHTML = elapsedTimeStr(0, pplns_duration, 0) + ' ' + Math.floor(pplns_duration % 60) + 's';
document.getElementById("pool_miners").innerHTML = pool_stats.pool_statistics.miners;
document.getElementById("min_payout").innerHTML = min_payout.toFixed(5) + ' XMR';
document.getElementById("latest_release").innerHTML = '<a href="' + latest_release.html_url + '" target="_blank">' + latest_release.name + '</a>';
let ts = Math.floor(Date.now() / 1000);
@@ -190,6 +194,7 @@ function toggle_menu(name) {
</head>
<body onload="load_data();setInterval(load_data, 2000);toggle_menu(window.location.hash.substr(1));">
<div style="font-size:3rem;text-align:center;">P2Pool</div><div style="font-size:1.1rem;text-align:center;">Decentralized Monero mining pool</div>
<div style="font-size:1rem;text-align:center;">Latest release: <span id="latest_release"><a href="https://github.com/SChernykh/p2pool/releases/latest" target="_blank">P2Pool</a></span></div>
<br>
<table id="main_menu" style="width:100%;margin-left:auto;margin-right:auto;table-layout:fixed;text-align:center;-ms-touch-action:none;touch-action:none;"><tr>
<td onclick="toggle_menu('pool')" id="button_pool">Pool</td>
@@ -243,8 +248,8 @@ It's highly recommended to create a new wallet for mining because wallet address
<ul>
<li>Download the latest Monero <a href="https://www.getmonero.org/downloads/" target="_blank">release</a>
<li>[Optional] Open port <span>18080</span> (Monero p2p port) in your firewall to ensure better connectivity
<li>Run <span>./monerod --zmq-pub tcp://127.0.0.1:18083 --out-peers 64 --in-peers 32 --add-priority-node=p2pmd.xmrvsbeast.com:18080 --add-priority-node=nodes.hashvault.pro:18080 --disable-dns-checkpoints --enable-dns-blocklist</span>
<li>If your network connection's upload bandwidth is less than 10 Mbit, use <span>--out-peers 16 --in-peers 8</span> instead.
<li>Run <span>./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 --disable-dns-checkpoints --enable-dns-blocklist</span>
<li>If your network connection's upload bandwidth is less than 10 Mbit, use <span>--out-peers 8 --in-peers 16</span> instead.
<li>Wait until it's fully synchronized. If you didn't run Monero node before, it can take up to several days to synchronize (5-6 hours on a modern PC with fast SSD and fast Internet connection). You can add <span>--prune-blockchain</span> argument to the command line to run a pruned node (3-4 times less disk usage)
</ul></details>
@@ -262,6 +267,7 @@ It's highly recommended to create a new wallet for mining because wallet address
<li>Once P2Pool sync is complete, XMRig should be able to connect to the stratum server on port <span>3333</span>
<li>Run <span>./xmrig -o 127.0.0.1:3333</span>. Note that you don't need to specify wallet address for xmrig. Wallet address set in xmrig config will be ignored!
<li>To set custom fixed difficulty for your miner (for example, <span>10000</span>), run <span>./xmrig -u x+10000 -o 127.0.0.1:3333</span>
<li>To connect another mining rig to your P2Pool node, run <span>./xmrig -o YOUR_P2POOL_NODE_IP:3333</span> on that mining rig
</ul></details>
<details><summary>Checking your progress</summary>
+9 -3
View File
@@ -80,9 +80,12 @@ async function load_data() {
let pool_stats_req = await fetch('api/pool/stats');
let pool_blocks_req = await fetch('api/pool/blocks');
let network_stats_req = await fetch('api/network/stats');
let latest_release_req = await fetch('api/latest_release');
let pool_stats = JSON.parse(await pool_stats_req.text());
let pool_blocks = JSON.parse(await pool_blocks_req.text());
let network_stats = JSON.parse(await network_stats_req.text());
let latest_release = JSON.parse(await latest_release_req.text());
let pool_hashrate = pool_stats.pool_statistics.hashRate / 1e6;
let pplns_duration = pool_stats.pool_statistics.pplnsWeight / pool_stats.pool_statistics.hashRate;
@@ -92,6 +95,7 @@ async function load_data() {
document.getElementById("pplns_duration").innerHTML = elapsedTimeStr(0, pplns_duration, 0) + ' ' + Math.floor(pplns_duration % 60) + 's';
document.getElementById("pool_miners").innerHTML = pool_stats.pool_statistics.miners;
document.getElementById("min_payout").innerHTML = min_payout.toFixed(5) + ' XMR';
document.getElementById("latest_release").innerHTML = '<a href="' + latest_release.html_url + '" target="_blank">' + latest_release.name + '</a>';
let ts = Math.floor(Date.now() / 1000);
@@ -190,6 +194,7 @@ function toggle_menu(name) {
</head>
<body onload="load_data();setInterval(load_data, 2000);toggle_menu(window.location.hash.substr(1));">
<div style="font-size:3rem;text-align:center;">P2Pool mini</div><div style="font-size:1.1rem;text-align:center;">Decentralized Monero mining pool</div>
<div style="font-size:1rem;text-align:center;">Latest release: <span id="latest_release"><a href="https://github.com/SChernykh/p2pool/releases/latest" target="_blank">P2Pool</a></span></div>
<br>
<table id="main_menu" style="width:100%;margin-left:auto;margin-right:auto;table-layout:fixed;text-align:center;-ms-touch-action:none;touch-action:none;"><tr>
<td onclick="toggle_menu('pool')" id="button_pool">Pool</td>
@@ -243,8 +248,8 @@ It's highly recommended to create a new wallet for mining because wallet address
<ul>
<li>Download the latest Monero <a href="https://www.getmonero.org/downloads/" target="_blank">release</a>
<li>[Optional] Open port <span>18080</span> (Monero p2p port) in your firewall to ensure better connectivity
<li>Run <span>./monerod --zmq-pub tcp://127.0.0.1:18083 --out-peers 64 --in-peers 32 --add-priority-node=p2pmd.xmrvsbeast.com:18080 --add-priority-node=nodes.hashvault.pro:18080 --disable-dns-checkpoints --enable-dns-blocklist</span>
<li>If your network connection's upload bandwidth is less than 10 Mbit, use <span>--out-peers 16 --in-peers 8</span> instead.
<li>Run <span>./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 --disable-dns-checkpoints --enable-dns-blocklist</span>
<li>If your network connection's upload bandwidth is less than 10 Mbit, use <span>--out-peers 8 --in-peers 16</span> instead.
<li>Wait until it's fully synchronized. If you didn't run Monero node before, it can take up to several days to synchronize (5-6 hours on a modern PC with fast SSD and fast Internet connection). You can add <span>--prune-blockchain</span> argument to the command line to run a pruned node (3-4 times less disk usage)
</ul></details>
@@ -262,6 +267,7 @@ It's highly recommended to create a new wallet for mining because wallet address
<li>Once P2Pool sync is complete, XMRig should be able to connect to the stratum server on port <span>3333</span>
<li>Run <span>./xmrig -o 127.0.0.1:3333</span>. Note that you don't need to specify wallet address for xmrig. Wallet address set in xmrig config will be ignored!
<li>To set custom fixed difficulty for your miner (for example, <span>10000</span>), run <span>./xmrig -u x+10000 -o 127.0.0.1:3333</span>
<li>To connect another mining rig to your P2Pool node, run <span>./xmrig -o YOUR_P2POOL_NODE_IP:3333</span> on that mining rig
</ul></details>
<details><summary>Checking your progress</summary>
@@ -308,4 +314,4 @@ Donate to support the project:<br><a href="monero:44MnN1f3Eto8DZYUWuE5XZNUtE3vcR
&nbsp;
</div>
</body>
</html>
</html>
+1 -1
View File
@@ -646,7 +646,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
// Layout: [software id, version, random number, sidechain extra_nonce]
uint32_t* sidechain_extra = m_poolBlockTemplate->m_sidechainExtraBuf;
sidechain_extra[0] = 0;
sidechain_extra[0] = static_cast<uint32_t>(SoftwareID::P2Pool);
#ifdef P2POOL_SIDECHAIN_EXTRA_1
sidechain_extra[1] = P2POOL_SIDECHAIN_EXTRA_1;
#else
+16 -3
View File
@@ -202,13 +202,20 @@ static void do_status(p2pool *m_pool, const char * /* args */)
if (m_pool->stratum_server()) {
m_pool->stratum_server()->print_status();
}
if (m_pool->p2p_server()) {
m_pool->p2p_server()->print_status();
P2PServer* p2p = m_pool->p2p_server();
if (p2p) {
p2p->print_status();
}
#ifdef WITH_RANDOMX
m_pool->print_miner_status();
#endif
bkg_jobs_tracker.print_status();
if (p2p) {
p2p->check_for_updates(true);
}
}
static void do_loglevel(p2pool * /* m_pool */, const char *args)
@@ -312,9 +319,15 @@ static void do_exit(p2pool *m_pool, const char * /* args */)
m_pool->stop();
}
static void do_version(p2pool* /* m_pool */, const char* /* args */)
// cppcheck-suppress constParameterCallback
static void do_version(p2pool* m_pool, const char* /* args */)
{
LOGINFO(0, log::LightCyan() << VERSION);
const P2PServer* p2p = m_pool->p2p_server();
if (p2p) {
p2p->check_for_updates(true);
}
}
void ConsoleCommands::allocCallback(uv_handle_t* handle, size_t /*suggested_size*/, uv_buf_t* buf)
+2
View File
@@ -176,6 +176,8 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
} \
} while (0)
curl_easy_setopt_checked(m_handle, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt_checked(m_handle, CURLOPT_WRITEFUNCTION, write_func);
curl_easy_setopt_checked(m_handle, CURLOPT_WRITEDATA, this);
+31 -5
View File
@@ -106,7 +106,26 @@ int p2pool_test()
return 1;
}
randomx_init_dataset(myDataset, myCache, 0, randomx_dataset_item_count());
{
const uint32_t numThreads = std::max(std::thread::hardware_concurrency(), 1U);
const uint32_t numItems = randomx_dataset_item_count();
std::vector<std::thread> threads;
threads.reserve(numThreads);
for (uint32_t i = 1; i < numThreads; ++i) {
const uint32_t a = (numItems * i) / numThreads;
const uint32_t b = (numItems * (i + 1)) / numThreads;
threads.emplace_back([myDataset, myCache, a, b]() { randomx_init_dataset(myDataset, myCache, a, b - a); });
}
randomx_init_dataset(myDataset, myCache, 0, numItems / numThreads);
for (std::thread& t : threads) {
t.join();
}
}
randomx_release_cache(myCache);
randomx_vm* myMachine = randomx_create_vm(flags, nullptr, myDataset);
@@ -115,14 +134,21 @@ int p2pool_test()
return 1;
}
randomx_calculate_hash(myMachine, &myInput, sizeof(myInput) - 1, hash);
memset(hash, 0, sizeof(hash));
memcpy(hash, myInput, sizeof(myInput));
for (size_t i = 0; i < 100; ++i) {
randomx_calculate_hash(myMachine, &hash, sizeof(hash), hash);
}
char buf[RANDOMX_HASH_SIZE * 2 + 1] = {};
p2pool::log::Stream s(buf);
s << p2pool::log::hex_buf(hash, RANDOMX_HASH_SIZE);
s << p2pool::log::hex_buf(hash, RANDOMX_HASH_SIZE) << '\0';
if (memcmp(buf, "639183aae1bf4c9a35884cb46b09cad9175f04efd7684e7262a0ac1c2f0b4e3f", RANDOMX_HASH_SIZE * 2) != 0) {
printf("Invalid hash calculated\n");
constexpr char expected_hash[] = "3b5ecc2bb14f467161a04fe476b541194fba82dbbbfc7c320961f922a0294dee";
if (memcmp(buf, expected_hash, RANDOMX_HASH_SIZE * 2) != 0) {
printf("Invalid hash calculated: expected %s, got %s\n", expected_hash, buf);
return 1;
}
+34
View File
@@ -59,6 +59,7 @@ P2PServer::P2PServer(p2pool* pool)
, m_peerListLastSaved(0)
, m_lookForMissingBlocks(true)
, m_fastestPeer(nullptr)
, m_newP2PoolVersionDetected(false)
{
m_callbackBuf.resize(P2P_BUF_SIZE);
m_blockDeserializeBuf.reserve(MAX_BLOCK_SIZE);
@@ -270,6 +271,9 @@ void P2PServer::update_peer_connections()
bool has_good_peers = false;
m_fastestPeer = nullptr;
uint64_t total_outgoing_p2pool = 0;
uint64_t newer_version_p2pool = 0;
unordered_set<raw_ip> connected_clients;
connected_clients.reserve(m_numConnections);
@@ -303,9 +307,17 @@ void P2PServer::update_peer_connections()
if ((client->m_pingTime >= 0) && (!m_fastestPeer || (m_fastestPeer->m_pingTime > client->m_pingTime))) {
m_fastestPeer = client;
}
if ((client->m_SoftwareID == SoftwareID::P2Pool) && client->m_SoftwareVersion && !client->m_isIncoming) {
++total_outgoing_p2pool;
if (client->m_SoftwareVersion > ((P2POOL_VERSION_MAJOR << 16) | P2POOL_VERSION_MINOR)) {
++newer_version_p2pool;
}
}
}
}
m_newP2PoolVersionDetected = newer_version_p2pool * 5 > total_outgoing_p2pool;
std::vector<Peer> peer_list;
{
MutexLock lock(m_peerListLock);
@@ -1081,6 +1093,7 @@ void P2PServer::on_timer()
update_peer_connections();
check_host();
check_block_template();
check_for_updates();
api_update_local_stats();
}
@@ -1255,6 +1268,27 @@ void P2PServer::check_block_template()
}
}
void P2PServer::check_for_updates(bool forced) const
{
#ifdef DEV_TEST_SYNC
constexpr uint64_t check_interval = 60;
#else
constexpr uint64_t check_interval = 3600;
#endif
if (!forced && (m_timerCounter % (check_interval / m_timerInterval) != 0)) {
return;
}
const SideChain& s = m_pool->side_chain();
if ((forced || s.precalcFinished()) && m_newP2PoolVersionDetected && s.p2pool_update_available()) {
LOGINFO(0, log::LightCyan() << "********************************************************************************");
LOGINFO(0, log::LightCyan() << "* An updated P2Pool version is available, visit p2pool.io for more information *");
LOGINFO(0, log::LightCyan() << "********************************************************************************");
}
}
P2PServer::P2PClient::P2PClient()
: Client(m_p2pReadBuf, sizeof(m_p2pReadBuf))
, m_peerId(0)
+3
View File
@@ -177,6 +177,8 @@ public:
const PoolBlock* find_block(const hash& id) const;
void check_for_updates(bool forced = false) const;
private:
const char* get_log_category() const override;
@@ -259,6 +261,7 @@ private:
unordered_set<uint64_t> m_blockNotifyRequests;
P2PClient* m_fastestPeer;
std::atomic<bool> m_newP2PoolVersionDetected;
static void on_broadcast(uv_async_t* handle) { reinterpret_cast<P2PServer*>(handle->data)->on_broadcast(); }
void on_broadcast();
+26 -2
View File
@@ -1304,6 +1304,30 @@ bool SideChain::get_difficulty(const PoolBlock* tip, std::vector<DifficultyData>
return true;
}
bool SideChain::p2pool_update_available() const
{
constexpr uint32_t version = (P2POOL_VERSION_MAJOR << 16) | P2POOL_VERSION_MINOR;
difficulty_type total_p2pool_diff, newer_p2pool_diff;
{
ReadLock lock(m_sidechainLock);
const PoolBlock* cur = m_chainTip;
for (uint64_t i = 0; (i < m_chainWindowSize) && cur; ++i, cur = get_parent(cur)) {
if (cur->m_sidechainExtraBuf[0] == static_cast<uint32_t>(SoftwareID::P2Pool)) {
total_p2pool_diff += cur->m_difficulty;
if (cur->m_sidechainExtraBuf[1] > version) {
newer_p2pool_diff += cur->m_difficulty;
}
}
}
}
// Assume that a new version is out if >= 20% of hashrate is using it already
return newer_p2pool_diff * 5 >= total_p2pool_diff;
}
void SideChain::verify_loop(PoolBlock* block)
{
// PoW is already checked at this point
@@ -1544,7 +1568,7 @@ void SideChain::verify(PoolBlock* block)
}
// Check that uncle and parent have the same ancestor (they must be on the same chain)
PoolBlock* tmp = parent;
const PoolBlock* tmp = parent;
while (tmp->m_sidechainHeight > uncle->m_sidechainHeight) {
tmp = get_parent(tmp);
if (!tmp) {
@@ -1567,7 +1591,7 @@ void SideChain::verify(PoolBlock* block)
}
bool same_chain = false;
PoolBlock* tmp2 = uncle;
const PoolBlock* tmp2 = uncle;
for (size_t j = 0; (j < UNCLE_BLOCK_DEPTH) && tmp && tmp2 && (tmp->m_sidechainHeight + UNCLE_BLOCK_DEPTH >= block->m_sidechainHeight); ++j) {
if (tmp->m_parent == tmp2->m_parent) {
same_chain = true;
+2
View File
@@ -82,6 +82,8 @@ public:
const PoolBlock* chainTip() const { return m_chainTip; }
bool precalcFinished() const { return m_precalcFinished.load(); }
bool p2pool_update_available() const;
#ifdef P2POOL_UNIT_TESTS
difficulty_type m_testMainChainDiff;
const unordered_map<hash, PoolBlock*>& blocksById() const { return m_blocksById; }
+8
View File
@@ -91,6 +91,14 @@ StratumServer::~StratumServer()
{
shutdown_tcp();
{
MutexLock lock(m_blobsQueueLock);
for (BlobsData* data : m_blobsQueue) {
delete data;
}
}
uv_mutex_destroy(&m_blobsQueueLock);
uv_mutex_destroy(&m_showWorkersLock);
uv_mutex_destroy(&m_rngLock);
+8 -4
View File
@@ -343,9 +343,13 @@ struct BackgroundJobTracker::Impl
{
MutexLock lock(m_lock);
auto it = m_jobs.insert({ name, 1 });
auto it = m_jobs.emplace(name, 1);
if (!it.second) {
++it.first->second;
const int32_t n = ++it.first->second;
// Print the warning only once as the number goes past 20
if (n == 20) {
LOGWARN(3, "Performance warning: there are " << n << " instances of " << name << " running in the background. This shouldn't be normally happening - check logs for other warnings and errors.");
}
}
}
@@ -359,8 +363,8 @@ struct BackgroundJobTracker::Impl
return;
}
--it->second;
if (it->second <= 0) {
const int32_t n = --it->second;
if (n <= 0) {
m_jobs.erase(it);
}
}
+1 -1
View File
@@ -35,7 +35,7 @@
namespace p2pool {
#define P2POOL_VERSION_MAJOR 3
#define P2POOL_VERSION_MINOR 7
#define P2POOL_VERSION_MINOR 8
#define P2POOL_VERSION_PATCH 0
extern const char* VERSION;
+281
View File
@@ -0,0 +1,281 @@
# This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
# Copyright (c) 2021-2023 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/>.
import sys
allowedAPIs = {
"getaddrinfo",
"freeaddrinfo",
"WSAPoll",
"WSACreateEvent",
"WSACloseEvent",
"WSARecvFrom",
"WSASend",
"WSARecv",
"WSADuplicateSocketW",
"WSASocketW",
"WSAIoctl",
"getnameinfo",
"WSASocketA",
"GetAdaptersAddresses",
"GetBestInterface",
"DnsFree",
"LoadLibraryExW",
"RtlPcToFileHeader",
"RtlUnwindEx",
"GetCPInfo",
"GetStringTypeW",
"GetDriveTypeW",
"DecodePointer",
"EncodePointer",
"FreeLibraryAndExitThread",
"SystemTimeToTzSpecificLocalTime",
"CreateThread",
"LCMapStringEx",
"ExitThread",
"GetModuleHandleExW",
"SetStdHandle",
"FlsFree",
"FlsSetValue",
"FlsGetValue",
"SetFilePointer",
"SetEndOfFile",
"UnmapViewOfFile",
"GetLastError",
"FlushViewOfFile",
"CreateFileA",
"CloseHandle",
"CreateFileMappingA",
"MapViewOfFile",
"FlushFileBuffers",
"GetStdHandle",
"WriteConsoleA",
"SetConsoleMode",
"GetConsoleMode",
"FormatMessageA",
"SetThreadPriority",
"GetCurrentThread",
"SetThreadPriorityBoost",
"IsDebuggerPresent",
"Sleep",
"RaiseException",
"InitializeCriticalSection",
"EnterCriticalSection",
"LeaveCriticalSection",
"DeleteCriticalSection",
"QueryPerformanceCounter",
"QueryPerformanceFrequency",
"GetTickCount",
"FreeLibrary",
"GetProcAddress",
"LoadLibraryA",
"SetHandleInformation",
"WaitForSingleObject",
"GetCurrentThreadId",
"TryEnterCriticalSection",
"GetCurrentProcessId",
"GetHandleInformation",
"SetLastError",
"CreateIoCompletionPort",
"GetQueuedCompletionStatusEx",
"InitializeSRWLock",
"ReleaseSRWLockExclusive",
"ReleaseSRWLockShared",
"AcquireSRWLockExclusive",
"AcquireSRWLockShared",
"InitOnceExecuteOnce",
"GetTickCount64",
"GetModuleHandleW",
"SetFileCompletionNotificationModes",
"WideCharToMultiByte",
"DuplicateHandle",
"TryAcquireSRWLockShared",
"InitializeConditionVariable",
"WakeConditionVariable",
"WakeAllConditionVariable",
"SleepConditionVariableCS",
"SetEvent",
"ReleaseSemaphore",
"CreateEventA",
"GetCurrentProcess",
"ResumeThread",
"TlsAlloc",
"TlsGetValue",
"TlsSetValue",
"TlsFree",
"GetNativeSystemInfo",
"CreateSemaphoreA",
"GetFileType",
"PostQueuedCompletionStatus",
"CreateFileW",
"ResetEvent",
"QueueUserWorkItem",
"GetFileAttributesExW",
"UnregisterWait",
"GetNumberOfConsoleInputEvents",
"ReadConsoleInputW",
"ReadConsoleW",
"WriteConsoleW",
"FillConsoleOutputCharacterW",
"FillConsoleOutputAttribute",
"GetConsoleCursorInfo",
"SetConsoleCursorInfo",
"GetConsoleScreenBufferInfo",
"SetConsoleCursorPosition",
"SetConsoleTextAttribute",
"WriteConsoleInputW",
"ReadFile",
"WriteFile",
"ConnectNamedPipe",
"SetNamedPipeHandleState",
"PeekNamedPipe",
"CreateNamedPipeW",
"CancelIoEx",
"CancelSynchronousIo",
"SwitchToThread",
"LocalFree",
"GetNamedPipeHandleStateA",
"GetNamedPipeClientProcessId",
"GetNamedPipeServerProcessId",
"MultiByteToWideChar",
"SetConsoleCtrlHandler",
"SetErrorMode",
"GetQueuedCompletionStatus",
"CreateDirectoryW",
"FindClose",
"FindFirstFileW",
"FindNextFileW",
"RtlUnwind",
"GetFileAttributesW",
"GetFileInformationByHandle",
"GetFileSizeEx",
"GetFinalPathNameByHandleW",
"GetFullPathNameW",
"RemoveDirectoryW",
"SetFilePointerEx",
"SetFileTime",
"DeviceIoControl",
"GetSystemInfo",
"GetSystemTimeAsFileTime",
"ReOpenFile",
"CopyFileW",
"MoveFileExW",
"CreateHardLinkW",
"GetFileInformationByHandleEx",
"CreateSymbolicLinkW",
"CancelIo",
"DebugBreak",
"GetCurrentDirectoryW",
"TerminateProcess",
"GetExitCodeProcess",
"UnregisterWaitEx",
"LCMapStringW",
"GetLongPathNameW",
"ReadDirectoryChangesW",
"GetEnvironmentStringsW",
"FreeEnvironmentStringsW",
"SetEnvironmentVariableW",
"GetModuleFileNameW",
"FileTimeToSystemTime",
"GetModuleHandleA",
"LoadLibraryExA",
"GetStartupInfoW",
"FormatMessageW",
"InitializeCriticalSectionEx",
"GetSystemDirectoryA",
"WaitForSingleObjectEx",
"GetEnvironmentVariableA",
"SleepEx",
"VerSetConditionMask",
"VerifyVersionInfoW",
"VirtualProtect",
"VirtualFree",
"VirtualAlloc",
"GetLargePageMinimum",
"HeapFree",
"HeapAlloc",
"GetProcessHeap",
"FlsAlloc",
"SleepConditionVariableSRW",
"GetExitCodeThread",
"InitializeSListHead",
"CreateEventW",
"InitializeCriticalSectionAndSpinCount",
"IsProcessorFeaturePresent",
"SetUnhandledExceptionFilter",
"UnhandledExceptionFilter",
"RtlVirtualUnwind",
"RtlLookupFunctionEntry",
"SetFileAttributesW",
"GetConsoleOutputCP",
"ExitProcess",
"GetCommandLineA",
"GetCommandLineW",
"GetDateFormatW",
"GetTimeFormatW",
"CompareStringW",
"GetLocaleInfoW",
"IsValidLocale",
"GetUserDefaultLCID",
"EnumSystemLocalesW",
"HeapReAlloc",
"HeapSize",
"FindFirstFileExW",
"IsValidCodePage",
"GetACP",
"GetOEMCP",
"GetTimeZoneInformation",
"RegisterWaitForSingleObject",
"GetDiskFreeSpaceW",
"RtlCaptureContext",
"GetMessageA",
"GetSystemMetrics",
"MapVirtualKeyW",
"DispatchMessageA",
"TranslateMessage",
"AdjustTokenPrivileges",
"LookupPrivilegeValueA",
"CryptDestroyHash",
"CryptHashData",
"CryptCreateHash",
"CryptGetHashParam",
"CryptReleaseContext",
"CryptAcquireContextA",
"SystemFunction036",
"OpenProcessToken",
"SetSecurityDescriptorDacl",
"InitializeSecurityDescriptor",
"BCryptGenRandom",
"GetConsoleCP",
}
f = open(sys.argv[1], 'r')
lines = f.readlines()
f.close()
exit_code = 0
count = 0
for line in lines:
count += 1
api = line[29:].strip()
if api not in allowedAPIs:
print('API call "{}" is not checked for Windows 7 compatibility. Check it and then add it to the list in tests/src/check_imports.py'.format(api))
exit_code = 1
if exit_code == 0:
print('{} imports checked successfully'.format(count))
sys.exit(exit_code)