Fix optional arg handling for importprivkey.

This commit is contained in:
Josh Rickmar 2013-11-20 11:12:00 -05:00
parent 4a290162ee
commit 0bee8478a9

View file

@ -205,17 +205,15 @@ func makeGetRawTransaction(args []interface{}) (btcjson.Cmd, error) {
// makeImportPrivKey generates the cmd structure for // makeImportPrivKey generates the cmd structure for
// importprivkey commands. // importprivkey commands.
func makeImportPrivKey(args []interface{}) (btcjson.Cmd, error) { func makeImportPrivKey(args []interface{}) (btcjson.Cmd, error) {
var label string var optargs = make([]interface{}, 0, 2)
var rescan bool
if len(args) > 1 { if len(args) > 1 {
label = args[1].(string) optargs = append(optargs, args[1].(string))
} }
if len(args) > 2 { if len(args) > 2 {
rescan = args[2].(bool) optargs = append(optargs, args[2].(bool))
} }
return btcjson.NewImportPrivKeyCmd("btcctl", args[0].(string), label, return btcjson.NewImportPrivKeyCmd("btcctl", args[0].(string), optargs...)
rescan)
} }
// makeStop generates the cmd structure for stop comands. // makeStop generates the cmd structure for stop comands.