Add walletpassphrasechange support to btcctl.

This commit is contained in:
Josh Rickmar 2014-01-27 13:39:01 -05:00
parent ffe767c679
commit 36e5aa8e92

View file

@ -78,6 +78,7 @@ var commandHandlers = map[string]*handlerData{
"submitblock": &handlerData{1, 1, displayGeneric, nil, makeSubmitBlock, "<hexdata> [jsonparametersobject]"}, "submitblock": &handlerData{1, 1, displayGeneric, nil, makeSubmitBlock, "<hexdata> [jsonparametersobject]"},
"verifychain": &handlerData{0, 2, displayJSONDump, []conversionHandler{toInt, toInt}, makeVerifyChain, "[level] [numblocks]"}, "verifychain": &handlerData{0, 2, displayJSONDump, []conversionHandler{toInt, toInt}, makeVerifyChain, "[level] [numblocks]"},
"walletpassphrase": &handlerData{1, 1, displayGeneric, []conversionHandler{nil, toInt64}, makeWalletPassphrase, "<passphrase> [timeout]"}, "walletpassphrase": &handlerData{1, 1, displayGeneric, []conversionHandler{nil, toInt64}, makeWalletPassphrase, "<passphrase> [timeout]"},
"walletpassphrasechange": &handlerData{2, 0, displayGeneric, nil, makeWalletPassphraseChange, "<oldpassphrase> <newpassphrase>"},
} }
// toInt attempts to convert the passed string to an integer. It returns the // toInt attempts to convert the passed string to an integer. It returns the
@ -466,6 +467,13 @@ func makeWalletPassphrase(args []interface{}) (btcjson.Cmd, error) {
return btcjson.NewWalletPassphraseCmd("btcctl", args[0].(string), timeout) return btcjson.NewWalletPassphraseCmd("btcctl", args[0].(string), timeout)
} }
// makeWalletPassphraseChange generates the cmd structure for
// walletpassphrasechange commands.
func makeWalletPassphraseChange(args []interface{}) (btcjson.Cmd, error) {
return btcjson.NewWalletPassphraseChangeCmd("btcctl", args[0].(string),
args[1].(string))
}
// send sends a JSON-RPC command to the specified RPC server and examines the // send sends a JSON-RPC command to the specified RPC server and examines the
// results for various error conditions. It either returns a valid result or // results for various error conditions. It either returns a valid result or
// an appropriate error. // an appropriate error.