diff --git a/jsonapi.go b/jsonapi.go index 63e6edcc..ba678d23 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -490,13 +490,13 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } type vlist struct { Txid string `json:"txid"` - Vout int `json:"vout"` + Vout uint32 `json:"vout"` } vList := make([]vlist, len(args)/4) addresses := make(map[string]float64) for i := 0; i < len(args)/4; i += 1 { txid, ok1 := args[(i*4)+0].(string) - vout, ok2 := args[(i*4)+1].(int) + vout, ok2 := args[(i*4)+1].(uint32) add, ok3 := args[(i*4)+2].(string) amt, ok4 := args[(i*4)+3].(float64) if !ok1 || !ok2 || !ok3 || !ok4 { @@ -574,14 +574,14 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } type txlist struct { Txid string `json:"txid"` - Vout int `json:"vout"` + Vout uint32 `json:"vout"` ScriptPubKey string `json:"scriptPubKey"` } txList := make([]txlist, 1) if len(args) > 1 { txid, ok2 := args[1].(string) - vout, ok3 := args[2].(int) + vout, ok3 := args[2].(uint32) spkey, ok4 := args[3].(string) if !ok1 || !ok2 || !ok3 || !ok4 { err = fmt.Errorf("Incorrect arguement types.") diff --git a/jsonapi_test.go b/jsonapi_test.go index 0871ded8..91bf28c9 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -154,7 +154,7 @@ var cmdtests = []struct { {"addmultisignaddress", []interface{}{1, "test"}, false}, {"addmultisignaddress", []interface{}{1, 1.0, "test"}, false}, {"addmultisignaddress", []interface{}{1, "test", "test", "test"}, true}, - {"createrawtransaction", []interface{}{"in1", 0, "a1", 1.0}, true}, + {"createrawtransaction", []interface{}{"in1", uint32(0), "a1", 1.0}, true}, {"createrawtransaction", []interface{}{"in1", "out1", "a1", 1.0, "test"}, false}, {"createrawtransaction", []interface{}{}, false}, {"createrawtransaction", []interface{}{"in1", 1.0, "a1", 1.0}, false}, @@ -166,7 +166,7 @@ var cmdtests = []struct { {"lockunspent", []interface{}{true, "something"}, true}, {"lockunspent", []interface{}{true}, false}, {"lockunspent", []interface{}{1.0, "something"}, false}, - {"signrawtransaction", []interface{}{"hexstring", "test", 1, "test"}, true}, + {"signrawtransaction", []interface{}{"hexstring", "test", uint32(1), "test"}, true}, {"signrawtransaction", []interface{}{"hexstring", "test", "test2", "test3", "test4"}, false}, {"signrawtransaction", []interface{}{"hexstring", "test", "test2", "test3"}, false}, {"signrawtransaction", []interface{}{1.2, "test", "test2", "test3", "test4"}, false}, diff --git a/jsoncmd.go b/jsoncmd.go index 8cc0df22..6dd97b6b 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -752,7 +752,7 @@ func (cmd *CreateMultisigCmd) UnmarshalJSON(b []byte) error { // transactionsha and output number pair. type TransactionInput struct { Txid string `json:"txid"` - Vout int `json:"vout"` + Vout uint32 `json:"vout"` } // CreateRawTransactionCmd is a type handling custom marshaling and diff --git a/jsonresults.go b/jsonresults.go index 48f62302..a675bbcf 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -158,7 +158,7 @@ type ScriptSig struct { type Vin struct { Coinbase string `json:"coinbase"` Txid string `json:"txid"` - Vout int `json:"vout"` + Vout uint32 `json:"vout"` ScriptSig *ScriptSig `json:"scriptSig"` Sequence uint32 `json:"sequence"` } @@ -183,7 +183,7 @@ func (v *Vin) MarshalJSON() ([]byte, error) { txStruct := struct { Txid string `json:"txid"` - Vout int `json:"vout"` + Vout uint32 `json:"vout"` ScriptSig *ScriptSig `json:"scriptSig"` Sequence uint32 `json:"sequence"` }{ @@ -199,7 +199,7 @@ func (v *Vin) MarshalJSON() ([]byte, error) { // getrawtransaction and decoderawtransaction use the same structure. type Vout struct { Value float64 `json:"value"` - N int `json:"n"` + N uint32 `json:"n"` ScriptPubKey struct { Asm string `json:"asm"` Hex string `json:"hex"`