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

Fix finding blocks by lt and ut in archive manager (#536)

This commit is contained in:
SpyCheese 2022-11-30 08:38:46 +03:00 committed by GitHub
parent ff5c6593b0
commit c7f06abfbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View file

@ -441,7 +441,10 @@ void ArchiveManager::get_block_by_unix_time(AccountIdPrefixFull account_id, Unix
td::Promise<ConstBlockHandle> promise) {
auto f = get_file_desc_by_unix_time(account_id, ts, false);
if (f) {
auto n = get_next_file_desc(f);
auto n = f;
do {
n = get_next_file_desc(n);
} while (n != nullptr && !n->has_account_prefix(account_id));
td::actor::ActorId<ArchiveSlice> aid;
if (n) {
aid = n->file_actor_id();
@ -464,7 +467,10 @@ void ArchiveManager::get_block_by_lt(AccountIdPrefixFull account_id, LogicalTime
td::Promise<ConstBlockHandle> promise) {
auto f = get_file_desc_by_lt(account_id, lt, false);
if (f) {
auto n = get_next_file_desc(f);
auto n = f;
do {
n = get_next_file_desc(n);
} while (n != nullptr && !n->has_account_prefix(account_id));
td::actor::ActorId<ArchiveSlice> aid;
if (n) {
aid = n->file_actor_id();
@ -1232,6 +1238,16 @@ void ArchiveManager::truncate(BlockSeqno masterchain_seqno, ConstBlockHandle han
}
}
bool ArchiveManager::FileDescription::has_account_prefix(AccountIdPrefixFull account_id) const {
for (int i = 0; i < 60; i++) {
auto shard = shard_prefix(account_id, i);
if (first_blocks.count(shard)) {
return true;
}
}
return false;
}
} // namespace validator
} // namespace ton

View file

@ -97,6 +97,7 @@ class ArchiveManager : public td::actor::Actor {
void clear_actor_id() {
file.reset();
}
bool has_account_prefix(AccountIdPrefixFull account_id) const;
PackageId id;
bool deleted;