Skip to content

Commit

Permalink
Merge pull request #1790 from skalenetwork/bug/IS-902-zero-snapshot
Browse files Browse the repository at this point in the history
Bug/is 902 zero snapshot
  • Loading branch information
DmytroNazarenko authored Jan 22, 2024
2 parents fce0fd1 + 484421e commit 4880e19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libweb3jsonrpc/Skale.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ nlohmann::json Skale::impl_skale_getSnapshot( const nlohmann::json& joRequest, C

// TODO check
unsigned blockNumber = joRequest["blockNumber"].get< unsigned >();
if ( blockNumber != m_client.getLatestSnapshotBlockNumer() ) {
if ( blockNumber != 0 && blockNumber != m_client.getLatestSnapshotBlockNumer() ) {
joResponse["error"] = "Invalid snapshot block number requested - it might be deleted.";
return joResponse;
}
Expand Down Expand Up @@ -370,7 +370,7 @@ Json::Value Skale::skale_getSnapshotSignature( unsigned blockNumber ) {
if ( chainParams.nodeInfo.keyShareName.empty() || chainParams.nodeInfo.sgxServerUrl.empty() )
throw jsonrpc::JsonRpcException( "Snapshot signing is not enabled" );

if ( blockNumber != this->m_client.getLatestSnapshotBlockNumer() ) {
if ( blockNumber != 0 && blockNumber != this->m_client.getLatestSnapshotBlockNumer() ) {
throw jsonrpc::JsonRpcException(
"Invalid snapshot block number requested - it might be deleted." );
}
Expand Down

0 comments on commit 4880e19

Please sign in to comment.