Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi: Handle chain ntfn callback in server. #2498

Merged
merged 3 commits into from
Dec 15, 2020

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Dec 10, 2020

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:

  • Avoid using unexported block manager cfg variable from server
  • Rework chain currency determination logic
    • Introduce a new isCurrent flag protected by isCurrentMtx to the block manager
    • Update the flag on the fly as blocks are received versus determining it via the sync peer on every invocation
  • Move blockchain notification callback to server
    • Use instance vars and methods directly on server
  • Move funcs and consts only used by callback from blockmanager.go to server.go
  • Remove no longer needed methods from peerNotifier interface
    • RelayInventory
    • TransactionConfirmed
  • Remove no longer needed fields from blockManagerConfig struct
    • FeeEstimator
    • BgBlkTmplGenerator
    • NotifyWinningTickets
    • PruneRebroadcastInventory
  • Move lottery data duplicate filter state to server
  • Move block announce duplicate filter state to server
  • Misc consistency nits

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.

@davecgh davecgh added this to the 1.7.0 milestone Dec 10, 2020
@davecgh davecgh mentioned this pull request Dec 10, 2020
28 tasks
@davecgh davecgh force-pushed the multi_remove_blockmanager_chainstate branch from f65ffb9 to 338924c Compare December 10, 2020 08:28
@davecgh davecgh force-pushed the multi_remove_blockmanager_chainstate branch 2 times, most recently from 3e613d6 to db257c7 Compare December 11, 2020 06:13
blockmanager.go Outdated Show resolved Hide resolved
@davecgh davecgh force-pushed the multi_remove_blockmanager_chainstate branch from 09842b8 to acbe2f9 Compare December 15, 2020 17:49
This reworks that logic that determines whether or not the block manager
believes the chain is current (synced) to use 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.

While the primary objective is to decouple the block manager from the
server so it can be split out into a separate internal netsync package,
this also has the benefit of much faster state querying and allowing
looser coupling of block processing without the potential of deadlocks.
This further decouples the block manager from the server by 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 following is a high level overview of the changes:
- Move blockchain notification callback to server
  - Use instance vars and methods directly on server
- Move funcs and consts only used by callback from blockmanager.go to server.go
- Remove no longer needed methods from peerNotifier interface
  - RelayInventory
  - TransactionConfirmed
- Remove no longer needed fields from blockManagerConfig struct
  - FeeEstimator
  - BgBlkTmplGenerator
  - NotifyWinningTickets
  - PruneRebroadcastInventory
- Move lottery data duplicate filter state to server
- Move block announce duplicate filter state to server
- Misc consistency nits

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.
@davecgh davecgh force-pushed the multi_remove_blockmanager_chainstate branch from acbe2f9 to ccd41c7 Compare December 15, 2020 17:52
@davecgh davecgh merged commit ccd41c7 into decred:master Dec 15, 2020
@davecgh davecgh deleted the multi_remove_blockmanager_chainstate branch December 15, 2020 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants