-
Notifications
You must be signed in to change notification settings - Fork 292
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
mining: require a valid template address. #1739
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The objective is to remove the reference from blockManager to server. Since the blockManager is responsible for keeping the mempool in sync, it should have a direct reference to it.
Instead of having the block manager notify the RPC server about accepted, connected, and disconnected blocks, the RPC server will directly listen for notifications from the blockchain.
This removes the blockManager's reference to the server in favour of using a config struct.
This decouples the RPC server from the internal dcrd server to move closer to being able to split it out into a separate package. In order to accomplish this, it introduces an rpcserverConfig type and several new interfaces, named rpcserverPeer, rpcserverConnManager, and rpcserverBlockManager, which are necessary to break the direct dependencies on the main server and block manager instances. It also adds concrete implementations of the new interfaces and uses them to configure the RPC server. Ultimately, the RPC server should ideally be decoupled even more such that all of the types in the configuration struct use interfaces instead of the concrete types. Doing this would make the RPC server much easier to internally test since it would allow creating lightweight stubs for the various pieces.
This modifies all of the RPC code to use the chain parameters that are associated with the RPC server instead of the global activeNetParams and thus moves one step closer to being able to split the RPC server out into a separate package.
The purpose is to remove the dependency of blockmanager on serverPeer, which is defined in the main package. Instead, we split out some of the fields from serverPeer into a separate struct called peerSyncState in blockmanager.go. While they are in the same package now, this change makes it easier to move blockManager into its own package along with peerSyncState. The blockManager tracks a map of Peer pointers to the peer state and keeps it updated as peers connect and disconnect.
This removes the getblocktemplate and its helpers from the codebase. Ongoing mining updates focused on the voting/block validation process with respect to generating block templates for getwork makes it the better option for decred. Also getblocktemplate rpc was buggy and has been disabled for a while. Some lint related issues have been addressed as well.
This updates NewBlockTemplate to require a valid address to pay the template's coinbase to. Generating templates without a valid address to pay to is no longer needed with the removal of getblocktemplate.
NACK. I'd rather not remove the code related to this as we might end up bringing back some variant of it and it would also be nice to be able to dynamically change it in the future. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 updates
NewBlockTemplate
to require a valid address to pay a template's coinbase to. Generatingtemplates without a valid address to pay to is no longer needed with the removal of
getblocktemplate
.