adding checkpoints #121 to application config

This commit is contained in:
Daniel Larimer 2015-07-09 14:19:47 -04:00
parent c49fbd87e7
commit 7ead4f3b2d
2 changed files with 17 additions and 2 deletions

View file

@ -197,6 +197,20 @@ namespace detail {
if( _options->count("resync-blockchain") ) if( _options->count("resync-blockchain") )
_chain_db->wipe(_data_dir / "blockchain", true); _chain_db->wipe(_data_dir / "blockchain", true);
if( _options->count("checkpoint") )
{
auto cps = _options->at("checkpoint").as<vector<string>>();
flat_map<uint32_t,block_id_type> loaded_checkpoints;
loaded_checkpoints.reserve( cps.size() );
for( auto cp : cps )
{
auto item = fc::json::from_string(cp).as<std::pair<uint32_t,block_id_type> >();
loaded_checkpoints[item.first] = item.second;
}
_chain_db->add_checkpoints( loaded_checkpoints );
}
if( _options->count("replay-blockchain") ) if( _options->count("replay-blockchain") )
{ {
ilog("Replaying blockchain on user request."); ilog("Replaying blockchain on user request.");
@ -483,12 +497,13 @@ void application::set_program_options(boost::program_options::options_descriptio
configuration_file_options.add_options() configuration_file_options.add_options()
("p2p-endpoint", bpo::value<string>(), "Endpoint for P2P node to listen on") ("p2p-endpoint", bpo::value<string>(), "Endpoint for P2P node to listen on")
("seed-node,s", bpo::value<vector<string>>()->composing(), "P2P nodes to connect to on startup (may specify multiple times)") ("seed-node,s", bpo::value<vector<string>>()->composing(), "P2P nodes to connect to on startup (may specify multiple times)")
("checkpoint,c", bpo::value<vector<string>>()->composing(), "Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.")
("rpc-endpoint", bpo::value<string>()->implicit_value("127.0.0.1:8090"), "Endpoint for websocket RPC to listen on") ("rpc-endpoint", bpo::value<string>()->implicit_value("127.0.0.1:8090"), "Endpoint for websocket RPC to listen on")
("rpc-tls-endpoint", bpo::value<string>()->implicit_value("127.0.0.1:8089"), "Endpoint for TLS websocket RPC to listen on") ("rpc-tls-endpoint", bpo::value<string>()->implicit_value("127.0.0.1:8089"), "Endpoint for TLS websocket RPC to listen on")
("server-pem,p", bpo::value<string>()->implicit_value("server.pem"), "The TLS certificate file for this server") ("server-pem,p", bpo::value<string>()->implicit_value("server.pem"), "The TLS certificate file for this server")
("server-pem-password,P", bpo::value<string>()->implicit_value(""), "Password for this certificate") ("server-pem-password,P", bpo::value<string>()->implicit_value(""), "Password for this certificate")
("genesis-json", bpo::value<boost::filesystem::path>(), "File to read Genesis State from") ("genesis-json", bpo::value<boost::filesystem::path>(), "File to read Genesis State from")
("apiaccess", bpo::value<boost::filesystem::path>(), "JSON file specifying API permissions") ("api-access", bpo::value<boost::filesystem::path>(), "JSON file specifying API permissions")
; ;
command_line_options.add(configuration_file_options); command_line_options.add(configuration_file_options);
command_line_options.add_options() command_line_options.add_options()

@ -1 +1 @@
Subproject commit 8d13f292b8ad47d4055bba8721731d73acd0561f Subproject commit 2ef7583f90b8593511dda23133ed5600f5add392