diff --git a/util/btcctl/btcctl.go b/util/btcctl/btcctl.go index 2bc8630b1..82b0663e0 100644 --- a/util/btcctl/btcctl.go +++ b/util/btcctl/btcctl.go @@ -45,63 +45,63 @@ var ( // commandHandlers is a map of commands and associated handler data that is used // to validate correctness and perform the command. var commandHandlers = map[string]*handlerData{ - "addnode": &handlerData{2, 0, displayJSONDump, nil, makeAddNode, " "}, - "createrawtransaction": &handlerData{2, 0, displayGeneric, nil, makeCreateRawTransaction, "\"[{\"txid\":\"id\",\"vout\":n},...]\" \"{\"address\":amount,...}\""}, - "debuglevel": &handlerData{1, 0, displayGeneric, nil, makeDebugLevel, ""}, - "decoderawtransaction": &handlerData{1, 0, displayJSONDump, nil, makeDecodeRawTransaction, ""}, - "decodescript": &handlerData{1, 0, displayJSONDump, nil, makeDecodeScript, ""}, - "dumpprivkey": &handlerData{1, 0, displayGeneric, nil, makeDumpPrivKey, ""}, - "getaccount": &handlerData{1, 0, displayGeneric, nil, makeGetAccount, "
"}, - "getaccountaddress": &handlerData{1, 0, displayGeneric, nil, makeGetAccountAddress, ""}, - "getaddednodeinfo": &handlerData{1, 1, displayJSONDump, []conversionHandler{toBool, nil}, makeGetAddedNodeInfo, " [node]"}, - "getaddressesbyaccount": &handlerData{1, 0, displayJSONDump, nil, makeGetAddressesByAccount, "[account]"}, - "getbalance": &handlerData{0, 2, displayGeneric, []conversionHandler{nil, toInt}, makeGetBalance, "[account] [minconf=1]"}, - "getbestblockhash": &handlerData{0, 0, displayGeneric, nil, makeGetBestBlockHash, ""}, - "getblock": &handlerData{1, 2, displayJSONDump, []conversionHandler{nil, toBool, toBool}, makeGetBlock, ""}, - "getblockcount": &handlerData{0, 0, displayGeneric, nil, makeGetBlockCount, ""}, - "getblockhash": &handlerData{1, 0, displayGeneric, []conversionHandler{toInt64}, makeGetBlockHash, ""}, - "getblocktemplate": &handlerData{0, 1, displayJSONDump, nil, makeGetBlockTemplate, "[jsonrequestobject]"}, - "getconnectioncount": &handlerData{0, 0, displayGeneric, nil, makeGetConnectionCount, ""}, - "getdifficulty": &handlerData{0, 0, displayFloat64, nil, makeGetDifficulty, ""}, - "getgenerate": &handlerData{0, 0, displayGeneric, nil, makeGetGenerate, ""}, - "gethashespersec": &handlerData{0, 0, displayGeneric, nil, makeGetHashesPerSec, ""}, - "getinfo": &handlerData{0, 0, displayJSONDump, nil, makeGetInfo, ""}, - "getnettotals": &handlerData{0, 0, displayGeneric, nil, makeGetNetTotals, ""}, - "getnewaddress": &handlerData{0, 1, displayGeneric, nil, makeGetNewAddress, "[account]"}, - "getpeerinfo": &handlerData{0, 0, displayJSONDump, nil, makeGetPeerInfo, ""}, - "getrawchangeaddress": &handlerData{0, 0, displayGeneric, nil, makeGetRawChangeAddress, ""}, - "getrawmempool": &handlerData{0, 1, displayJSONDump, []conversionHandler{toBool}, makeGetRawMempool, "[verbose=false]"}, - "getrawtransaction": &handlerData{1, 1, displayJSONDump, []conversionHandler{nil, toInt}, makeGetRawTransaction, " [verbose=0]"}, - "getreceivedbyaccount": &handlerData{1, 1, displayGeneric, []conversionHandler{nil, toInt}, makeGetReceivedByAccount, " [minconf=1]"}, - "getreceivedbyaddress": &handlerData{1, 1, displayGeneric, []conversionHandler{nil, toInt}, makeGetReceivedByAddress, "
[minconf=1]"}, - "gettxoutsetinfo": &handlerData{0, 0, displayJSONDump, nil, makeGetTxOutSetInfo, ""}, - "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]"}, - "listaddressgroupings": &handlerData{0, 0, displayJSONDump, nil, makeListAddressGroupings, ""}, - "listreceivedbyaccount": &handlerData{0, 2, displayJSONDump, []conversionHandler{toInt, toBool}, makeListReceivedByAccount, "[minconf] [includeempty]"}, - "listreceivedbyaddress": &handlerData{0, 2, displayJSONDump, []conversionHandler{toInt, toBool}, makeListReceivedByAddress, "[minconf] [includeempty]"}, - "listlockunspent": &handlerData{0, 0, displayJSONDump, nil, makeListLockUnspent, ""}, - "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]"}, - "listunspent": &handlerData{0, 3, displayJSONDump, []conversionHandler{toInt, toInt, nil}, makeListUnspent, "[minconf=1] [maxconf=9999999] [jsonaddressarray]"}, - "ping": &handlerData{0, 0, displayGeneric, nil, makePing, ""}, - "sendfrom": &handlerData{3, 3, displayGeneric, []conversionHandler{nil, nil, toSatoshi, toInt, nil, nil}, + "addnode": {2, 0, displayJSONDump, nil, makeAddNode, " "}, + "createrawtransaction": {2, 0, displayGeneric, nil, makeCreateRawTransaction, "\"[{\"txid\":\"id\",\"vout\":n},...]\" \"{\"address\":amount,...}\""}, + "debuglevel": {1, 0, displayGeneric, nil, makeDebugLevel, ""}, + "decoderawtransaction": {1, 0, displayJSONDump, nil, makeDecodeRawTransaction, ""}, + "decodescript": {1, 0, displayJSONDump, nil, makeDecodeScript, ""}, + "dumpprivkey": {1, 0, displayGeneric, nil, makeDumpPrivKey, ""}, + "getaccount": {1, 0, displayGeneric, nil, makeGetAccount, "
"}, + "getaccountaddress": {1, 0, displayGeneric, nil, makeGetAccountAddress, ""}, + "getaddednodeinfo": {1, 1, displayJSONDump, []conversionHandler{toBool, nil}, makeGetAddedNodeInfo, " [node]"}, + "getaddressesbyaccount": {1, 0, displayJSONDump, nil, makeGetAddressesByAccount, "[account]"}, + "getbalance": {0, 2, displayGeneric, []conversionHandler{nil, toInt}, makeGetBalance, "[account] [minconf=1]"}, + "getbestblockhash": {0, 0, displayGeneric, nil, makeGetBestBlockHash, ""}, + "getblock": {1, 2, displayJSONDump, []conversionHandler{nil, toBool, toBool}, makeGetBlock, ""}, + "getblockcount": {0, 0, displayGeneric, nil, makeGetBlockCount, ""}, + "getblockhash": {1, 0, displayGeneric, []conversionHandler{toInt64}, makeGetBlockHash, ""}, + "getblocktemplate": {0, 1, displayJSONDump, nil, makeGetBlockTemplate, "[jsonrequestobject]"}, + "getconnectioncount": {0, 0, displayGeneric, nil, makeGetConnectionCount, ""}, + "getdifficulty": {0, 0, displayFloat64, nil, makeGetDifficulty, ""}, + "getgenerate": {0, 0, displayGeneric, nil, makeGetGenerate, ""}, + "gethashespersec": {0, 0, displayGeneric, nil, makeGetHashesPerSec, ""}, + "getinfo": {0, 0, displayJSONDump, nil, makeGetInfo, ""}, + "getnettotals": {0, 0, displayGeneric, nil, makeGetNetTotals, ""}, + "getnewaddress": {0, 1, displayGeneric, nil, makeGetNewAddress, "[account]"}, + "getpeerinfo": {0, 0, displayJSONDump, nil, makeGetPeerInfo, ""}, + "getrawchangeaddress": {0, 0, displayGeneric, nil, makeGetRawChangeAddress, ""}, + "getrawmempool": {0, 1, displayJSONDump, []conversionHandler{toBool}, makeGetRawMempool, "[verbose=false]"}, + "getrawtransaction": {1, 1, displayJSONDump, []conversionHandler{nil, toInt}, makeGetRawTransaction, " [verbose=0]"}, + "getreceivedbyaccount": {1, 1, displayGeneric, []conversionHandler{nil, toInt}, makeGetReceivedByAccount, " [minconf=1]"}, + "getreceivedbyaddress": {1, 1, displayGeneric, []conversionHandler{nil, toInt}, makeGetReceivedByAddress, "
[minconf=1]"}, + "gettxoutsetinfo": {0, 0, displayJSONDump, nil, makeGetTxOutSetInfo, ""}, + "getwork": {0, 1, displayJSONDump, nil, makeGetWork, "[jsonrequestobject]"}, + "help": {0, 1, displayGeneric, nil, makeHelp, "[commandName]"}, + "importprivkey": {1, 2, displayGeneric, []conversionHandler{nil, nil, toBool}, makeImportPrivKey, " [label] [rescan=true]"}, + "keypoolrefill": {0, 1, displayGeneric, []conversionHandler{toInt}, makeKeyPoolRefill, "[newsize]"}, + "listaccounts": {0, 1, displayJSONDump, []conversionHandler{toInt}, makeListAccounts, "[minconf=1]"}, + "listaddressgroupings": {0, 0, displayJSONDump, nil, makeListAddressGroupings, ""}, + "listreceivedbyaccount": {0, 2, displayJSONDump, []conversionHandler{toInt, toBool}, makeListReceivedByAccount, "[minconf] [includeempty]"}, + "listreceivedbyaddress": {0, 2, displayJSONDump, []conversionHandler{toInt, toBool}, makeListReceivedByAddress, "[minconf] [includeempty]"}, + "listlockunspent": {0, 0, displayJSONDump, nil, makeListLockUnspent, ""}, + "listsinceblock": {0, 2, displayJSONDump, []conversionHandler{nil, toInt}, makeListSinceBlock, "[blockhash] [minconf=10]"}, + "listtransactions": {0, 3, displayJSONDump, []conversionHandler{nil, toInt, toInt}, makeListTransactions, "[account] [count=10] [from=0]"}, + "listunspent": {0, 3, displayJSONDump, []conversionHandler{toInt, toInt, nil}, makeListUnspent, "[minconf=1] [maxconf=9999999] [jsonaddressarray]"}, + "ping": {0, 0, displayGeneric, nil, makePing, ""}, + "sendfrom": {3, 3, displayGeneric, []conversionHandler{nil, nil, toSatoshi, toInt, nil, nil}, makeSendFrom, "
[minconf=1] [comment] [comment-to]"}, - "sendmany": &handlerData{2, 2, displayGeneric, []conversionHandler{nil, nil, toInt, nil}, makeSendMany, " <{\"address\":amount,...}> [minconf=1] [comment]"}, - "sendrawtransaction": &handlerData{1, 0, displayGeneric, nil, makeSendRawTransaction, ""}, - "sendtoaddress": &handlerData{2, 2, displayGeneric, []conversionHandler{nil, toSatoshi, nil, nil}, makeSendToAddress, "
[comment] [comment-to]"}, - "settxfee": &handlerData{1, 0, displayGeneric, []conversionHandler{toSatoshi}, makeSetTxFee, ""}, - "stop": &handlerData{0, 0, displayGeneric, nil, makeStop, ""}, - "submitblock": &handlerData{1, 1, displayGeneric, nil, makeSubmitBlock, " [jsonparametersobject]"}, - "validateaddress": &handlerData{1, 0, displayJSONDump, nil, makeValidateAddress, "
"}, - "verifychain": &handlerData{0, 2, displayJSONDump, []conversionHandler{toInt, toInt}, makeVerifyChain, "[level] [numblocks]"}, - "verifymessage": &handlerData{3, 0, displayGeneric, nil, makeVerifyMessage, "
"}, - "walletlock": &handlerData{0, 0, displayGeneric, nil, makeWalletLock, ""}, - "walletpassphrase": &handlerData{1, 1, displayGeneric, []conversionHandler{nil, toInt64}, makeWalletPassphrase, " [timeout]"}, - "walletpassphrasechange": &handlerData{2, 0, displayGeneric, nil, makeWalletPassphraseChange, " "}, + "sendmany": {2, 2, displayGeneric, []conversionHandler{nil, nil, toInt, nil}, makeSendMany, " <{\"address\":amount,...}> [minconf=1] [comment]"}, + "sendrawtransaction": {1, 0, displayGeneric, nil, makeSendRawTransaction, ""}, + "sendtoaddress": {2, 2, displayGeneric, []conversionHandler{nil, toSatoshi, nil, nil}, makeSendToAddress, "
[comment] [comment-to]"}, + "settxfee": {1, 0, displayGeneric, []conversionHandler{toSatoshi}, makeSetTxFee, ""}, + "stop": {0, 0, displayGeneric, nil, makeStop, ""}, + "submitblock": {1, 1, displayGeneric, nil, makeSubmitBlock, " [jsonparametersobject]"}, + "validateaddress": {1, 0, displayJSONDump, nil, makeValidateAddress, "
"}, + "verifychain": {0, 2, displayJSONDump, []conversionHandler{toInt, toInt}, makeVerifyChain, "[level] [numblocks]"}, + "verifymessage": {3, 0, displayGeneric, nil, makeVerifyMessage, "
"}, + "walletlock": {0, 0, displayGeneric, nil, makeWalletLock, ""}, + "walletpassphrase": {1, 1, displayGeneric, []conversionHandler{nil, toInt64}, makeWalletPassphrase, " [timeout]"}, + "walletpassphrasechange": {2, 0, displayGeneric, nil, makeWalletPassphraseChange, " "}, } // toSatoshi attempts to convert the passed string to a satoshi amount returned