btcjson: Update searchrawtransactions verbose.

This commit updates the SearchRawTransactionsCmd verbose parameter in the
latest version of btcjson to an integer to match recent changes to the
previous version of btcjson.
This commit is contained in:
Dave Collins 2015-02-23 15:42:00 -06:00
parent 859d9a7520
commit c0428f6f9f
3 changed files with 18 additions and 18 deletions

View file

@ -513,7 +513,7 @@ func NewReconsiderBlockCmd(blockHash string) *ReconsiderBlockCmd {
// SearchRawTransactionsCmd defines the searchrawtransactions JSON-RPC command. // SearchRawTransactionsCmd defines the searchrawtransactions JSON-RPC command.
type SearchRawTransactionsCmd struct { type SearchRawTransactionsCmd struct {
Address string Address string
Verbose *bool `jsonrpcdefault:"true"` Verbose *int `jsonrpcdefault:"1"`
Skip *int `jsonrpcdefault:"0"` Skip *int `jsonrpcdefault:"0"`
Count *int `jsonrpcdefault:"100"` Count *int `jsonrpcdefault:"100"`
} }
@ -523,7 +523,7 @@ type SearchRawTransactionsCmd 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 NewSearchRawTransactionsCmd(address string, verbose *bool, skip, count *int) *SearchRawTransactionsCmd { func NewSearchRawTransactionsCmd(address string, verbose, skip, count *int) *SearchRawTransactionsCmd {
return &SearchRawTransactionsCmd{ return &SearchRawTransactionsCmd{
Address: address, Address: address,
Verbose: verbose, Verbose: verbose,

View file

@ -640,7 +640,7 @@ func TestChainSvrCmds(t *testing.T) {
marshalled: `{"jsonrpc":"1.0","method":"searchrawtransactions","params":["1Address"],"id":1}`, marshalled: `{"jsonrpc":"1.0","method":"searchrawtransactions","params":["1Address"],"id":1}`,
unmarshalled: &btcjson.SearchRawTransactionsCmd{ unmarshalled: &btcjson.SearchRawTransactionsCmd{
Address: "1Address", Address: "1Address",
Verbose: btcjson.Bool(true), Verbose: btcjson.Int(1),
Skip: btcjson.Int(0), Skip: btcjson.Int(0),
Count: btcjson.Int(100), Count: btcjson.Int(100),
}, },
@ -648,16 +648,16 @@ func TestChainSvrCmds(t *testing.T) {
{ {
name: "searchrawtransactions", name: "searchrawtransactions",
newCmd: func() (interface{}, error) { newCmd: func() (interface{}, error) {
return btcjson.NewCmd("searchrawtransactions", "1Address", false) return btcjson.NewCmd("searchrawtransactions", "1Address", 0)
}, },
staticCmd: func() interface{} { staticCmd: func() interface{} {
return btcjson.NewSearchRawTransactionsCmd("1Address", return btcjson.NewSearchRawTransactionsCmd("1Address",
btcjson.Bool(false), nil, nil) btcjson.Int(0), nil, nil)
}, },
marshalled: `{"jsonrpc":"1.0","method":"searchrawtransactions","params":["1Address",false],"id":1}`, marshalled: `{"jsonrpc":"1.0","method":"searchrawtransactions","params":["1Address",0],"id":1}`,
unmarshalled: &btcjson.SearchRawTransactionsCmd{ unmarshalled: &btcjson.SearchRawTransactionsCmd{
Address: "1Address", Address: "1Address",
Verbose: btcjson.Bool(false), Verbose: btcjson.Int(0),
Skip: btcjson.Int(0), Skip: btcjson.Int(0),
Count: btcjson.Int(100), Count: btcjson.Int(100),
}, },
@ -665,16 +665,16 @@ func TestChainSvrCmds(t *testing.T) {
{ {
name: "searchrawtransactions", name: "searchrawtransactions",
newCmd: func() (interface{}, error) { newCmd: func() (interface{}, error) {
return btcjson.NewCmd("searchrawtransactions", "1Address", false, 5) return btcjson.NewCmd("searchrawtransactions", "1Address", 0, 5)
}, },
staticCmd: func() interface{} { staticCmd: func() interface{} {
return btcjson.NewSearchRawTransactionsCmd("1Address", return btcjson.NewSearchRawTransactionsCmd("1Address",
btcjson.Bool(false), btcjson.Int(5), nil) btcjson.Int(0), btcjson.Int(5), nil)
}, },
marshalled: `{"jsonrpc":"1.0","method":"searchrawtransactions","params":["1Address",false,5],"id":1}`, marshalled: `{"jsonrpc":"1.0","method":"searchrawtransactions","params":["1Address",0,5],"id":1}`,
unmarshalled: &btcjson.SearchRawTransactionsCmd{ unmarshalled: &btcjson.SearchRawTransactionsCmd{
Address: "1Address", Address: "1Address",
Verbose: btcjson.Bool(false), Verbose: btcjson.Int(0),
Skip: btcjson.Int(5), Skip: btcjson.Int(5),
Count: btcjson.Int(100), Count: btcjson.Int(100),
}, },
@ -682,16 +682,16 @@ func TestChainSvrCmds(t *testing.T) {
{ {
name: "searchrawtransactions", name: "searchrawtransactions",
newCmd: func() (interface{}, error) { newCmd: func() (interface{}, error) {
return btcjson.NewCmd("searchrawtransactions", "1Address", false, 5, 10) return btcjson.NewCmd("searchrawtransactions", "1Address", 0, 5, 10)
}, },
staticCmd: func() interface{} { staticCmd: func() interface{} {
return btcjson.NewSearchRawTransactionsCmd("1Address", return btcjson.NewSearchRawTransactionsCmd("1Address",
btcjson.Bool(false), btcjson.Int(5), btcjson.Int(10)) btcjson.Int(0), btcjson.Int(5), btcjson.Int(10))
}, },
marshalled: `{"jsonrpc":"1.0","method":"searchrawtransactions","params":["1Address",false,5,10],"id":1}`, marshalled: `{"jsonrpc":"1.0","method":"searchrawtransactions","params":["1Address",0,5,10],"id":1}`,
unmarshalled: &btcjson.SearchRawTransactionsCmd{ unmarshalled: &btcjson.SearchRawTransactionsCmd{
Address: "1Address", Address: "1Address",
Verbose: btcjson.Bool(false), Verbose: btcjson.Int(0),
Skip: btcjson.Int(5), Skip: btcjson.Int(5),
Count: btcjson.Int(10), Count: btcjson.Int(10),
}, },

View file

@ -2641,7 +2641,7 @@ func handleSearchRawTransactions(s *rpcServer, cmd interface{}, closeChan <-chan
} }
// When not in verbose mode, simply return a list of serialized txs. // When not in verbose mode, simply return a list of serialized txs.
if c.Verbose != nil && *c.Verbose == false { if c.Verbose != nil && *c.Verbose == 0 {
serializedTxs := make([]string, len(addressTxs), len(addressTxs)) serializedTxs := make([]string, len(addressTxs), len(addressTxs))
for i, txReply := range addressTxs { for i, txReply := range addressTxs {
serializedTxs[i], err = messageToHex(txReply.Tx) serializedTxs[i], err = messageToHex(txReply.Tx)