Cancel parent context when aborting bootstrapping #4546
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why this should be merged
Currently, when the X-chain executes transactions while bootstrapping, it cannot halt until it finishes executing the current batch of transactions, because the context is never cancelled and the code never checks for the bootstrapper being halted until it finishes handling the batch.
How this works
I just added a context and a corresponding cancellation in the chain manager, and now when the chain manager is stopped, the context is cancelled and it ripples throughout the bootstrapping procedure across the various engines.
How this was tested
First, I picked up a similar bug fix for the C-chain.
I ran locally a Fuji node and waited until it synced the P-chain.
When it started syncing the X and C chains I did
ctrl+Cand observed that it shuts down immediately:Need to be documented in RELEASES.md?