1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00
new database
fift/func bugfixes
This commit is contained in:
ton 2019-11-15 18:02:37 +04:00
parent 950e292264
commit e30d98eb30
110 changed files with 6102 additions and 2075 deletions

View file

@ -222,6 +222,22 @@ StateDb::StateDb(td::actor::ActorId<RootDb> root_db, std::string db_path) : root
void StateDb::start_up() {
kv_ = std::make_shared<td::RocksDb>(td::RocksDb::open(db_path_).move_as_ok());
std::string value;
auto R = kv_->get(create_serialize_tl_object<ton_api::db_state_key_dbVersion>(), value);
R.ensure();
if (R.move_as_ok() == td::KeyValue::GetStatus::Ok) {
auto F = fetch_tl_object<ton_api::db_state_dbVersion>(value, true);
F.ensure();
auto f = F.move_as_ok();
CHECK(f->version_ == 2);
} else {
kv_->begin_transaction().ensure();
kv_->set(create_serialize_tl_object<ton_api::db_state_key_dbVersion>(),
create_serialize_tl_object<ton_api::db_state_dbVersion>(2))
.ensure();
kv_->commit_transaction().ensure();
}
}
} // namespace validator