Increase genesis wait, add 2nd seed, resolve circular checkpoint request issue
This commit is contained in:
@@ -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<uint32_t>(checkpoints.size());
|
||||
const uint32_t count = static_cast<uint32_t>(std::min(checkpoints.size(), static_cast<size_t>(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);
|
||||
|
||||
@@ -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() << "########################################");
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user