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

mining: require a valid template address. #1739

Closed
wants to merge 8 commits into from

Conversation

dnldd
Copy link
Member

@dnldd dnldd commented May 14, 2019

This updates NewBlockTemplate to require a valid address to pay a template's coinbase to. Generating
templates without a valid address to pay to is no longer needed with the removal of getblocktemplate.

dnldd and others added 8 commits May 3, 2019 18:30
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.
@davecgh
Copy link
Member

davecgh commented Jun 24, 2019

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.

@dnldd dnldd closed this Sep 16, 2019
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.

2 participants