Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a8582b2a0f | |||
| 8493dbc47b | |||
| 602b9e2ae9 | |||
| 103a2cbd4f | |||
| e4b11ecab4 | |||
| 781606bec5 | |||
| f4d709c0dd | |||
| 8699e1887c | |||
| bf39319cbb | |||
| e92ce0a5f3 | |||
| f7b90b3808 |
@@ -15,7 +15,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
cppcheck-ubuntu:
|
cppcheck-ubuntu:
|
||||||
|
|
||||||
timeout-minutes: 50
|
timeout-minutes: 60
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -60,7 +60,7 @@ jobs:
|
|||||||
|
|
||||||
cppcheck-windows:
|
cppcheck-windows:
|
||||||
|
|
||||||
timeout-minutes: 50
|
timeout-minutes: 60
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -349,13 +349,15 @@ jobs:
|
|||||||
& "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Debug p2pool.vcxproj
|
& "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Debug p2pool.vcxproj
|
||||||
|
|
||||||
- name: Run p2pool
|
- name: Run p2pool
|
||||||
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
|
call "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvarsall.bat" amd64
|
||||||
cd build/Debug
|
cd build/Debug
|
||||||
mkdir data
|
mkdir data
|
||||||
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 1"
|
start python ../../tests/src/stratum_dummy.py 1
|
||||||
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 2"
|
start python ../../tests/src/stratum_dummy.py 2
|
||||||
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 3"
|
start python ../../tests/src/stratum_dummy.py 3
|
||||||
./p2pool.exe --host xmrnode.facspro.net --rpc-port 18089 --zmq-port 18084 --host xmr2.rs.me --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
p2pool.exe --host xmrnode.facspro.net --rpc-port 18089 --zmq-port 18084 --host xmr2.rs.me --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
|
||||||
|
|
||||||
- name: Check p2pool.log
|
- name: Check p2pool.log
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ cmake ..
|
|||||||
make -j$(nproc)
|
make -j$(nproc)
|
||||||
```
|
```
|
||||||
|
|
||||||
### [Arch Linux](https://archlinux.org/packages/community/x86_64/p2pool/)
|
### [Arch Linux](https://archlinux.org/packages/extra/x86_64/p2pool/)
|
||||||
|
|
||||||
```
|
```
|
||||||
pacman -S p2pool
|
pacman -S p2pool
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||||
set(GENERAL_FLAGS "/MP")
|
set(GENERAL_FLAGS "/MP /EHa")
|
||||||
set(WARNING_FLAGS "/Wall /WX /sdl")
|
set(WARNING_FLAGS "/Wall /WX /sdl")
|
||||||
set(SECURITY_FLAGS "/GS /guard:cf")
|
set(SECURITY_FLAGS "/GS /guard:cf")
|
||||||
set(OPTIMIZATION_FLAGS "/O2 /Oi /Ob2 /Ot /DNDEBUG /GL")
|
set(OPTIMIZATION_FLAGS "/O2 /Oi /Ob2 /Ot /DNDEBUG /GL")
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
#pragma warning(disable : 4005 4061 4324 4365 4464 4619 4625 4626 4668 4710 4711 4804 4820 5039 5045 5220 5246 5264)
|
#pragma warning(disable : 4005 4061 4324 4365 4464 4619 4625 4626 4668 4710 4711 4714 4804 4820 5039 5045 5220 5246 5264)
|
||||||
#define FORCEINLINE __forceinline
|
#define FORCEINLINE __forceinline
|
||||||
#define NOINLINE __declspec(noinline)
|
#define NOINLINE __declspec(noinline)
|
||||||
#define LIKELY(expression) expression
|
#define LIKELY(expression) expression
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ void generate_keys(hash& pub, hash& sec)
|
|||||||
ge_p3_tobytes(pub.h, &point);
|
ge_p3_tobytes(pub.h, &point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cppcheck-suppress constParameterReference
|
||||||
void generate_keys_deterministic(hash& pub, hash& sec, const uint8_t* entropy, size_t len)
|
void generate_keys_deterministic(hash& pub, hash& sec, const uint8_t* entropy, size_t len)
|
||||||
{
|
{
|
||||||
uint32_t counter = 0;
|
uint32_t counter = 0;
|
||||||
|
|||||||
+72
-7
@@ -44,8 +44,66 @@ bool CONSOLE_COLORS = true;
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static const HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);
|
static const HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
static const HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
static const HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
static const HANDLE hStdErr = GetStdHandle(STD_ERROR_HANDLE);
|
|
||||||
#endif
|
#if defined(_MSC_VER) && !defined(NDEBUG)
|
||||||
|
|
||||||
|
#include <DbgHelp.h>
|
||||||
|
|
||||||
|
#pragma comment(lib, "Dbghelp.lib")
|
||||||
|
|
||||||
|
LONG WINAPI UnhandledExceptionFilter(_In_ _EXCEPTION_POINTERS* exception_pointers)
|
||||||
|
{
|
||||||
|
constexpr size_t MAX_FRAMES = 32;
|
||||||
|
|
||||||
|
void* stack_trace[MAX_FRAMES] = {};
|
||||||
|
DWORD hash;
|
||||||
|
CaptureStackBackTrace(1, MAX_FRAMES, stack_trace, &hash);
|
||||||
|
|
||||||
|
char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)] = {};
|
||||||
|
PSYMBOL_INFO pSymbol = reinterpret_cast<PSYMBOL_INFO>(buffer);
|
||||||
|
|
||||||
|
pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
|
||||||
|
pSymbol->MaxNameLen = MAX_SYM_NAME;
|
||||||
|
|
||||||
|
IMAGEHLP_LINE64 line{};
|
||||||
|
line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
|
||||||
|
|
||||||
|
const HANDLE h = GetCurrentProcess();
|
||||||
|
|
||||||
|
const uint32_t code = (exception_pointers && exception_pointers->ExceptionRecord) ? exception_pointers->ExceptionRecord->ExceptionCode : 0;
|
||||||
|
|
||||||
|
fprintf(stderr, "\n\nUnhandled exception %X at:\n", code);
|
||||||
|
fflush(stderr);
|
||||||
|
|
||||||
|
for (size_t j = 0; j < MAX_FRAMES; ++j) {
|
||||||
|
const DWORD64 address = reinterpret_cast<DWORD64>(stack_trace[j]);
|
||||||
|
DWORD t = 0;
|
||||||
|
if (SymFromAddr(h, address, nullptr, pSymbol) && SymGetLineFromAddr64(h, address, &t, &line)) {
|
||||||
|
fprintf(stderr, "%s (%s, line %lu)\n", line.FileName, pSymbol->Name, line.LineNumber);
|
||||||
|
fflush(stderr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "\n\n");
|
||||||
|
fflush(stderr);
|
||||||
|
|
||||||
|
// Normal logging might be broken at this point, but try to log it anyway
|
||||||
|
LOGERR(0, "Unhandled exception " << log::Hex(code) << " at:");
|
||||||
|
|
||||||
|
for (size_t j = 0; j < MAX_FRAMES; ++j) {
|
||||||
|
const DWORD64 address = reinterpret_cast<DWORD64>(stack_trace[j]);
|
||||||
|
DWORD t = 0;
|
||||||
|
if (SymFromAddr(h, address, nullptr, pSymbol) && SymGetLineFromAddr64(h, address, &t, &line)) {
|
||||||
|
LOGERR(0, line.FileName << " (" << static_cast<const char*>(pSymbol->Name) << ", line " << static_cast<size_t>(line.LineNumber) << ')');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Sleep(1000);
|
||||||
|
|
||||||
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
}
|
||||||
|
#endif // _MSC_VER && !NDEBUG
|
||||||
|
#endif // _WIN32
|
||||||
|
|
||||||
class Worker
|
class Worker
|
||||||
{
|
{
|
||||||
@@ -62,6 +120,11 @@ public:
|
|||||||
, m_started{ false }
|
, m_started{ false }
|
||||||
, m_stopped(false)
|
, m_stopped(false)
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32) && defined(_MSC_VER) && !defined(NDEBUG)
|
||||||
|
SetUnhandledExceptionFilter(UnhandledExceptionFilter);
|
||||||
|
SymInitialize(GetCurrentProcess(), NULL, TRUE);
|
||||||
|
#endif
|
||||||
|
|
||||||
set_main_thread();
|
set_main_thread();
|
||||||
|
|
||||||
std::setlocale(LC_ALL, "en_001");
|
std::setlocale(LC_ALL, "en_001");
|
||||||
@@ -140,6 +203,10 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_logFile.close();
|
m_logFile.close();
|
||||||
|
|
||||||
|
#if defined(_WIN32) && defined(_MSC_VER) && !defined(NDEBUG)
|
||||||
|
SymCleanup(GetCurrentProcess());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCEINLINE void write(const char* buf, uint32_t size)
|
FORCEINLINE void write(const char* buf, uint32_t size)
|
||||||
@@ -245,12 +312,7 @@ private:
|
|||||||
strip_colors(p, size);
|
strip_colors(p, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
DWORD k;
|
|
||||||
WriteConsole((severity == 1) ? hStdOut : hStdErr, p, size, &k, nullptr);
|
|
||||||
#else
|
|
||||||
fwrite(p, 1, size, (severity == 1) ? stdout : stderr);
|
fwrite(p, 1, size, (severity == 1) ? stdout : stderr);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (m_logFile.is_open()) {
|
if (m_logFile.is_open()) {
|
||||||
if (c) {
|
if (c) {
|
||||||
@@ -289,6 +351,9 @@ private:
|
|||||||
m_logFile.open(log_file_name, std::ios::app | std::ios::binary);
|
m_logFile.open(log_file_name, std::ios::app | std::ios::binary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fflush(stdout);
|
||||||
|
fflush(stderr);
|
||||||
} while (1);
|
} while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
// Simple memory leak detector for Windows users, works best in RelWithDebInfo configuration.
|
// Simple memory leak detector for Windows users, works best in RelWithDebInfo configuration.
|
||||||
#if defined(_WIN32) && defined(DEV_TRACK_MEMORY)
|
#if defined(_WIN32) && defined(DEV_TRACK_MEMORY) && defined(_MSC_VER) && !defined(NDEBUG)
|
||||||
|
|
||||||
#include "uv_util.h"
|
#include "uv_util.h"
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
@@ -270,8 +270,6 @@ void memory_tracking_start()
|
|||||||
// Trigger std::ostream initialization to avoid reporting it as leaks
|
// Trigger std::ostream initialization to avoid reporting it as leaks
|
||||||
std::cout << "Memory leak detection = " << 1 << std::endl;
|
std::cout << "Memory leak detection = " << 1 << std::endl;
|
||||||
|
|
||||||
SymInitialize(GetCurrentProcess(), NULL, TRUE);
|
|
||||||
|
|
||||||
using namespace p2pool;
|
using namespace p2pool;
|
||||||
|
|
||||||
uv_replace_allocator(malloc_hook, realloc_hook, calloc_hook, free_hook);
|
uv_replace_allocator(malloc_hook, realloc_hook, calloc_hook, free_hook);
|
||||||
@@ -307,8 +305,6 @@ bool memory_tracking_stop()
|
|||||||
printf("No memory leaks detected\n\n");
|
printf("No memory leaks detected\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
SymCleanup(h);
|
|
||||||
|
|
||||||
return (total_leaks == 0);
|
return (total_leaks == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -34,8 +34,8 @@
|
|||||||
LOG_CATEGORY(P2PServer)
|
LOG_CATEGORY(P2PServer)
|
||||||
|
|
||||||
static constexpr char saved_peer_list_file_name[] = "p2pool_peers.txt";
|
static constexpr char saved_peer_list_file_name[] = "p2pool_peers.txt";
|
||||||
static const char* seed_nodes[] = { "seeds.p2pool.io", "main.p2poolpeers.net", ""};
|
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", "" };
|
static const char* seed_nodes_mini[] = { "seeds-mini.p2pool.io", "mini.p2poolpeers.net", "mini.gupax.io", "" };
|
||||||
|
|
||||||
static constexpr int DEFAULT_BACKLOG = 16;
|
static constexpr int DEFAULT_BACKLOG = 16;
|
||||||
static constexpr uint64_t DEFAULT_BAN_TIME = 600;
|
static constexpr uint64_t DEFAULT_BAN_TIME = 600;
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ bool StratumServer::on_submit(StratumClient* client, uint32_t id, const char* jo
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
BlockTemplate& block = m_pool->block_template();
|
const BlockTemplate& block = m_pool->block_template();
|
||||||
uint64_t height, sidechain_height;
|
uint64_t height, sidechain_height;
|
||||||
difficulty_type mainchain_diff, sidechain_diff;
|
difficulty_type mainchain_diff, sidechain_diff;
|
||||||
|
|
||||||
|
|||||||
+19
-12
@@ -508,22 +508,29 @@ bool get_dns_txt_records_base(const std::string& host, Callback<void, const char
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
PDNS_RECORD pQueryResults;
|
try {
|
||||||
if (DnsQuery(host.c_str(), DNS_TYPE_TEXT, DNS_QUERY_STANDARD, NULL, &pQueryResults, NULL) != 0) {
|
PDNS_RECORD pQueryResults;
|
||||||
return false;
|
if (DnsQuery(host.c_str(), DNS_TYPE_TEXT, DNS_QUERY_STANDARD, NULL, &pQueryResults, NULL) != 0) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (PDNS_RECORD p = pQueryResults; p; p = p->pNext) {
|
for (PDNS_RECORD p = pQueryResults; p; p = p->pNext) {
|
||||||
for (size_t j = 0; j < p->Data.TXT.dwStringCount; ++j) {
|
for (size_t j = 0; j < p->Data.TXT.dwStringCount; ++j) {
|
||||||
const char* s = p->Data.TXT.pStringArray[j];
|
const char* s = p->Data.TXT.pStringArray[j];
|
||||||
const size_t n = strlen(s);
|
if (s) {
|
||||||
if (n > 0) {
|
const size_t n = strlen(s);
|
||||||
callback(s, n);
|
if (n > 0) {
|
||||||
|
callback(s, n);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
DnsRecordListFree(pQueryResults, DnsFreeRecordList);
|
DnsRecordListFree(pQueryResults, DnsFreeRecordList);
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
#elif defined(HAVE_RES_QUERY)
|
#elif defined(HAVE_RES_QUERY)
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@
|
|||||||
namespace p2pool {
|
namespace p2pool {
|
||||||
|
|
||||||
#define P2POOL_VERSION_MAJOR 3
|
#define P2POOL_VERSION_MAJOR 3
|
||||||
#define P2POOL_VERSION_MINOR 8
|
#define P2POOL_VERSION_MINOR 9
|
||||||
#define P2POOL_VERSION_PATCH 0
|
#define P2POOL_VERSION_PATCH 0
|
||||||
|
|
||||||
extern const char* VERSION;
|
extern const char* VERSION;
|
||||||
|
|||||||
Reference in New Issue
Block a user