@@ -444,7 +444,7 @@ void FullNodeImpl::download_zero_state(BlockIdExt id, td::uint32 priority, td::T
444444void FullNodeImpl::download_persistent_state (BlockIdExt id, BlockIdExt masterchain_block_id, PersistentStateType type,
445445 td::uint32 priority, td::Timestamp timeout,
446446 td::Promise<td::BufferSlice> promise) {
447- auto shard = get_shard (id.shard_full ());
447+ auto shard = get_shard (id.shard_full (), /* historical = */ true );
448448 if (shard.empty ()) {
449449 VLOG (FULL_NODE_WARNING) << " dropping download state diff query to unknown shard" ;
450450 promise.set_error (td::Status::Error (ErrorCode::notready, " shard not ready" ));
@@ -467,7 +467,7 @@ void FullNodeImpl::download_block_proof(BlockIdExt block_id, td::uint32 priority
467467
468468void FullNodeImpl::download_block_proof_link (BlockIdExt block_id, td::uint32 priority, td::Timestamp timeout,
469469 td::Promise<td::BufferSlice> promise) {
470- auto shard = get_shard (block_id.shard_full ());
470+ auto shard = get_shard (block_id.shard_full (), /* historical = */ true );
471471 if (shard.empty ()) {
472472 VLOG (FULL_NODE_WARNING) << " dropping download proof link query to unknown shard" ;
473473 promise.set_error (td::Status::Error (ErrorCode::notready, " shard not ready" ));
@@ -490,7 +490,7 @@ void FullNodeImpl::get_next_key_blocks(BlockIdExt block_id, td::Timestamp timeou
490490
491491void FullNodeImpl::download_archive (BlockSeqno masterchain_seqno, ShardIdFull shard_prefix, std::string tmp_dir,
492492 td::Timestamp timeout, td::Promise<std::string> promise) {
493- auto shard = get_shard (shard_prefix);
493+ auto shard = get_shard (shard_prefix, /* historical = */ true );
494494 if (shard.empty ()) {
495495 VLOG (FULL_NODE_WARNING) << " dropping download archive query to unknown shard" ;
496496 promise.set_error (td::Status::Error (ErrorCode::notready, " shard not ready" ));
@@ -519,16 +519,20 @@ void FullNodeImpl::download_out_msg_queue_proof(ShardIdFull dst_shard, std::vect
519519 timeout, std::move (promise));
520520}
521521
522- td::actor::ActorId<FullNodeShard> FullNodeImpl::get_shard (ShardIdFull shard) {
522+ td::actor::ActorId<FullNodeShard> FullNodeImpl::get_shard (ShardIdFull shard, bool historical ) {
523523 if (shard.is_masterchain ()) {
524524 return shards_[ShardIdFull{masterchainId}].actor .get ();
525525 }
526526 if (shard.workchain != basechainId) {
527527 return {};
528528 }
529529 int pfx_len = shard.pfx_len ();
530- if (pfx_len > wc_monitor_min_split_) {
531- shard = shard_prefix (shard, wc_monitor_min_split_);
530+ int min_split = wc_monitor_min_split_;
531+ if (historical) {
532+ min_split = td::Random::fast (0 , min_split);
533+ }
534+ if (pfx_len > min_split) {
535+ shard = shard_prefix (shard, min_split);
532536 }
533537 while (true ) {
534538 auto it = shards_.find (shard);
0 commit comments