diff --git a/util/btcctl/btcctl.go b/util/btcctl/btcctl.go index b35dd2f1..66b5c964 100644 --- a/util/btcctl/btcctl.go +++ b/util/btcctl/btcctl.go @@ -76,6 +76,7 @@ var commandHandlers = map[string]*handlerData{ "stop": &handlerData{0, 0, displayGeneric, nil, makeStop, ""}, "submitblock": &handlerData{1, 1, displayGeneric, nil, makeSubmitBlock, " [jsonparametersobject]"}, "verifychain": &handlerData{0, 2, displayJSONDump, []conversionHandler{toInt, toInt}, makeVerifyChain, "[level] [numblocks]"}, + "walletpassphrase": &handlerData{1, 1, displayGeneric, []conversionHandler{nil, toInt64}, makeWalletPassphrase, " [timeout]"}, } // toInt attempts to convert the passed string to an integer. It returns the @@ -449,6 +450,15 @@ func makeVerifyChain(args []interface{}) (btcjson.Cmd, error) { return btcjson.NewVerifyChainCmd("btcctl", iargs...) } +// makeWalletPassphrase generates the cmd structure for walletpassphrase commands. +func makeWalletPassphrase(args []interface{}) (btcjson.Cmd, error) { + timeout := int64(60) + if len(args) > 1 { + timeout = args[1].(int64) + } + return btcjson.NewWalletPassphraseCmd("btcctl", args[0].(string), timeout) +} + // 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 // an appropriate error.