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:
parent
cf4f19dd4c
commit
790f652d06
1 changed files with 11 additions and 2 deletions
|
@ -250,12 +250,21 @@ func makeCreateRawTransaction(args []interface{}) (btcjson.Cmd, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var amounts map[string]int64
|
var famounts map[string]float64
|
||||||
err = json.Unmarshal([]byte(args[1].(string)), &amounts)
|
err = json.Unmarshal([]byte(args[1].(string)), &famounts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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)
|
return btcjson.NewCreateRawTransactionCmd("btcctl", inputs, amounts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue