From 3d60ae8c3288b8c61d2674e9f842748cdced118a Mon Sep 17 00:00:00 2001 From: SChernykh Date: Thu, 28 Oct 2021 18:47:28 +0200 Subject: [PATCH] Fix: don't start until monerod is fully synchronized --- src/p2pool.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/p2pool.cpp b/src/p2pool.cpp index 6efdc4e..9ecf393 100644 --- a/src/p2pool.cpp +++ b/src/p2pool.cpp @@ -688,18 +688,22 @@ void p2pool::parse_get_info_rpc(const char* data, size_t size) const auto& result = doc["result"]; struct { - bool busy_syncing, mainnet, testnet, stagenet; + bool busy_syncing, synchronized, mainnet, testnet, stagenet; } info; - if (!PARSE(result, info, busy_syncing) || !PARSE(result, info, mainnet) || !PARSE(result, info, testnet) || !PARSE(result, info, stagenet)) { + if (!PARSE(result, info, busy_syncing) || + !PARSE(result, info, synchronized) || + !PARSE(result, info, mainnet) || + !PARSE(result, info, testnet) || + !PARSE(result, info, stagenet)) { LOGWARN(1, "get_info RPC response is invalid, trying again in 1 second"); std::this_thread::sleep_for(std::chrono::milliseconds(1000)); get_info(); return; } - if (info.busy_syncing) { - LOGINFO(1, "monerod is busy syncing, trying again in 1 second"); + if (info.busy_syncing || !info.synchronized) { + LOGINFO(1, "monerod is " << (info.busy_syncing ? "busy syncing" : "not synchronized") << ", trying again in 1 second"); std::this_thread::sleep_for(std::chrono::milliseconds(1000)); get_info(); return;