btcctl: Fix createrawtransaction amounts.

These were being counted in satoshis, when the JSON object should be
containing JSON numbers, counted in BTC.
This commit is contained in:
Josh Rickmar 2014-09-05 16:51:36 -05:00 committed by Dave Collins
parent cf4f19dd4c
commit 790f652d06

View file

@ -250,12 +250,21 @@ func makeCreateRawTransaction(args []interface{}) (btcjson.Cmd, error) {
return nil, err
}
var amounts map[string]int64
err = json.Unmarshal([]byte(args[1].(string)), &amounts)
var famounts map[string]float64
err = json.Unmarshal([]byte(args[1].(string)), &famounts)
if err != nil {
return nil, err
}
amounts := make(map[string]int64, len(famounts))
for k, v := range famounts {
amt, err := btcutil.NewAmount(v)
if err != nil {
return nil, err
}
amounts[k] = int64(amt)
}
return btcjson.NewCreateRawTransactionCmd("btcctl", inputs, amounts)
}