Refactor GetBlockCmd type and NewGetBlockCmd() function to follow the bitcoin json RPC verbosity format for getblock,

which uses 0, 1, or 2 as parameters rather than a boolean true or false.
This commit is contained in:
jalavosus 2020-01-31 12:27:38 -05:00
parent 06e5c43499
commit 160c388285

View file

@ -130,8 +130,7 @@ func NewGetBestBlockHashCmd() *GetBestBlockHashCmd {
// GetBlockCmd defines the getblock JSON-RPC command. // GetBlockCmd defines the getblock JSON-RPC command.
type GetBlockCmd struct { type GetBlockCmd struct {
Hash string Hash string
Verbose *bool `jsonrpcdefault:"true"` Verbosity *int `jsonrpcdefault:"0"`
VerboseTx *bool `jsonrpcdefault:"false"`
} }
// NewGetBlockCmd returns a new instance which can be used to issue a getblock // NewGetBlockCmd returns a new instance which can be used to issue a getblock
@ -139,11 +138,10 @@ type GetBlockCmd struct {
// //
// The parameters which are pointers indicate they are optional. Passing nil // The parameters which are pointers indicate they are optional. Passing nil
// for optional parameters will use the default value. // for optional parameters will use the default value.
func NewGetBlockCmd(hash string, verbose, verboseTx *bool) *GetBlockCmd { func NewGetBlockCmd(hash string, verbosity *int) *GetBlockCmd {
return &GetBlockCmd{ return &GetBlockCmd{
Hash: hash, Hash: hash,
Verbose: verbose, Verbosity: verbosity,
VerboseTx: verboseTx,
} }
} }