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