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

Download persistent states when syncing new shards

This commit is contained in:
SpyCheese 2022-08-17 16:29:50 +03:00
parent be2169e523
commit ea7a5776fe
18 changed files with 273 additions and 17 deletions

View file

@ -27,12 +27,14 @@ namespace validator {
class WaitBlockState : public td::actor::Actor {
public:
WaitBlockState(BlockHandle handle, td::uint32 priority, td::actor::ActorId<ValidatorManager> manager,
td::Timestamp timeout, td::Promise<td::Ref<ShardState>> promise)
td::Timestamp timeout, td::Promise<td::Ref<ShardState>> promise,
td::Ref<PersistentStateDescription> persistent_state_desc = {})
: handle_(std::move(handle))
, priority_(priority)
, manager_(manager)
, timeout_(timeout)
, promise_(std::move(promise)) {
, promise_(std::move(promise))
, persistent_state_desc_(std::move(persistent_state_desc)) {
}
void abort_query(td::Status reason);
@ -73,6 +75,7 @@ class WaitBlockState : public td::actor::Actor {
td::actor::ActorId<ValidatorManager> manager_;
td::Timestamp timeout_;
td::Promise<td::Ref<ShardState>> promise_;
td::Ref<PersistentStateDescription> persistent_state_desc_;
td::Ref<ShardState> prev_state_;
td::Ref<BlockData> block_;
@ -81,6 +84,14 @@ class WaitBlockState : public td::actor::Actor {
td::Timestamp next_static_file_attempt_;
//td::PerfWarningTimer perf_timer_{"waitstate", 1.0};
bool check_persistent_state_desc() const {
if (persistent_state_desc_.is_null()) {
return false;
}
auto now = (UnixTime)td::Clocks::system();
return persistent_state_desc_->end_time > now + 3600 && persistent_state_desc_->start_time < now - 6 * 3600;
}
};
} // namespace validator