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:
parent
ff5c6593b0
commit
c7f06abfbc
2 changed files with 19 additions and 2 deletions
|
@ -441,7 +441,10 @@ void ArchiveManager::get_block_by_unix_time(AccountIdPrefixFull account_id, Unix
|
||||||
td::Promise<ConstBlockHandle> promise) {
|
td::Promise<ConstBlockHandle> promise) {
|
||||||
auto f = get_file_desc_by_unix_time(account_id, ts, false);
|
auto f = get_file_desc_by_unix_time(account_id, ts, false);
|
||||||
if (f) {
|
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;
|
td::actor::ActorId<ArchiveSlice> aid;
|
||||||
if (n) {
|
if (n) {
|
||||||
aid = n->file_actor_id();
|
aid = n->file_actor_id();
|
||||||
|
@ -464,7 +467,10 @@ void ArchiveManager::get_block_by_lt(AccountIdPrefixFull account_id, LogicalTime
|
||||||
td::Promise<ConstBlockHandle> promise) {
|
td::Promise<ConstBlockHandle> promise) {
|
||||||
auto f = get_file_desc_by_lt(account_id, lt, false);
|
auto f = get_file_desc_by_lt(account_id, lt, false);
|
||||||
if (f) {
|
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;
|
td::actor::ActorId<ArchiveSlice> aid;
|
||||||
if (n) {
|
if (n) {
|
||||||
aid = n->file_actor_id();
|
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 validator
|
||||||
|
|
||||||
} // namespace ton
|
} // namespace ton
|
||||||
|
|
|
@ -97,6 +97,7 @@ class ArchiveManager : public td::actor::Actor {
|
||||||
void clear_actor_id() {
|
void clear_actor_id() {
|
||||||
file.reset();
|
file.reset();
|
||||||
}
|
}
|
||||||
|
bool has_account_prefix(AccountIdPrefixFull account_id) const;
|
||||||
PackageId id;
|
PackageId id;
|
||||||
bool deleted;
|
bool deleted;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue