forked from skalenetwork/skale-consensus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Consensusd.cpp
77 lines (51 loc) · 1.88 KB
/
Consensusd.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
Copyright (C) 2018-2019 SKALE Labs
This file is part of skale-consensus.
skale-consensus is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
skale-consensus is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with skale-consensus. If not, see <https://www.gnu.org/licenses/>.
@file Skaled.cpp
@author Stan Kladko
@date 2018
*/
#include "thirdparty/catch.hpp"
#include "SkaleCommon.h"
#include "Consensusd.h"
#include "node/ConsensusEngine.h"
#ifdef GOOGLE_PROFILE
#include <gperftools/heap-profiler.h>
#endif
int main( int argc, char** argv ) {
#ifdef GOOGLE_PROFILE
HeapProfilerStart( "/tmp/consensusd.profile" );
#endif
signal( SIGPIPE, SIG_IGN );
if ( argc < 2 ) {
printf( "Usage: consensusd nodes_dir node_id1 node_id2 \n" );
exit( 1 );
}
ConsensusEngine engine( 0, 100000000 );
for ( int i = 2; i < argc; i++ ) {
uint64_t ui64;
ui64 = static_cast< uint64_t >( stoll( argv[i] ) );
engine.getNodeIDs().insert( node_id( ui64 ) );
cerr << node_id( ui64 ) << endl;
}
fs_path dirPath( boost::filesystem::system_complete( fs_path( argv[1] ) ) );
engine.parseTestConfigsAndCreateAllNodes( dirPath );
engine.slowStartBootStrapTest();
while ( engine.getStatus() != CONSENSUS_EXITED ) {
usleep( 100 * 1000 );
}
cerr << "Exited" << endl;
#ifdef GOOGLE_PROFILE
HeapProfilerStop();
#endif
}