-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Create generate
RPC command to close #362
#407
Conversation
@@ -58,6 +58,19 @@ func NewDebugLevelCmd(levelSpec string) *DebugLevelCmd { | |||
} | |||
} | |||
|
|||
// GenerateCmd defines the generate JSON-RPC command. | |||
type GenerateCmd struct { | |||
NumBlocks uint32 `json:"numblocks"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to specify the tag on the command. JSON-RPC 1.0 uses positional params.
EDIT: To clarify, the result needs it (as that's just normal JSON), but commands don't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK.
" array of their hashes.", | ||
"generate-numblocks": "Number of blocks to generate", | ||
|
||
// GenerateResult help |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super Nit: This comment can go away since the type has been removed. Once that goes away, so should the blank line above it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, removed comment/blank line.
Also, I managed to hit a case where it was generating a bunch of blocks and I issued a I believe this will need a separate flag to prevent any changes via |
ACK, I created a new discreteMining flag and check it in Stop(), Start(), and GenerateNBlocks where it's set/cleared. |
Code updates look good. I'm testing it out now. |
Create GenerateCmd in btcjson v2. Update tests to check GenerateCmd. Update chaincfg/params.go with a new bool in Params, GenerateSupported, with true values in SimNetParams and RegressionNetParams and false in the others. Create new flag, discreteMining, in CPUMiner struct. Add GenerateNBlocks function to cpuminer.go and handleGenerate function to rpcserver.go. Update documentation for the RPC calls.
Create GenerateCmd in btcjson v2. Update tests to check GenerateCmd.
Update chaincfg/params.go with a new bool in Params, GenerateSupported,
with true values in SimNetParams and RegressionNetParams and false in
the others.
Create new flag, discreteMining, in CPUMiner struct.
Add GenerateNBlocks function to cpuminer.go and handleGenerate
function to rpcserver.go.
Update documentation for the RPC calls.