Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Post-refactor bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielhourt committed May 29, 2017
1 parent 19a4a68 commit f83884c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion libraries/appbase
6 changes: 4 additions & 2 deletions libraries/chain/block_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ namespace eos { namespace chain {
}

block_log::~block_log() {
flush();
my.reset();
if (my) {
flush();
my.reset();
}
}

void block_log::open(const fc::path& file) {
Expand Down
2 changes: 0 additions & 2 deletions libraries/chain/chain_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,8 +939,6 @@ void chain_controller::spinup_fork_db()
fc::optional<signed_block> last_block = _block_log.read_head();
if(last_block.valid()) {
_fork_db.start_block(*last_block);
idump((last_block->id())(last_block->block_num()));
idump((head_block_id())(head_block_num()));
if (last_block->id() != head_block_id()) {
FC_ASSERT(head_block_num() == 0, "last block ID does not match current chain state",
("last_block->id", last_block->id())("head_block_num",head_block_num()));
Expand Down
4 changes: 2 additions & 2 deletions plugins/chain_api_plugin/chain_api_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class chain_api_plugin_impl {
};


chain_api_plugin::chain_api_plugin()
:my(new chain_api_plugin_impl(app().get_plugin<chain_plugin>().chain())) {}
chain_api_plugin::chain_api_plugin(){}
chain_api_plugin::~chain_api_plugin(){}

void chain_api_plugin::set_program_options(options_description&, options_description&) {}
Expand All @@ -43,6 +42,7 @@ void chain_api_plugin::plugin_initialize(const variables_map&) {}
#define CHAIN_RW_CALL(call_name) CALL(chain, rw_api, chain_apis::read_write, call_name)

void chain_api_plugin::plugin_startup() {
my.reset(new chain_api_plugin_impl(app().get_plugin<chain_plugin>().chain()));
auto ro_api = app().get_plugin<chain_plugin>().get_read_only_api();
auto rw_api = app().get_plugin<chain_plugin>().get_read_write_api();

Expand Down
5 changes: 5 additions & 0 deletions plugins/chain_plugin/chain_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void chain_plugin::plugin_initialize(const variables_map& options) {
}
if (options.at("resync-blockchain").as<bool>()) {
ilog("Resync requested: wiping blocks");
app().get_plugin<database_plugin>().wipe_database();
fc::remove_all(my->block_log_file);
}

Expand All @@ -84,6 +85,8 @@ void chain_plugin::plugin_initialize(const variables_map& options) {

void chain_plugin::plugin_startup() {
auto genesis_loader = [this] {
if (my->genesis_file.empty())
return eos::chain::genesis_state_type();
return fc::json::from_file(my->genesis_file).as<eos::chain::genesis_state_type>();
};
auto& db = app().get_plugin<database_plugin>().db();
Expand All @@ -96,6 +99,8 @@ void chain_plugin::plugin_startup() {
ilog("starting chain in read/write mode");
my->chain->add_checkpoints(my->loaded_checkpoints);
}

ilog("Blockchain started; head block is #${num}", ("num", my->chain->head_block_num()));
}

void chain_plugin::plugin_shutdown() {
Expand Down
2 changes: 1 addition & 1 deletion programs/eosd/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int main(int argc, char** argv)
app().register_plugin<chain_api_plugin>();
app().register_plugin<producer_plugin>();

if(!app().initialize(argc, argv))
if(!app().initialize<chain_plugin, p2p_plugin>(argc, argv))
return -1;

app().startup();
Expand Down

0 comments on commit f83884c

Please sign in to comment.