Fixed consensus ID format mismatch, riscv64 SIGSEGV, shadow variable

This commit is contained in:
Matt Hess
2025-12-22 22:45:35 +00:00
parent 33bb2a81a6
commit 72d7263e14
3 changed files with 12 additions and 5 deletions

View File

@@ -2,3 +2,7 @@ unmatchedSuppression
missingIncludeSystem
unusedFunction
useStlAlgorithm
constParameterReference
constVariableReference
functionStatic
constParameter

View File

@@ -87,7 +87,7 @@ static size_t build_transcript(uint8_t* buf, const char (&domain_sep)[N])
// Debug helper to print hex
static void debug_hex(const char* label, const uint8_t* data, size_t len)
{
static constexpr char log_category_prefix[] = "CarrotCrypto ";
// Uses log_category_prefix from LOG_CATEGORY(CarrotCrypto) macro
char hex[130] = {0};
for (size_t i = 0; i < len && i < 64; ++i) {
snprintf(hex + i*2, 3, "%02x", data[i]);

View File

@@ -59,7 +59,8 @@ static constexpr uint64_t MONERO_BLOCK_TIME = 120;
namespace p2pool {
static constexpr uint8_t default_consensus_id[HASH_SIZE] = { 83,65,76,86,181,11,104,146,227,153,218,107,44,108,68,39,178,81,4,212,169,4,142,0,177,110,157,240,68,7,249,24 };
// Consensus ID for salvium_main: computed from "mainnet\0salvium_main\0\010\0100000\02160\020\0"
static constexpr uint8_t default_consensus_id[HASH_SIZE] = { 4,45,231,71,15,85,219,190,194,167,8,240,43,43,125,49,227,192,250,144,117,138,59,226,222,163,164,69,170,215,106,74 };
static constexpr uint8_t mini_consensus_id[HASH_SIZE] = { 83,65,76,77,149,174,199,250,66,80,189,18,108,216,194,220,136,23,63,24,64,113,221,44,219,86,39,163,53,24,126,196 };
static constexpr uint8_t nano_consensus_id[HASH_SIZE] = { 83,65,76,78,210,226,114,99,250,145,221,96,13,216,23,63,104,53,129,168,244,80,141,138,157,250,50,54,37,189,5,89 };
@@ -129,9 +130,11 @@ SideChain::SideChain(p2pool* pool, NetworkType type, const char* pool_name, cons
<< m_chainWindowSize << '\0'
<< m_unclePenalty << '\0';
constexpr char default_config[] = "salvium_main\0" "salvium_main\0" "\0" "10\0" "100000\0" "2160\0" "20\0";
constexpr char mini_config[] = "salvium_mini\0" "salvium_mini\0" "\0" "10\0" "100000\0" "2160\0" "20\0";
constexpr char nano_config[] = "salvium_nano\0" "salvium_nano\0" "\0" "30\0" "100000\0" "2160\0" "10\0";
// Format: network_type\0pool_name\0password\0block_time\0min_diff\0window_size\0uncle_penalty\0
// Note: Network type is serialized as "mainnet"/"testnet"/"stagenet" by log::Stream::Entry<NetworkType>
constexpr char default_config[] = "mainnet\0" "salvium_main\0" "\0" "10\0" "100000\0" "2160\0" "20\0";
constexpr char mini_config[] = "mainnet\0" "salvium_mini\0" "\0" "10\0" "100000\0" "2160\0" "20\0";
constexpr char nano_config[] = "mainnet\0" "salvium_nano\0" "\0" "30\0" "100000\0" "2160\0" "10\0";
// Hardcoded default consensus ID
if ((s.m_pos == sizeof(default_config) - 1) && (memcmp(buf, default_config, sizeof(default_config) - 1) == 0)) {