made blocksync send StatusRequest after statesync completes (CON-350)#3574
Conversation
PR SummaryMedium Risk Overview
Several blocksync background tasks ( Reviewed by Cursor Bugbot for commit b5ea71a. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3574 +/- ##
==========================================
- Coverage 59.17% 58.33% -0.85%
==========================================
Files 2215 2141 -74
Lines 183370 174810 -8560
==========================================
- Hits 108512 101970 -6542
+ Misses 65047 63738 -1309
+ Partials 9811 9102 -709
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b5ea71a. Configure here.
| pool := NewBlockPool(startHeightForState(res.state), s.router) | ||
| s.pool.Store(pool) | ||
| sc.SpawnNamed("requestRoutine", func() error { return s.requestRoutine(ctx, pool) }) | ||
| sc.SpawnNamed("processPeerUpdates", func() error { return s.processPeerUpdates(ctx, pool) }) |
There was a problem hiding this comment.
Request routine survives blocksync end
Medium Severity
requestRoutine is now started as an outer-scope main task before scope.Run1, instead of a background task inside the blocksync session. After poolRoutine finishes and the node switches to consensus, it keeps handling pool.Requests(), pool.Errors(), and periodic StatusRequest broadcasts for the rest of the process lifetime.
Reviewed by Cursor Bugbot for commit b5ea71a. Configure here.
There was a problem hiding this comment.
WAI, autorestartIfBehind relies on this.


The point is to make sure that blocksync pool is immediately aware of the already connected peers, rather than wait for the first StatusRequest broadcast. This has been achieved by delaying processPeerUpdates to after pool is created, which sends the request when a peer has been discovered.
Additionally, nullable consensusReactor field is an Option now.