1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

liteclient signature check support

1. update liteclient/liteserver. Now liteserver sends signatures of
blocks and liteclient checks them. I.e. liteclient completely checks
received data.
2. validator-engine: more GC options
3. blockchain-explorer: show all block transactions (instead of 256)
4. some bugfixes
This commit is contained in:
ton 2019-09-14 18:14:55 +04:00
parent d8244eff53
commit 9d6853ef24
58 changed files with 1480 additions and 325 deletions

View file

@ -45,7 +45,8 @@ void BlockArchiver::got_block_handle(BlockHandle handle) {
return;
}
if (!handle_->is_applied() && !handle_->is_archived()) {
if (!handle_->is_applied() && !handle_->is_archived() &&
(!handle_->inited_is_key_block() || !handle_->is_key_block())) {
// no need for this block
// probably this block not in final chain
// this will eventually delete all associated data

View file

@ -142,7 +142,9 @@ void CellDbIn::gc() {
}
void CellDbIn::gc_cont(BlockHandle handle) {
CHECK(handle->inited_state_boc());
if (!handle->inited_state_boc()) {
LOG(WARNING) << "inited_state_boc=false, but state in db. blockid=" << handle->id();
}
handle->set_deleted_state_boc();
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this), handle](td::Result<td::Unit> R) {

View file

@ -34,11 +34,14 @@ std::string FileDb::get_file_name(const RefId& ref_id, bool create_dirs) {
auto ref_id_hash = get_ref_id_hash(ref_id);
auto s = ref_id_hash.to_hex();
if (create_dirs) {
td::mkdir(root_path_ + "/files/" + s[0] + s[1] + "/").ensure();
td::mkdir(root_path_ + "/files/" + s[0] + s[1] + "/" + s[2] + s[3] + "/").ensure();
std::string path = root_path_ + "/files/";
for (td::uint32 i = 0; i < depth_; i++) {
path = path + s[2 * i] + s[2 * i + 1] + "/";
if (create_dirs) {
td::mkdir(path).ensure();
}
}
return root_path_ + "/files/" + s[0] + s[1] + "/" + s[2] + s[3] + "/" + s;
return path + s;
}
void FileDb::store_file(RefId ref_id, td::BufferSlice data, td::Promise<FileHash> promise) {
@ -169,8 +172,8 @@ void FileDb::set_block(const RefIdHash& ref, DbEntry entry) {
kv_->set(get_key(ref), entry.release()).ensure();
}
FileDb::FileDb(td::actor::ActorId<RootDb> root_db, std::string root_path, bool is_archive)
: root_db_(root_db), root_path_(root_path), is_archive_(is_archive) {
FileDb::FileDb(td::actor::ActorId<RootDb> root_db, std::string root_path, td::uint32 depth, bool is_archive)
: root_db_(root_db), root_path_(root_path), depth_(depth), is_archive_(is_archive) {
}
void FileDb::start_up() {

View file

@ -152,7 +152,7 @@ class FileDb : public td::actor::Actor {
void gc();
void skip_gc();
FileDb(td::actor::ActorId<RootDb> root_db, std::string root_path, bool is_archive);
FileDb(td::actor::ActorId<RootDb> root_db, std::string root_path, td::uint32 depth, bool is_archive);
private:
struct DbEntry {
@ -187,6 +187,7 @@ class FileDb : public td::actor::Actor {
std::string root_path_;
std::string db_path_;
td::uint32 depth_;
bool is_archive_;

View file

@ -408,8 +408,9 @@ void RootDb::get_async_serializer_state(td::Promise<AsyncSerializerState> promis
void RootDb::start_up() {
cell_db_ = td::actor::create_actor<CellDb>("celldb", actor_id(this), root_path_ + "/celldb/");
block_db_ = td::actor::create_actor<BlockDb>("blockdb", actor_id(this), root_path_ + "/blockdb/");
file_db_ = td::actor::create_actor<FileDb>("filedb", actor_id(this), root_path_ + "/files/", false);
archive_db_ = td::actor::create_actor<FileDb>("filedbarchive", actor_id(this), root_path_ + "/archive/", true);
file_db_ = td::actor::create_actor<FileDb>("filedb", actor_id(this), root_path_ + "/files/", depth_, false);
archive_db_ =
td::actor::create_actor<FileDb>("filedbarchive", actor_id(this), root_path_ + "/archive/", depth_, true);
lt_db_ = td::actor::create_actor<LtDb>("ltdb", actor_id(this), root_path_ + "/ltdb/");
state_db_ = td::actor::create_actor<StateDb>("statedb", actor_id(this), root_path_ + "/state/");
static_files_db_ = td::actor::create_actor<StaticFilesDb>("staticfilesdb", actor_id(this), root_path_ + "/static/");

View file

@ -36,8 +36,8 @@ namespace validator {
class RootDb : public Db {
public:
enum class Flags : td::uint32 { f_started = 1, f_ready = 2, f_switched = 4, f_archived = 8 };
RootDb(td::actor::ActorId<ValidatorManager> validator_manager, std::string root_path)
: validator_manager_(validator_manager), root_path_(std::move(root_path)) {
RootDb(td::actor::ActorId<ValidatorManager> validator_manager, std::string root_path, td::uint32 depth)
: validator_manager_(validator_manager), root_path_(std::move(root_path)), depth_(depth) {
}
void start_up() override;
@ -112,6 +112,7 @@ class RootDb : public Db {
td::actor::ActorId<ValidatorManager> validator_manager_;
std::string root_path_;
td::uint32 depth_;
td::actor::ActorOwn<CellDb> cell_db_;
td::actor::ActorOwn<BlockDb> block_db_;