get rid of redundant &handlerData
This commit is contained in:
parent
9f044fb946
commit
c1df0bfce6
1 changed files with 56 additions and 56 deletions
|
@ -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, "<ip> <add/remove/onetry>"},
|
||||
"createrawtransaction": &handlerData{2, 0, displayGeneric, nil, makeCreateRawTransaction, "\"[{\"txid\":\"id\",\"vout\":n},...]\" \"{\"address\":amount,...}\""},
|
||||
"debuglevel": &handlerData{1, 0, displayGeneric, nil, makeDebugLevel, "<levelspec>"},
|
||||
"decoderawtransaction": &handlerData{1, 0, displayJSONDump, nil, makeDecodeRawTransaction, "<txhash>"},
|
||||
"decodescript": &handlerData{1, 0, displayJSONDump, nil, makeDecodeScript, "<hex>"},
|
||||
"dumpprivkey": &handlerData{1, 0, displayGeneric, nil, makeDumpPrivKey, "<bitcoinaddress>"},
|
||||
"getaccount": &handlerData{1, 0, displayGeneric, nil, makeGetAccount, "<address>"},
|
||||
"getaccountaddress": &handlerData{1, 0, displayGeneric, nil, makeGetAccountAddress, "<account>"},
|
||||
"getaddednodeinfo": &handlerData{1, 1, displayJSONDump, []conversionHandler{toBool, nil}, makeGetAddedNodeInfo, "<dns> [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, "<blockhash>"},
|
||||
"getblockcount": &handlerData{0, 0, displayGeneric, nil, makeGetBlockCount, ""},
|
||||
"getblockhash": &handlerData{1, 0, displayGeneric, []conversionHandler{toInt64}, makeGetBlockHash, "<blocknumber>"},
|
||||
"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, "<txhash> [verbose=0]"},
|
||||
"getreceivedbyaccount": &handlerData{1, 1, displayGeneric, []conversionHandler{nil, toInt}, makeGetReceivedByAccount, "<account> [minconf=1]"},
|
||||
"getreceivedbyaddress": &handlerData{1, 1, displayGeneric, []conversionHandler{nil, toInt}, makeGetReceivedByAddress, "<address> [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, "<wifprivkey> [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, "<ip> <add/remove/onetry>"},
|
||||
"createrawtransaction": {2, 0, displayGeneric, nil, makeCreateRawTransaction, "\"[{\"txid\":\"id\",\"vout\":n},...]\" \"{\"address\":amount,...}\""},
|
||||
"debuglevel": {1, 0, displayGeneric, nil, makeDebugLevel, "<levelspec>"},
|
||||
"decoderawtransaction": {1, 0, displayJSONDump, nil, makeDecodeRawTransaction, "<txhash>"},
|
||||
"decodescript": {1, 0, displayJSONDump, nil, makeDecodeScript, "<hex>"},
|
||||
"dumpprivkey": {1, 0, displayGeneric, nil, makeDumpPrivKey, "<bitcoinaddress>"},
|
||||
"getaccount": {1, 0, displayGeneric, nil, makeGetAccount, "<address>"},
|
||||
"getaccountaddress": {1, 0, displayGeneric, nil, makeGetAccountAddress, "<account>"},
|
||||
"getaddednodeinfo": {1, 1, displayJSONDump, []conversionHandler{toBool, nil}, makeGetAddedNodeInfo, "<dns> [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, "<blockhash>"},
|
||||
"getblockcount": {0, 0, displayGeneric, nil, makeGetBlockCount, ""},
|
||||
"getblockhash": {1, 0, displayGeneric, []conversionHandler{toInt64}, makeGetBlockHash, "<blocknumber>"},
|
||||
"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, "<txhash> [verbose=0]"},
|
||||
"getreceivedbyaccount": {1, 1, displayGeneric, []conversionHandler{nil, toInt}, makeGetReceivedByAccount, "<account> [minconf=1]"},
|
||||
"getreceivedbyaddress": {1, 1, displayGeneric, []conversionHandler{nil, toInt}, makeGetReceivedByAddress, "<address> [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, "<wifprivkey> [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, "<account> <address> <amount> [minconf=1] [comment] [comment-to]"},
|
||||
"sendmany": &handlerData{2, 2, displayGeneric, []conversionHandler{nil, nil, toInt, nil}, makeSendMany, "<account> <{\"address\":amount,...}> [minconf=1] [comment]"},
|
||||
"sendrawtransaction": &handlerData{1, 0, displayGeneric, nil, makeSendRawTransaction, "<hextx>"},
|
||||
"sendtoaddress": &handlerData{2, 2, displayGeneric, []conversionHandler{nil, toSatoshi, nil, nil}, makeSendToAddress, "<address> <amount> [comment] [comment-to]"},
|
||||
"settxfee": &handlerData{1, 0, displayGeneric, []conversionHandler{toSatoshi}, makeSetTxFee, "<amount>"},
|
||||
"stop": &handlerData{0, 0, displayGeneric, nil, makeStop, ""},
|
||||
"submitblock": &handlerData{1, 1, displayGeneric, nil, makeSubmitBlock, "<hexdata> [jsonparametersobject]"},
|
||||
"validateaddress": &handlerData{1, 0, displayJSONDump, nil, makeValidateAddress, "<address>"},
|
||||
"verifychain": &handlerData{0, 2, displayJSONDump, []conversionHandler{toInt, toInt}, makeVerifyChain, "[level] [numblocks]"},
|
||||
"verifymessage": &handlerData{3, 0, displayGeneric, nil, makeVerifyMessage, "<address> <signature> <message>"},
|
||||
"walletlock": &handlerData{0, 0, displayGeneric, nil, makeWalletLock, ""},
|
||||
"walletpassphrase": &handlerData{1, 1, displayGeneric, []conversionHandler{nil, toInt64}, makeWalletPassphrase, "<passphrase> [timeout]"},
|
||||
"walletpassphrasechange": &handlerData{2, 0, displayGeneric, nil, makeWalletPassphraseChange, "<oldpassphrase> <newpassphrase>"},
|
||||
"sendmany": {2, 2, displayGeneric, []conversionHandler{nil, nil, toInt, nil}, makeSendMany, "<account> <{\"address\":amount,...}> [minconf=1] [comment]"},
|
||||
"sendrawtransaction": {1, 0, displayGeneric, nil, makeSendRawTransaction, "<hextx>"},
|
||||
"sendtoaddress": {2, 2, displayGeneric, []conversionHandler{nil, toSatoshi, nil, nil}, makeSendToAddress, "<address> <amount> [comment] [comment-to]"},
|
||||
"settxfee": {1, 0, displayGeneric, []conversionHandler{toSatoshi}, makeSetTxFee, "<amount>"},
|
||||
"stop": {0, 0, displayGeneric, nil, makeStop, ""},
|
||||
"submitblock": {1, 1, displayGeneric, nil, makeSubmitBlock, "<hexdata> [jsonparametersobject]"},
|
||||
"validateaddress": {1, 0, displayJSONDump, nil, makeValidateAddress, "<address>"},
|
||||
"verifychain": {0, 2, displayJSONDump, []conversionHandler{toInt, toInt}, makeVerifyChain, "[level] [numblocks]"},
|
||||
"verifymessage": {3, 0, displayGeneric, nil, makeVerifyMessage, "<address> <signature> <message>"},
|
||||
"walletlock": {0, 0, displayGeneric, nil, makeWalletLock, ""},
|
||||
"walletpassphrase": {1, 1, displayGeneric, []conversionHandler{nil, toInt64}, makeWalletPassphrase, "<passphrase> [timeout]"},
|
||||
"walletpassphrasechange": {2, 0, displayGeneric, nil, makeWalletPassphraseChange, "<oldpassphrase> <newpassphrase>"},
|
||||
}
|
||||
|
||||
// toSatoshi attempts to convert the passed string to a satoshi amount returned
|
||||
|
|
Loading…
Reference in a new issue