multi: Handle chain ntfn callback in server. #2498
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.
This requires #2497.
This further decouples the block manager from the server by reworking thelogic that determines whether or not the block manager believes the chain is current (synced) and moving the chain callback code from the block manager to server where it more naturally belongs since it is not directly related to sync, rather it is in response to it.
The logic to determine if the block manager believes the chain is current now uses a flag that is protected by a separate mutex and is updated on the fly versus needing to go through a channel and using the current sync peer.
This also has the benefit of much faster state querying and allowing looser coupling of block processing without the potential of deadlocks.
The following is a high level overview of the changes:
isCurrent
flag protected byisCurrentMtx
to the block managerblockmanager.go
toserver.go
peerNotifier
interfaceRelayInventory
TransactionConfirmed
blockManagerConfig
structFeeEstimator
BgBlkTmplGenerator
NotifyWinningTickets
PruneRebroadcastInventory
This is a part of the overall effort to decouple the block manager from the server so it can be split out into a separate internal
netsync
package.This is work towards #1145.