From 6c9a206709cc49bde72d6f4db657b34b43e163c5 Mon Sep 17 00:00:00 2001 From: David Hill Date: Mon, 27 Jan 2014 21:11:59 -0500 Subject: [PATCH] add keypoolrefill to btcctl --- util/btcctl/btcctl.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/util/btcctl/btcctl.go b/util/btcctl/btcctl.go index 89f938044..f337bc339 100644 --- a/util/btcctl/btcctl.go +++ b/util/btcctl/btcctl.go @@ -72,6 +72,7 @@ var commandHandlers = map[string]*handlerData{ "getwork": &handlerData{0, 1, displayJSONDump, nil, makeGetWork, "[jsonrequestobject]"}, "help": &handlerData{0, 1, displayGeneric, nil, makeHelp, "[commandName]"}, "importprivkey": &handlerData{1, 2, displayGeneric, []conversionHandler{nil, nil, toBool}, makeImportPrivKey, " [label] [rescan=true]"}, + "keypoolrefill": &handlerData{0, 1, displayGeneric, []conversionHandler{toInt}, makeKeyPoolRefill, "[newsize]"}, "listaccounts": &handlerData{0, 1, displayJSONDump, []conversionHandler{toInt}, makeListAccounts, "[minconf=1]"}, "listsinceblock": &handlerData{0, 2, displayJSONDump, []conversionHandler{nil, toInt}, makeListSinceBlock, "[blockhash] [minconf=10]"}, "listtransactions": &handlerData{0, 3, displayJSONDump, []conversionHandler{nil, toInt, toInt}, makeListTransactions, "[account] [count=10] [from=0]"}, @@ -426,6 +427,16 @@ func makeImportPrivKey(args []interface{}) (btcjson.Cmd, error) { return btcjson.NewImportPrivKeyCmd("btcctl", args[0].(string), optargs...) } +// makeKeyPoolRefill generates the cmd structure for keypoolrefill commands. +func makeKeyPoolRefill(args []interface{}) (btcjson.Cmd, error) { + var optargs = make([]uint, 0, 1) + if len(args) > 0 { + optargs = append(optargs, uint(args[0].(int))) + } + + return btcjson.NewKeyPoolRefillCmd("btcctl", optargs...) +} + // makeListAccounts generates the cmd structure for listaccounts commands. func makeListAccounts(args []interface{}) (btcjson.Cmd, error) { var optargs = make([]int, 0, 1)