Skip to content

Commit

Permalink
random warp justification after synchronized
Browse files Browse the repository at this point in the history
Signed-off-by: turuslan <[email protected]>
  • Loading branch information
turuslan committed Jan 29, 2025
1 parent ec5ef95 commit ff5c232
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions core/network/impl/synchronizer_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,15 @@ namespace kagome::network {
}

void SynchronizerImpl::randomWarp() {
scheduler_->schedule(
[WEAK_SELF] {
WEAK_LOCK(self);
self->randomWarp();
},
kRandomWarpInterval);
if (not timeline_.get()->wasSynchronized()) {
return;
}
auto finalized = block_tree_->getLastFinalized();
auto cb = [WEAK_SELF, finalized](outcome::result<WarpResponse> r) mutable {
WEAK_LOCK(self);
Expand All @@ -1495,11 +1504,5 @@ namespace kagome::network {
}
};
router_->getWarpProtocol()->random(finalized.hash, cb);
scheduler_->schedule(
[WEAK_SELF] {
WEAK_LOCK(self);
self->randomWarp();
},
kRandomWarpInterval);
}
} // namespace kagome::network

0 comments on commit ff5c232

Please sign in to comment.