CI: sync test - added merge mining

This commit is contained in:
SChernykh
2025-06-05 23:22:11 +02:00
parent 8d639bfcf2
commit 54d278643d
4 changed files with 65 additions and 15 deletions
+24
View File
@@ -21,6 +21,22 @@
#include "stratum_server.h"
#include "p2p_server.h"
#include <curl/curl.h>
#ifdef WITH_GRPC
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4574)
#endif
#include <grpc/grpc.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // WITH_GRPC
#include <filesystem>
#ifdef WITH_RANDOMX
@@ -251,6 +267,10 @@ int main(int argc, char* argv[])
return result;
}
#ifdef WITH_GRPC
grpc_init();
#endif
try {
p2pool::p2pool pool(argc, argv);
result = pool.run();
@@ -259,6 +279,10 @@ int main(int argc, char* argv[])
result = 1;
}
#ifdef WITH_GRPC
grpc_shutdown();
#endif
curl_global_cleanup();
p2pool::destroy_crypto_cache();
+33 -7
View File
@@ -48,8 +48,10 @@ struct TrackedAllocation
FORCEINLINE bool operator<(const TrackedAllocation& rhs) { return memcmp(stack_trace, rhs.stack_trace, sizeof(stack_trace)) < 0; }
FORCEINLINE bool operator==(const TrackedAllocation& rhs) { return memcmp(stack_trace, rhs.stack_trace, sizeof(stack_trace)) == 0; }
void print(HANDLE h) const
void print(HANDLE h, bool& is_grpc) const
{
is_grpc = false;
char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)] = {};
PSYMBOL_INFO pSymbol = reinterpret_cast<PSYMBOL_INFO>(buffer);
@@ -66,13 +68,21 @@ struct TrackedAllocation
if (SymFromAddr(h, address, &t1, pSymbol) && SymGetLineFromAddr64(h, address, &t2, &line)) {
const char* s = line.FileName;
const char* file_name = nullptr;
while (*s) {
if ((*s == '\\') || (*s == '/')) {
file_name = s + 1;
}
++s;
}
printf("%-25s %s (line %lu)\n", file_name ? file_name : line.FileName, pSymbol->Name, line.LineNumber);
s = pSymbol->Name;
printf("%-25s %s (line %lu)\n", file_name ? file_name : line.FileName, s, line.LineNumber);
if (!is_grpc && ((strstr(s, "grpc::") == s) || (strstr(s, "grpc_core::") == s) || (strstr(s, "grpc_init") == s))) {
is_grpc = true;
}
}
}
printf("\n");
@@ -130,7 +140,8 @@ void show_top_10_allocations()
for (TrackedAllocation* p = buf; (p < buf + 10) && (p < end); ++p) {
printf("%I64u bytes allocated at:\n", p->allocated_size);
p->print(h);
bool is_grpc;
p->print(h, is_grpc);
}
}
@@ -314,21 +325,36 @@ bool memory_tracking_stop()
const HANDLE h = GetCurrentProcess();
uint64_t total_leaks = 0;
uint64_t grpc_leaks = 0;
for (uint32_t i = 0; i < N; ++i) {
const TrackedAllocation& t = allocations[i];
if (t.allocated_size) {
total_leaks += t.allocated_size;
printf("Memory leak detected, %I64u bytes allocated at %p by thread %u:\n", t.allocated_size, t.p, t.thread_id);
t.print(h);
bool is_grpc;
t.print(h, is_grpc);
if (is_grpc) {
printf("^^^ grpc leak ^^^\n\n");
grpc_leaks += t.allocated_size;
}
else {
printf("^^^ non-grpc leak ^^^\n\n");
total_leaks += t.allocated_size;
}
}
}
if (total_leaks > 0) {
printf("%I64u bytes leaked\n\n", total_leaks);
}
else {
if (grpc_leaks > 0) {
printf("%I64u bytes leaked by gRPC\n\n", grpc_leaks);
}
if ((total_leaks == 0) && (grpc_leaks == 0)) {
printf("No memory leaks detected\n\n");
}
+1 -1
View File
@@ -669,7 +669,7 @@ void p2pool::update_aux_data(const hash& chain_id)
aux_id.emplace_back(c.aux_id);
}
}
else {
else if (mm_donation_params_last_updated) {
LOGINFO(5, "update_aux_data: merge mining donation data is stale, not using it");
}
#endif