Fix #436 object_database created outside of witness data directory
This commit is contained in:
parent
686a1109e1
commit
20116e0a94
2 changed files with 14 additions and 1 deletions
|
|
@ -175,7 +175,9 @@ void database::reindex( fc::path data_dir )
|
|||
void database::wipe(const fc::path& data_dir, bool include_blocks)
|
||||
{
|
||||
ilog("Wiping database", ("include_blocks", include_blocks));
|
||||
close();
|
||||
if (_opened) {
|
||||
close();
|
||||
}
|
||||
object_database::wipe(data_dir);
|
||||
if( include_blocks )
|
||||
fc::remove_all( data_dir / "database" );
|
||||
|
|
@ -221,6 +223,7 @@ void database::open(
|
|||
("last_block->id", last_block)("head_block_id",head_block_num()) );
|
||||
reindex( data_dir );
|
||||
}
|
||||
_opened = true;
|
||||
}
|
||||
FC_CAPTURE_LOG_AND_RETHROW( (data_dir) )
|
||||
}
|
||||
|
|
@ -263,6 +266,8 @@ void database::close(bool rewind)
|
|||
_block_id_to_block.close();
|
||||
|
||||
_fork_db.reset();
|
||||
|
||||
_opened = false;
|
||||
}
|
||||
|
||||
void database::force_slow_replays()
|
||||
|
|
|
|||
|
|
@ -566,6 +566,14 @@ namespace graphene { namespace chain {
|
|||
node_property_object _node_property_object;
|
||||
fc::hash_ctr_rng<secret_hash_type, 20> _random_number_generator;
|
||||
bool _slow_replays = false;
|
||||
|
||||
/**
|
||||
* Whether database is successfully opened or not.
|
||||
*
|
||||
* The database is considered open when there's no exception
|
||||
* or assertion fail during database::open() method.
|
||||
*/
|
||||
bool _opened = false;
|
||||
};
|
||||
|
||||
namespace detail
|
||||
|
|
|
|||
Loading…
Reference in a new issue