diff --git a/btcjson/v2/btcjson/chainsvrcmds.go b/btcjson/v2/btcjson/chainsvrcmds.go index 573adf45..427fa709 100644 --- a/btcjson/v2/btcjson/chainsvrcmds.go +++ b/btcjson/v2/btcjson/chainsvrcmds.go @@ -513,9 +513,9 @@ func NewReconsiderBlockCmd(blockHash string) *ReconsiderBlockCmd { // SearchRawTransactionsCmd defines the searchrawtransactions JSON-RPC command. type SearchRawTransactionsCmd struct { Address string - Verbose *bool `jsonrpcdefault:"true"` - Skip *int `jsonrpcdefault:"0"` - Count *int `jsonrpcdefault:"100"` + Verbose *int `jsonrpcdefault:"1"` + Skip *int `jsonrpcdefault:"0"` + Count *int `jsonrpcdefault:"100"` } // NewSearchRawTransactionsCmd returns a new instance which can be used to issue a @@ -523,7 +523,7 @@ type SearchRawTransactionsCmd struct { // // The parameters which are pointers indicate they are optional. Passing nil // 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{ Address: address, Verbose: verbose, diff --git a/btcjson/v2/btcjson/chainsvrcmds_test.go b/btcjson/v2/btcjson/chainsvrcmds_test.go index 4765297b..ba8d0b05 100644 --- a/btcjson/v2/btcjson/chainsvrcmds_test.go +++ b/btcjson/v2/btcjson/chainsvrcmds_test.go @@ -640,7 +640,7 @@ func TestChainSvrCmds(t *testing.T) { marshalled: `{"jsonrpc":"1.0","method":"searchrawtransactions","params":["1Address"],"id":1}`, unmarshalled: &btcjson.SearchRawTransactionsCmd{ Address: "1Address", - Verbose: btcjson.Bool(true), + Verbose: btcjson.Int(1), Skip: btcjson.Int(0), Count: btcjson.Int(100), }, @@ -648,16 +648,16 @@ func TestChainSvrCmds(t *testing.T) { { name: "searchrawtransactions", newCmd: func() (interface{}, error) { - return btcjson.NewCmd("searchrawtransactions", "1Address", false) + return btcjson.NewCmd("searchrawtransactions", "1Address", 0) }, staticCmd: func() interface{} { 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{ Address: "1Address", - Verbose: btcjson.Bool(false), + Verbose: btcjson.Int(0), Skip: btcjson.Int(0), Count: btcjson.Int(100), }, @@ -665,16 +665,16 @@ func TestChainSvrCmds(t *testing.T) { { name: "searchrawtransactions", newCmd: func() (interface{}, error) { - return btcjson.NewCmd("searchrawtransactions", "1Address", false, 5) + return btcjson.NewCmd("searchrawtransactions", "1Address", 0, 5) }, staticCmd: func() interface{} { 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{ Address: "1Address", - Verbose: btcjson.Bool(false), + Verbose: btcjson.Int(0), Skip: btcjson.Int(5), Count: btcjson.Int(100), }, @@ -682,16 +682,16 @@ func TestChainSvrCmds(t *testing.T) { { name: "searchrawtransactions", newCmd: func() (interface{}, error) { - return btcjson.NewCmd("searchrawtransactions", "1Address", false, 5, 10) + return btcjson.NewCmd("searchrawtransactions", "1Address", 0, 5, 10) }, staticCmd: func() interface{} { 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{ Address: "1Address", - Verbose: btcjson.Bool(false), + Verbose: btcjson.Int(0), Skip: btcjson.Int(5), Count: btcjson.Int(10), }, diff --git a/rpcserver.go b/rpcserver.go index 2bce6a9b..7378247d 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -2641,7 +2641,7 @@ func handleSearchRawTransactions(s *rpcServer, cmd interface{}, closeChan <-chan } // 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)) for i, txReply := range addressTxs { serializedTxs[i], err = messageToHex(txReply.Tx)