From fe1f36c7fe1efa898f2ad435720113702e68ec60 Mon Sep 17 00:00:00 2001 From: Matt Hess Date: Wed, 14 Jan 2026 05:30:33 +0000 Subject: [PATCH] Increase genesis wait, add 2nd seed, resolve circular checkpoint request issue --- src/p2p_server.cpp | 15 ++++++++------- src/p2pool.cpp | 2 +- src/side_chain.cpp | 17 +++++++++++------ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/p2p_server.cpp b/src/p2p_server.cpp index 5dcf064..5b8ba3d 100644 --- a/src/p2p_server.cpp +++ b/src/p2p_server.cpp @@ -52,9 +52,9 @@ LOG_CATEGORY(P2PServer) static constexpr char saved_peer_list_file_name[] = "p2pool_peers.txt"; static constexpr char saved_onion_peer_list_file_name[] = "p2pool_onion_peers.txt"; -static const char* seed_nodes[] = { "seed01.whiskymine.io", "" }; -static const char* seed_nodes_mini[] = { "seed01.whiskymine.io", "" }; -static const char* seed_nodes_nano[] = { "seed01.whiskymine.io", "" }; +static const char* seed_nodes[] = { "seed01.whiskymine.io", "seed02.whiskymine.io", "" }; +static const char* seed_nodes_mini[] = { "seed01.whiskymine.io", "seed02.whiskymine.io", "" }; +static const char* seed_nodes_nano[] = { "seed01.whiskymine.io", "seed02.whiskymine.io", "" }; static constexpr int DEFAULT_BACKLOG = 16; static constexpr uint64_t DEFAULT_BAN_TIME = 600; @@ -3329,11 +3329,11 @@ bool P2PServer::P2PClient::on_checkpoint_request() return true; } - // Send checkpoint response + // Send checkpoint response (cap at CHECKPOINT_HISTORY for compatibility) const bool result = server->send(this, [&checkpoints, this](uint8_t* buf, size_t buf_size) -> size_t { - const uint32_t count = static_cast(checkpoints.size()); + const uint32_t count = static_cast(std::min(checkpoints.size(), static_cast(SideChain::CHECKPOINT_HISTORY))); const size_t msg_size = 1 + sizeof(uint32_t) + count * (sizeof(uint64_t) + HASH_SIZE + sizeof(uint64_t) + sizeof(uint64_t)); if (buf_size < msg_size) { @@ -3350,8 +3350,9 @@ bool P2PServer::P2PClient::on_checkpoint_request() memcpy(p, &count, sizeof(uint32_t)); p += sizeof(uint32_t); - // Checkpoint data - for (const Checkpoint& cp : checkpoints) { + // Checkpoint data (send only count entries) + for (uint32_t i = 0; i < count; ++i) { + const Checkpoint& cp = checkpoints[i]; // Height memcpy(p, &cp.height, sizeof(uint64_t)); p += sizeof(uint64_t); diff --git a/src/p2pool.cpp b/src/p2pool.cpp index dc240de..777b5ce 100644 --- a/src/p2pool.cpp +++ b/src/p2pool.cpp @@ -1464,7 +1464,7 @@ void p2pool::download_block_headers4(uint64_t start_height, uint64_t current_hei // Genesis node escape: if we created genesis and have no peers, proceed const P2PServer* server = m_p2pServer.load(); - if (server && server->num_connections() == 0 && genesis_wait_count >= 6) { + if (server && server->num_connections() == 0 && genesis_wait_count >= 24) { LOGINFO(0, log::LightGreen() << "########################################"); LOGINFO(0, log::LightGreen() << "GENESIS NODE - MINING IS NOW ENABLED"); LOGINFO(0, log::LightGreen() << "########################################"); diff --git a/src/side_chain.cpp b/src/side_chain.cpp index d4a3750..4d0c1a9 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -2226,14 +2226,19 @@ void SideChain::update_chain_tip(PoolBlock* block) } const PoolBlock* current_tip = m_chainTip.load(); - bool have_checkpoint = false; - { - ReadLock cpLock(m_checkpointsLock); - have_checkpoint = !m_checkpoints.empty(); - } // Only enable mining when tip is verified at low depth (real-time, not catch-up) - if (current_tip && current_tip->m_verified && have_checkpoint && current_tip->m_depth < 10) { + // Note: checkpoints are bootstrapped later, don't require them here + if (current_tip && current_tip->m_verified && current_tip->m_depth < 10) { m_readyToMine.store(true); + // Bootstrap checkpoints from verified tip if we don't have any + bool need_checkpoint_bootstrap = false; + { + ReadLock cpLock(m_checkpointsLock); + need_checkpoint_bootstrap = m_checkpoints.empty(); + } + if (need_checkpoint_bootstrap) { + update_checkpoints(current_tip->m_sidechainHeight); + } } }