From 790f652d067a576de47716872aa95c894a4f31e2 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Fri, 5 Sep 2014 16:51:36 -0500 Subject: [PATCH] btcctl: Fix createrawtransaction amounts. These were being counted in satoshis, when the JSON object should be containing JSON numbers, counted in BTC. --- util/btcctl/btcctl.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/util/btcctl/btcctl.go b/util/btcctl/btcctl.go index 165b8b07..730bb202 100644 --- a/util/btcctl/btcctl.go +++ b/util/btcctl/btcctl.go @@ -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) }