From 8fc5e5013c619797657ca9fded1d95ba509ac473 Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Sun, 9 Jun 2024 21:21:52 +0200 Subject: [PATCH] Fix: update peer height on block notify --- src/p2p_server.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/p2p_server.cpp b/src/p2p_server.cpp index bb4b02c..602b1ee 100644 --- a/src/p2p_server.cpp +++ b/src/p2p_server.cpp @@ -2457,7 +2457,11 @@ void P2PServer::P2PClient::on_block_notify(const uint8_t* buf) P2PServer* server = static_cast(m_owner); // If we don't know about this block, request it from this peer. The peer can do it to speed up our initial sync, for example. - if (!server->find_block(id)) { + const PoolBlock* block = server->find_block(id); + if (block) { + m_broadcastMaxHeight = std::max(m_broadcastMaxHeight, block->m_sidechainHeight); + } + else { LOGINFO(6, "Received an unknown block " << id << " in BLOCK_NOTIFY"); if (m_blockPendingRequests.size() >= 25) {