-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. grammar nitpick: "When the verbose flag is set to 0" |
||
// as a hex-encoded string. | ||
if c.Verbose != nil && !*c.Verbose { | ||
if c.Verbosity != nil && *c.Verbosity == 0 { | ||
return hex.EncodeToString(blkBytes), nil | ||
} | ||
|
||
// The verbose flag is set, so generate the JSON object and return it. | ||
// Generate the JSON object and return it. | ||
|
||
// Deserialize the block. | ||
blk, err := btcutil.NewBlockFromBytes(blkBytes) | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. isn't this line equivalent to |
||
transactions := blk.Transactions() | ||
txNames := make([]string, len(transactions)) | ||
for i, tx := range transactions { | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -153,11 +153,13 @@ var helpDescsEnUS = map[string]string{ | |||||||||
// GetBlockCmd help. | ||||||||||
"getblock--synopsis": "Returns information about a block given its hash.", | ||||||||||
"getblock-hash": "The hash of the block", | ||||||||||
"getblock-verbose": "Specifies the block is returned as a JSON object instead of hex-encoded string", | ||||||||||
"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 commentThe reason will be displayed to describe this comment to others. Learn more. The rest of the help uses Lines 463 to 466 in ab8fa7b
|
||||||||||
"getblock--condition0": "verbosity=0", | ||||||||||
"getblock--condition1": "verbosity=1", | ||||||||||
"getblock--condition2": "verbosity=2", | ||||||||||
"getblock--result0": "Hex-encoded bytes of the serialized block", | ||||||||||
"getblock--result1": "JSON object with information about block", | ||||||||||
"getblock--result2": "JSON object with information about block and information about each transaction.", | ||||||||||
|
||||||||||
// GetBlockChainInfoCmd help. | ||||||||||
"getblockchaininfo--synopsis": "Returns information about the current blockchain state and the status of any active soft-fork deployments.", | ||||||||||
|
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, notVerbosity
. For example,btcd/btcjson/chainsvrcmds.go
Line 412 in ab8fa7b