-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1588 add snapshot_hash_computation binary
- Loading branch information
1 parent
2fcb104
commit 154c5d5
Showing
4 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
set( | ||
sources | ||
main.cpp | ||
) | ||
|
||
set( | ||
headers | ||
) | ||
|
||
set(executable_name snapshot_benchmark) | ||
|
||
add_executable(${executable_name} ${sources} ${headers}) | ||
target_compile_options( ${executable_name} PRIVATE | ||
-Wno-error=deprecated-copy -Wno-error=unused-result -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=maybe-uninitialized | ||
) | ||
target_link_libraries( | ||
${executable_name} | ||
PRIVATE | ||
skutils | ||
skale | ||
devcore | ||
# "${DEPS_INSTALL_ROOT}/lib/libunwind.a" | ||
# "${DEPS_INSTALL_ROOT}/lib/liblzma.a" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <libdevcore/CommonIO.h> | ||
#include <libskale/SnapshotManager.h> | ||
|
||
#include <iostream> | ||
#include <unistd.h> | ||
|
||
int main() { | ||
std::string dataDir, configPath; | ||
unsigned blockNumber; | ||
std::cin >> dataDir >> configPath >> blockNumber; | ||
|
||
std::string configJSON = dev::contentsString( configPath ); | ||
|
||
dev::eth::ChainParams chainParams; | ||
chainParams.loadConfig( configJSON, configPath ); | ||
|
||
std::shared_ptr< SnapshotManager > snapshotManager; | ||
|
||
snapshotManager.reset( new SnapshotManager( chainParams, dataDir, | ||
{ dev::eth::BlockChain::getChainDirName( chainParams ), "filestorage", | ||
"prices_" + chainParams.nodeInfo.id.str() + ".db", | ||
"blocks_" + chainParams.nodeInfo.id.str() + ".db" }, "" ) ); | ||
|
||
std::cout << "SLEEPING FOR 60 seconds\n"; | ||
sleep(60); | ||
|
||
snapshotManager->doSnapshot( blockNumber ); | ||
|
||
std::cout << "SNAPSHOT IS READY, CALCULATING ITS HASH NOW\n"; | ||
|
||
snapshotManager->computeSnapshotHash( blockNumber ); | ||
|
||
std::cout << "SNAPSHOT HASH IS READY, EXITING\n"; | ||
|
||
return 0; | ||
} |