Make importprivkey rescan optarg default to true.

This commit is contained in:
Josh Rickmar 2013-11-19 15:26:47 -05:00
parent e43c79c74d
commit 8d9b8fcf82
2 changed files with 4 additions and 3 deletions

View file

@ -3520,7 +3520,7 @@ var _ Cmd = &ImportPrivKeyCmd{}
// pointer to a TemplateRequest may be provided. // pointer to a TemplateRequest may be provided.
func NewImportPrivKeyCmd(id interface{}, privkey string, optArgs ...interface{}) (*ImportPrivKeyCmd, error) { func NewImportPrivKeyCmd(id interface{}, privkey string, optArgs ...interface{}) (*ImportPrivKeyCmd, error) {
var label string var label string
var rescan bool rescan := true
var ok bool var ok bool
if len(optArgs) > 2 { if len(optArgs) > 2 {
@ -3567,11 +3567,11 @@ func (cmd *ImportPrivKeyCmd) MarshalJSON() ([]byte, error) {
}, },
} }
if cmd.Label != "" || cmd.Rescan { if cmd.Label != "" || !cmd.Rescan {
raw.Params = append(raw.Params, cmd.Label) raw.Params = append(raw.Params, cmd.Label)
} }
if cmd.Rescan { if !cmd.Rescan {
raw.Params = append(raw.Params, cmd.Rescan) raw.Params = append(raw.Params, cmd.Rescan)
} }
return json.Marshal(raw) return json.Marshal(raw)

View file

@ -670,6 +670,7 @@ var jsoncmdtests = []struct {
result: &ImportPrivKeyCmd{ result: &ImportPrivKeyCmd{
id: float64(1), id: float64(1),
PrivKey: "somereallongprivatekey", PrivKey: "somereallongprivatekey",
Rescan: true,
}, },
}, },
{ {