-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix verbocity in getblock command #1112
Conversation
Hi asidorochev, I am running into the same problem as here which requires this fix. When will this be merged? Thanks! |
@henrykhadass Unfortunately, it does not depend on me. |
@asidorochev I see, you need one of the core developers to review etc? I suppose in the meantime the following is a work around, which does the same:
Would be great to get this merged in! |
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.
This should merged into master as soon as we can!
@asidorochev Clearly there has been a marshal mistake in github.com/btcsuite/btcd/rpcclient/chain.go
error: |
The response from bitcoind reused field "tx" to store two different types of data. It might be better to separate the response type of "GetBlockVerboseTx" from "GetBlockVerbose". Here's an example diff on top of this PR, which is used in my own project:
Provide to @asidorochev as a suggestion, hope this PR can be merged soon. |
I have locally applied @Ronmi Ronmi diff to this PR and it works. I am ready to make more changes/tests/whatever, but I do not know what to do exactly. Can somebody point? |
just find , i also make a pr |
@cabezi, @Ronmi, @asidorochev. |
+1. Please merge this? |
I just ran into this incompatibility problem today. Would be nice for this RPC call to have exactly the same semantics as bitcoind. |
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.
Comments on style and documentation
@@ -1054,13 +1054,13 @@ func handleGetBlock(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (i | |||
} | |||
} | |||
|
|||
// When the verbose flag isn't set, simply return the serialized block | |||
// When the verbosity value setted to 0, simply return the serialized block |
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.
grammar nitpick: "When the verbose flag is set to 0"
@@ -1109,7 +1109,8 @@ func handleGetBlock(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (i | |||
NextHash: nextHashString, | |||
} | |||
|
|||
if c.VerboseTx == nil || !*c.VerboseTx { | |||
// When the verbosity value isn't set, setted to 1 or not equal 0 or 2 | |||
if c.Verbosity == nil || *c.Verbosity == 1 || (*c.Verbosity != 0 && *c.Verbosity != 2) { |
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.
isn't this line equivalent to if *c.Verbosity != 0 && *c.Verbosity != 2
?
"getblock-verbosetx": "Specifies that each transaction is returned as a JSON object and only applies if the verbose flag is true (btcd extension)", | ||
"getblock--condition0": "verbose=false", | ||
"getblock--condition1": "verbose=true", | ||
"getblock-verbosity": "Specifies the block format returns", |
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.
The rest of the help uses command-verbose
and verbose=n
patterns, not a command-verbosity
and verbosity=n
. For example,
Lines 463 to 466 in ab8fa7b
"getrawmempool-verbose": "Returns JSON object when true or an array of transaction hashes when false", | |
"getrawmempool--condition0": "verbose=false", | |
"getrawmempool--condition1": "verbose=true", | |
"getrawmempool--result0": "Array of transaction hashes", |
return &GetBlockCmd{ | ||
Hash: hash, | ||
Verbose: verbose, | ||
VerboseTx: verboseTx, | ||
Verbosity: verbosity, |
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.
The rest of this file uses Verbose
as a variable name, not Verbosity
. For example,
Line 412 in ab8fa7b
Verbose *bool `jsonrpcdefault:"false"` |
I would not hold by breath, it has been sitting in limbo for almost a year, use the PR from |
Yeah this sucks...no one can approve a review? If it's just review changes that are needed I can add those. |
@jcvernaleo (as per #1530)
This also fixes the issue preventing @jalavosus PR #1529 from being merged |
This needs to be rebased, have the conflict fixed, and if @justinmoon's comments could be address. If you can do those 3 things I can do final review and merge. Realized this comment should have been a change request, not just a comment. |
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.
This needs to be rebased, have the conflict fixed, and if @justinmoon's comments could be address. If you can do those 3 things I can do final review and merge.
This can be closed. The change have been made in another PR and merged into master. |
Original "getblock" command accept 2 arguments:
Here is a fix to use getblock command in the same way.