application.cpp: Use egenesis instead of create_example_genesis()

This commit is contained in:
theoreticalbts 2015-08-07 12:46:30 -04:00
parent 9510960bf5
commit 4d8033443c
4 changed files with 16 additions and 3 deletions

View file

@ -1,15 +1,19 @@
file(GLOB HEADERS "include/graphene/app/*.hpp") file(GLOB HEADERS "include/graphene/app/*.hpp")
file(GLOB EGENESIS_HEADERS "../egenesis/include/graphene/app/*.hpp")
add_library( graphene_app add_library( graphene_app
api.cpp api.cpp
application.cpp application.cpp
impacted.cpp impacted.cpp
plugin.cpp plugin.cpp
${HEADERS}
${EGENESIS_HEADERS}
) )
target_link_libraries( graphene_app graphene_market_history graphene_chain fc graphene_db graphene_net graphene_time graphene_utilities ) target_link_libraries( graphene_app graphene_market_history graphene_chain fc graphene_db graphene_net graphene_time graphene_utilities )
target_include_directories( graphene_app target_include_directories( graphene_app
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/../egenesis/include" )
if(MSVC) if(MSVC)
set_source_files_properties( application.cpp api.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) set_source_files_properties( application.cpp api.cpp PROPERTIES COMPILE_FLAGS "/bigobj" )

View file

@ -23,6 +23,8 @@
#include <graphene/chain/protocol/fee_schedule.hpp> #include <graphene/chain/protocol/fee_schedule.hpp>
#include <graphene/chain/protocol/types.hpp> #include <graphene/chain/protocol/types.hpp>
#include <graphene/egenesis/egenesis.hpp>
#include <graphene/net/core_messages.hpp> #include <graphene/net/core_messages.hpp>
#include <graphene/time/time.hpp> #include <graphene/time/time.hpp>
@ -226,7 +228,13 @@ namespace detail {
return fc::json::from_file(_options->at("genesis-json").as<boost::filesystem::path>()) return fc::json::from_file(_options->at("genesis-json").as<boost::filesystem::path>())
.as<genesis_state_type>(); .as<genesis_state_type>();
else else
return create_example_genesis(); {
std::string egenesis_json;
graphene::egenesis::compute_egenesis_json( egenesis_json );
FC_ASSERT( egenesis_json != "" );
FC_ASSERT( graphene::egenesis::get_egenesis_json_hash() == fc::sha256::hash( egenesis_json ) );
return fc::json::from_string( egenesis_json ).as<genesis_state_type>();
}
}; };
if( _options->count("resync-blockchain") ) if( _options->count("resync-blockchain") )

View file

@ -12,7 +12,7 @@ add_executable( embed_genesis
embed_genesis.cpp embed_genesis.cpp
) )
target_link_libraries( embed_genesis graphene_chain graphene_egenesis_none graphene_app fc ) target_link_libraries( embed_genesis graphene_chain graphene_app graphene_egenesis_none fc )
set( embed_genesis_args set( embed_genesis_args
-t "${CMAKE_CURRENT_SOURCE_DIR}/egenesis_brief.cpp.tmpl---${CMAKE_CURRENT_BINARY_DIR}/egenesis_brief.cpp" -t "${CMAKE_CURRENT_SOURCE_DIR}/egenesis_brief.cpp.tmpl---${CMAKE_CURRENT_BINARY_DIR}/egenesis_brief.cpp"

View file

@ -163,6 +163,7 @@ int main(int argc, char** argv) {
#endif #endif
ilog("Started witness node on a chain with ${h} blocks.", ("h", node.chain_database()->head_block_num())); ilog("Started witness node on a chain with ${h} blocks.", ("h", node.chain_database()->head_block_num()));
ilog("Chain ID is ${id}", ("id", node.chain_database()->get_chain_id()) );
int signal = exit_promise->wait(); int signal = exit_promise->wait();
ilog("Exiting from signal ${n}", ("n", signal)); ilog("Exiting from signal ${n}", ("n", signal));