Commit 4791706
catchup: suspend the catchup session once the agreement service kicks in (#3299)
The catchup service stops when it is complete, i.e. it has reached up to the round which is being agreed on.
The catchup service knows it is complete and should stop, when it finds that a block is in the ledger before it adds it.
In other words, apart from the catchup, only the agreement adds blocks to the ledger. And when the agreement adds a block to the ledger before the catchup, it means the agreement is ahead, and the catchup is complete.
When `fetchAndWrite` detects the block is already in the ledger, it returns. The return value of `false` stops the catchup syncing.
In previous releases, `fetchAndWrite` was only checking if the block is already in the ledger after attempting to fetch it.
Since it fails to fetch a block not yet agreed on, the fetch fails after multiple attempts, and `fetchAndWrite` returns `false` ending the catchup.
A recent change made this process more efficient by first checking if the block is in the ledger before/during the fetch.
However, once the block was found in the ledger, `fetchAndWrite` returned true instead of false (consistent with already existing logic since forever, which was also wrong). This caused the catchup to continue syncing after catchup was complete.
This change fixes the return value from true to false.1 parent 4860375 commit 4791706
1 file changed
+9
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
245 | | - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
246 | 248 | | |
247 | 249 | | |
248 | 250 | | |
| |||
353 | 355 | | |
354 | 356 | | |
355 | 357 | | |
356 | | - | |
357 | | - | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
358 | 362 | | |
359 | 363 | | |
360 | 364 | | |
| |||
387 | 391 | | |
388 | 392 | | |
389 | 393 | | |
390 | | - | |
| 394 | + | |
391 | 395 | | |
392 | 396 | | |
393 | 397 | | |
| |||
0 commit comments