netsync: Always request initial non-mining state. #3476
Merged
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.
Currently, the existing logic to avoid requesting the initial mining state is slightly incorrect since the initial state was extended to include additional data that is not specifically related to the mining state. Concretely, it currently does not request any initial state at all when the no mining state synchronization flag is set instead of only avoiding the data specific to the mining state.
Since the flag is not set by default, most nodes would not encounter this condition, but the result for any nodes with the no mining sync flag set is that any unmined treasury spends that are currently being voted on would not immediately be accessible to nodes initially coming online.
This resolves the aforementioned by modifying the relevant logic to only avoid requesting the data specific to the mining state.
While here, it also changes the logic to prevent duplicate initial state requests to use a sync primitive that will ultimately allow requests to be run in parallel instead of requiring them all to go through a single goroutine to protect concurrent access.