From 9431fab06e454694cb569948b70fab2cabb00cf3 Mon Sep 17 00:00:00 2001 From: Oleh Nikolaiev Date: Fri, 12 Jan 2024 18:53:42 +0000 Subject: [PATCH] IS-902 check block number to download snapshot --- libweb3jsonrpc/Skale.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libweb3jsonrpc/Skale.cpp b/libweb3jsonrpc/Skale.cpp index 763c3af6c..40904ac46 100644 --- a/libweb3jsonrpc/Skale.cpp +++ b/libweb3jsonrpc/Skale.cpp @@ -158,6 +158,10 @@ nlohmann::json Skale::impl_skale_getSnapshot( const nlohmann::json& joRequest, C // TODO check unsigned blockNumber = joRequest["blockNumber"].get< unsigned >(); + if ( blockNumber != m_client.getLatestSnapshotBlockNumer() ) { + joResponse["error"] = "Wrong snapshot block number requested."; + return joResponse; + } // exit if too early if ( currentSnapshotBlockNumber >= 0 ) {