github.com/palcoin-project/palcd@v1.0.0/rpcserverhelp.go (about)

     1  // Copyright (c) 2015-2017 The btcsuite developers
     2  // Copyright (c) 2015-2017 The Decred developers
     3  // Use of this source code is governed by an ISC
     4  // license that can be found in the LICENSE file.
     5  
     6  package main
     7  
     8  import (
     9  	"errors"
    10  	"sort"
    11  	"strings"
    12  	"sync"
    13  
    14  	"github.com/palcoin-project/palcd/btcjson"
    15  )
    16  
    17  // helpDescsEnUS defines the English descriptions used for the help strings.
    18  var helpDescsEnUS = map[string]string{
    19  	// DebugLevelCmd help.
    20  	"debuglevel--synopsis": "Dynamically changes the debug logging level.\n" +
    21  		"The levelspec can either a debug level or of the form:\n" +
    22  		"<subsystem>=<level>,<subsystem2>=<level2>,...\n" +
    23  		"The valid debug levels are trace, debug, info, warn, error, and critical.\n" +
    24  		"The valid subsystems are AMGR, ADXR, BCDB, BMGR, BTCD, CHAN, DISC, PEER, RPCS, SCRP, SRVR, and TXMP.\n" +
    25  		"Finally the keyword 'show' will return a list of the available subsystems.",
    26  	"debuglevel-levelspec":   "The debug level(s) to use or the keyword 'show'",
    27  	"debuglevel--condition0": "levelspec!=show",
    28  	"debuglevel--condition1": "levelspec=show",
    29  	"debuglevel--result0":    "The string 'Done.'",
    30  	"debuglevel--result1":    "The list of subsystems",
    31  
    32  	// AddNodeCmd help.
    33  	"addnode--synopsis": "Attempts to add or remove a persistent peer.",
    34  	"addnode-addr":      "IP address and port of the peer to operate on",
    35  	"addnode-subcmd":    "'add' to add a persistent peer, 'remove' to remove a persistent peer, or 'onetry' to try a single connection to a peer",
    36  
    37  	// NodeCmd help.
    38  	"node--synopsis":     "Attempts to add or remove a peer.",
    39  	"node-subcmd":        "'disconnect' to remove all matching non-persistent peers, 'remove' to remove a persistent peer, or 'connect' to connect to a peer",
    40  	"node-target":        "Either the IP address and port of the peer to operate on, or a valid peer ID.",
    41  	"node-connectsubcmd": "'perm' to make the connected peer a permanent one, 'temp' to try a single connect to a peer",
    42  
    43  	// TransactionInput help.
    44  	"transactioninput-txid": "The hash of the input transaction",
    45  	"transactioninput-vout": "The specific output of the input transaction to redeem",
    46  
    47  	// CreateRawTransactionCmd help.
    48  	"createrawtransaction--synopsis": "Returns a new transaction spending the provided inputs and sending to the provided addresses.\n" +
    49  		"The transaction inputs are not signed in the created transaction.\n" +
    50  		"The signrawtransaction RPC command provided by wallet must be used to sign the resulting transaction.",
    51  	"createrawtransaction-inputs":         "The inputs to the transaction",
    52  	"createrawtransaction-amounts":        "JSON object with the destination addresses as keys and amounts as values",
    53  	"createrawtransaction-amounts--key":   "address",
    54  	"createrawtransaction-amounts--value": "n.nnn",
    55  	"createrawtransaction-amounts--desc":  "The destination address as the key and the amount in PALC as the value",
    56  	"createrawtransaction-locktime":       "Locktime value; a non-zero value will also locktime-activate the inputs",
    57  	"createrawtransaction--result0":       "Hex-encoded bytes of the serialized transaction",
    58  
    59  	// ScriptSig help.
    60  	"scriptsig-asm": "Disassembly of the script",
    61  	"scriptsig-hex": "Hex-encoded bytes of the script",
    62  
    63  	// PrevOut help.
    64  	"prevout-addresses": "previous output addresses",
    65  	"prevout-value":     "previous output value",
    66  
    67  	// VinPrevOut help.
    68  	"vinprevout-coinbase":    "The hex-encoded bytes of the signature script (coinbase txns only)",
    69  	"vinprevout-txid":        "The hash of the origin transaction (non-coinbase txns only)",
    70  	"vinprevout-vout":        "The index of the output being redeemed from the origin transaction (non-coinbase txns only)",
    71  	"vinprevout-scriptSig":   "The signature script used to redeem the origin transaction as a JSON object (non-coinbase txns only)",
    72  	"vinprevout-txinwitness": "The witness stack of the passed input, encoded as a JSON string array",
    73  	"vinprevout-prevOut":     "Data from the origin transaction output with index vout.",
    74  	"vinprevout-sequence":    "The script sequence number",
    75  
    76  	// Vin help.
    77  	"vin-coinbase":    "The hex-encoded bytes of the signature script (coinbase txns only)",
    78  	"vin-txid":        "The hash of the origin transaction (non-coinbase txns only)",
    79  	"vin-vout":        "The index of the output being redeemed from the origin transaction (non-coinbase txns only)",
    80  	"vin-scriptSig":   "The signature script used to redeem the origin transaction as a JSON object (non-coinbase txns only)",
    81  	"vin-txinwitness": "The witness used to redeem the input encoded as a string array of its items",
    82  	"vin-sequence":    "The script sequence number",
    83  
    84  	// ScriptPubKeyResult help.
    85  	"scriptpubkeyresult-asm":       "Disassembly of the script",
    86  	"scriptpubkeyresult-hex":       "Hex-encoded bytes of the script",
    87  	"scriptpubkeyresult-reqSigs":   "The number of required signatures",
    88  	"scriptpubkeyresult-type":      "The type of the script (e.g. 'pubkeyhash')",
    89  	"scriptpubkeyresult-addresses": "The palcoin addresses associated with this script",
    90  
    91  	// Vout help.
    92  	"vout-value":        "The amount in PALC",
    93  	"vout-n":            "The index of this transaction output",
    94  	"vout-scriptPubKey": "The public key script used to pay coins as a JSON object",
    95  
    96  	// TxRawDecodeResult help.
    97  	"txrawdecoderesult-txid":     "The hash of the transaction",
    98  	"txrawdecoderesult-version":  "The transaction version",
    99  	"txrawdecoderesult-locktime": "The transaction lock time",
   100  	"txrawdecoderesult-vin":      "The transaction inputs as JSON objects",
   101  	"txrawdecoderesult-vout":     "The transaction outputs as JSON objects",
   102  
   103  	// DecodeRawTransactionCmd help.
   104  	"decoderawtransaction--synopsis": "Returns a JSON object representing the provided serialized, hex-encoded transaction.",
   105  	"decoderawtransaction-hextx":     "Serialized, hex-encoded transaction",
   106  
   107  	// DecodeScriptResult help.
   108  	"decodescriptresult-asm":       "Disassembly of the script",
   109  	"decodescriptresult-reqSigs":   "The number of required signatures",
   110  	"decodescriptresult-type":      "The type of the script (e.g. 'pubkeyhash')",
   111  	"decodescriptresult-addresses": "The palcoin addresses associated with this script",
   112  	"decodescriptresult-p2sh":      "The script hash for use in pay-to-script-hash transactions (only present if the provided redeem script is not already a pay-to-script-hash script)",
   113  
   114  	// DecodeScriptCmd help.
   115  	"decodescript--synopsis": "Returns a JSON object with information about the provided hex-encoded script.",
   116  	"decodescript-hexscript": "Hex-encoded script",
   117  
   118  	// EstimateFeeCmd help.
   119  	"estimatefee--synopsis": "Estimate the fee per kilobyte in satoshis " +
   120  		"required for a transaction to be mined before a certain number of " +
   121  		"blocks have been generated.",
   122  	"estimatefee-numblocks": "The maximum number of blocks which can be " +
   123  		"generated before the transaction is mined.",
   124  	"estimatefee--result0": "Estimated fee per kilobyte in satoshis for a block to " +
   125  		"be mined in the next NumBlocks blocks.",
   126  
   127  	// GenerateCmd help
   128  	"generate--synopsis": "Generates a set number of blocks (simnet or regtest only) and returns a JSON\n" +
   129  		" array of their hashes.",
   130  	"generate-numblocks": "Number of blocks to generate",
   131  	"generate--result0":  "The hashes, in order, of blocks generated by the call",
   132  
   133  	// GetAddedNodeInfoResultAddr help.
   134  	"getaddednodeinforesultaddr-address":   "The ip address for this DNS entry",
   135  	"getaddednodeinforesultaddr-connected": "The connection 'direction' (inbound/outbound/false)",
   136  
   137  	// GetAddedNodeInfoResult help.
   138  	"getaddednodeinforesult-addednode": "The ip address or domain of the added peer",
   139  	"getaddednodeinforesult-connected": "Whether or not the peer is currently connected",
   140  	"getaddednodeinforesult-addresses": "DNS lookup and connection information about the peer",
   141  
   142  	// GetAddedNodeInfo help.
   143  	"getaddednodeinfo--synopsis":   "Returns information about manually added (persistent) peers.",
   144  	"getaddednodeinfo-dns":         "Specifies whether the returned data is a JSON object including DNS and connection information, or just a list of added peers",
   145  	"getaddednodeinfo-node":        "Only return information about this specific peer instead of all added peers",
   146  	"getaddednodeinfo--condition0": "dns=false",
   147  	"getaddednodeinfo--condition1": "dns=true",
   148  	"getaddednodeinfo--result0":    "List of added peers",
   149  
   150  	// GetBestBlockResult help.
   151  	"getbestblockresult-hash":   "Hex-encoded bytes of the best block hash",
   152  	"getbestblockresult-height": "Height of the best block",
   153  
   154  	// GetBestBlockCmd help.
   155  	"getbestblock--synopsis": "Get block height and hash of best block in the main chain.",
   156  	"getbestblock--result0":  "Get block height and hash of best block in the main chain.",
   157  
   158  	// GetBestBlockHashCmd help.
   159  	"getbestblockhash--synopsis": "Returns the hash of the of the best (most recent) block in the longest block chain.",
   160  	"getbestblockhash--result0":  "The hex-encoded block hash",
   161  
   162  	// GetBlockCmd help.
   163  	"getblock--synopsis":   "Returns information about a block given its hash.",
   164  	"getblock-hash":        "The hash of the block",
   165  	"getblock-verbosity":   "Specifies whether the block data should be returned as a hex-encoded string (0), as parsed data with a slice of TXIDs (1), or as parsed data with parsed transaction data (2) ",
   166  	"getblock--condition0": "verbosity=0",
   167  	"getblock--condition1": "verbosity=1",
   168  	"getblock--result0":    "Hex-encoded bytes of the serialized block",
   169  
   170  	// GetBlockChainInfoCmd help.
   171  	"getblockchaininfo--synopsis": "Returns information about the current blockchain state and the status of any active soft-fork deployments.",
   172  
   173  	// GetBlockChainInfoResult help.
   174  	"getblockchaininforesult-chain":                "The name of the chain the daemon is on (testnet, mainnet, etc)",
   175  	"getblockchaininforesult-blocks":               "The number of blocks in the best known chain",
   176  	"getblockchaininforesult-headers":              "The number of headers that we've gathered for in the best known chain",
   177  	"getblockchaininforesult-bestblockhash":        "The block hash for the latest block in the main chain",
   178  	"getblockchaininforesult-difficulty":           "The current chain difficulty",
   179  	"getblockchaininforesult-mediantime":           "The median time from the PoV of the best block in the chain",
   180  	"getblockchaininforesult-verificationprogress": "An estimate for how much of the best chain we've verified",
   181  	"getblockchaininforesult-pruned":               "A bool that indicates if the node is pruned or not",
   182  	"getblockchaininforesult-pruneheight":          "The lowest block retained in the current pruned chain",
   183  	"getblockchaininforesult-chainwork":            "The total cumulative work in the best chain",
   184  	"getblockchaininforesult-size_on_disk":         "The estimated size of the block and undo files on disk",
   185  	"getblockchaininforesult-initialblockdownload": "Estimate of whether this node is in Initial Block Download mode",
   186  	"getblockchaininforesult-softforks":            "The status of the super-majority soft-forks",
   187  	"getblockchaininforesult-unifiedsoftforks":     "The status of the super-majority soft-forks used by bitcoind on or after v0.19.0",
   188  
   189  	// SoftForkDescription help.
   190  	"softforkdescription-reject":  "The current activation status of the softfork",
   191  	"softforkdescription-version": "The block version that signals enforcement of this softfork",
   192  	"softforkdescription-id":      "The string identifier for the soft fork",
   193  	"-status":                     "A bool which indicates if the soft fork is active",
   194  
   195  	// SoftForks help.
   196  	"softforks-softforks":             "The status of the super-majority soft-forks",
   197  	"softforks-bip9_softforks":        "JSON object describing active BIP0009 deployments",
   198  	"softforks-bip9_softforks--key":   "bip9_softforks",
   199  	"softforks-bip9_softforks--value": "An object describing a particular BIP009 deployment",
   200  	"softforks-bip9_softforks--desc":  "The status of any defined BIP0009 soft-fork deployments",
   201  
   202  	// UnifiedSoftForks help.
   203  	"unifiedsoftforks-softforks":        "The status of the super-majority soft-forks used by bitcoind on or after v0.19.0",
   204  	"unifiedsoftforks-softforks--key":   "softforks",
   205  	"unifiedsoftforks-softforks--value": "An object describing an active softfork deployment used by bitcoind on or after v0.19.0",
   206  	"unifiedsoftforks-softforks--desc":  "JSON object describing an active softfork deployment used by bitcoind on or after v0.19.0",
   207  
   208  	// TxRawResult help.
   209  	"txrawresult-hex":           "Hex-encoded transaction",
   210  	"txrawresult-txid":          "The hash of the transaction",
   211  	"txrawresult-version":       "The transaction version",
   212  	"txrawresult-locktime":      "The transaction lock time",
   213  	"txrawresult-vin":           "The transaction inputs as JSON objects",
   214  	"txrawresult-vout":          "The transaction outputs as JSON objects",
   215  	"txrawresult-blockhash":     "Hash of the block the transaction is part of",
   216  	"txrawresult-confirmations": "Number of confirmations of the block",
   217  	"txrawresult-time":          "Transaction time in seconds since 1 Jan 1970 GMT",
   218  	"txrawresult-blocktime":     "Block time in seconds since the 1 Jan 1970 GMT",
   219  	"txrawresult-size":          "The size of the transaction in bytes",
   220  	"txrawresult-vsize":         "The virtual size of the transaction in bytes",
   221  	"txrawresult-weight":        "The transaction's weight (between vsize*4-3 and vsize*4)",
   222  	"txrawresult-hash":          "The wtxid of the transaction",
   223  
   224  	// SearchRawTransactionsResult help.
   225  	"searchrawtransactionsresult-hex":           "Hex-encoded transaction",
   226  	"searchrawtransactionsresult-txid":          "The hash of the transaction",
   227  	"searchrawtransactionsresult-hash":          "The wxtid of the transaction",
   228  	"searchrawtransactionsresult-version":       "The transaction version",
   229  	"searchrawtransactionsresult-locktime":      "The transaction lock time",
   230  	"searchrawtransactionsresult-vin":           "The transaction inputs as JSON objects",
   231  	"searchrawtransactionsresult-vout":          "The transaction outputs as JSON objects",
   232  	"searchrawtransactionsresult-blockhash":     "Hash of the block the transaction is part of",
   233  	"searchrawtransactionsresult-confirmations": "Number of confirmations of the block",
   234  	"searchrawtransactionsresult-time":          "Transaction time in seconds since 1 Jan 1970 GMT",
   235  	"searchrawtransactionsresult-blocktime":     "Block time in seconds since the 1 Jan 1970 GMT",
   236  	"searchrawtransactionsresult-size":          "The size of the transaction in bytes",
   237  	"searchrawtransactionsresult-vsize":         "The virtual size of the transaction in bytes",
   238  	"searchrawtransactionsresult-weight":        "The transaction's weight (between vsize*4-3 and vsize*4)",
   239  
   240  	// GetBlockVerboseResult help.
   241  	"getblockverboseresult-hash":              "The hash of the block (same as provided)",
   242  	"getblockverboseresult-confirmations":     "The number of confirmations",
   243  	"getblockverboseresult-size":              "The size of the block",
   244  	"getblockverboseresult-height":            "The height of the block in the block chain",
   245  	"getblockverboseresult-version":           "The block version",
   246  	"getblockverboseresult-versionHex":        "The block version in hexadecimal",
   247  	"getblockverboseresult-merkleroot":        "Root hash of the merkle tree",
   248  	"getblockverboseresult-tx":                "The transaction hashes (only when verbosity=1)",
   249  	"getblockverboseresult-rawtx":             "The transactions as JSON objects (only when verbosity=2)",
   250  	"getblockverboseresult-time":              "The block time in seconds since 1 Jan 1970 GMT",
   251  	"getblockverboseresult-nonce":             "The block nonce",
   252  	"getblockverboseresult-bits":              "The bits which represent the block difficulty",
   253  	"getblockverboseresult-difficulty":        "The proof-of-work difficulty as a multiple of the minimum difficulty",
   254  	"getblockverboseresult-previousblockhash": "The hash of the previous block",
   255  	"getblockverboseresult-nextblockhash":     "The hash of the next block (only if there is one)",
   256  	"getblockverboseresult-strippedsize":      "The size of the block without witness data",
   257  	"getblockverboseresult-weight":            "The weight of the block",
   258  
   259  	// GetBlockCountCmd help.
   260  	"getblockcount--synopsis": "Returns the number of blocks in the longest block chain.",
   261  	"getblockcount--result0":  "The current block count",
   262  
   263  	// GetBlockHashCmd help.
   264  	"getblockhash--synopsis": "Returns hash of the block in best block chain at the given height.",
   265  	"getblockhash-index":     "The block height",
   266  	"getblockhash--result0":  "The block hash",
   267  
   268  	// GetBlockHeaderCmd help.
   269  	"getblockheader--synopsis":   "Returns information about a block header given its hash.",
   270  	"getblockheader-hash":        "The hash of the block",
   271  	"getblockheader-verbose":     "Specifies the block header is returned as a JSON object instead of hex-encoded string",
   272  	"getblockheader--condition0": "verbose=false",
   273  	"getblockheader--condition1": "verbose=true",
   274  	"getblockheader--result0":    "The block header hash",
   275  
   276  	// GetBlockHeaderVerboseResult help.
   277  	"getblockheaderverboseresult-hash":              "The hash of the block (same as provided)",
   278  	"getblockheaderverboseresult-confirmations":     "The number of confirmations",
   279  	"getblockheaderverboseresult-height":            "The height of the block in the block chain",
   280  	"getblockheaderverboseresult-version":           "The block version",
   281  	"getblockheaderverboseresult-versionHex":        "The block version in hexadecimal",
   282  	"getblockheaderverboseresult-merkleroot":        "Root hash of the merkle tree",
   283  	"getblockheaderverboseresult-time":              "The block time in seconds since 1 Jan 1970 GMT",
   284  	"getblockheaderverboseresult-nonce":             "The block nonce",
   285  	"getblockheaderverboseresult-bits":              "The bits which represent the block difficulty",
   286  	"getblockheaderverboseresult-difficulty":        "The proof-of-work difficulty as a multiple of the minimum difficulty",
   287  	"getblockheaderverboseresult-previousblockhash": "The hash of the previous block",
   288  	"getblockheaderverboseresult-nextblockhash":     "The hash of the next block (only if there is one)",
   289  
   290  	// TemplateRequest help.
   291  	"templaterequest-mode":         "This is 'template', 'proposal', or omitted",
   292  	"templaterequest-capabilities": "List of capabilities",
   293  	"templaterequest-longpollid":   "The long poll ID of a job to monitor for expiration; required and valid only for long poll requests ",
   294  	"templaterequest-sigoplimit":   "Number of signature operations allowed in blocks (this parameter is ignored)",
   295  	"templaterequest-sizelimit":    "Number of bytes allowed in blocks (this parameter is ignored)",
   296  	"templaterequest-maxversion":   "Highest supported block version number (this parameter is ignored)",
   297  	"templaterequest-target":       "The desired target for the block template (this parameter is ignored)",
   298  	"templaterequest-data":         "Hex-encoded block data (only for mode=proposal)",
   299  	"templaterequest-workid":       "The server provided workid if provided in block template (not applicable)",
   300  	"templaterequest-rules":        "Specific block rules that are to be enforced e.g. '[\"segwit\"]",
   301  
   302  	// GetBlockTemplateResultTx help.
   303  	"getblocktemplateresulttx-data":    "Hex-encoded transaction data (byte-for-byte)",
   304  	"getblocktemplateresulttx-hash":    "Hex-encoded transaction hash (little endian if treated as a 256-bit number)",
   305  	"getblocktemplateresulttx-depends": "Other transactions before this one (by 1-based index in the 'transactions'  list) that must be present in the final block if this one is",
   306  	"getblocktemplateresulttx-fee":     "Difference in value between transaction inputs and outputs (in Satoshi)",
   307  	"getblocktemplateresulttx-sigops":  "Total number of signature operations as counted for purposes of block limits",
   308  	"getblocktemplateresulttx-txid":    "The transaction id, can be different from hash.",
   309  	"getblocktemplateresulttx-weight":  "The weight of the transaction",
   310  
   311  	// GetBlockTemplateResultAux help.
   312  	"getblocktemplateresultaux-flags": "Hex-encoded byte-for-byte data to include in the coinbase signature script",
   313  
   314  	// GetBlockTemplateResult help.
   315  	"getblocktemplateresult-bits":                       "Hex-encoded compressed difficulty",
   316  	"getblocktemplateresult-curtime":                    "Current time as seen by the server (recommended for block time); must fall within mintime/maxtime rules",
   317  	"getblocktemplateresult-height":                     "Height of the block to be solved",
   318  	"getblocktemplateresult-previousblockhash":          "Hex-encoded big-endian hash of the previous block",
   319  	"getblocktemplateresult-sigoplimit":                 "Number of sigops allowed in blocks ",
   320  	"getblocktemplateresult-sizelimit":                  "Number of bytes allowed in blocks",
   321  	"getblocktemplateresult-transactions":               "Array of transactions as JSON objects",
   322  	"getblocktemplateresult-version":                    "The block version",
   323  	"getblocktemplateresult-coinbaseaux":                "Data that should be included in the coinbase signature script",
   324  	"getblocktemplateresult-coinbasetxn":                "Information about the coinbase transaction",
   325  	"getblocktemplateresult-coinbasevalue":              "Total amount available for the coinbase in Satoshi",
   326  	"getblocktemplateresult-workid":                     "This value must be returned with result if provided (not provided)",
   327  	"getblocktemplateresult-longpollid":                 "Identifier for long poll request which allows monitoring for expiration",
   328  	"getblocktemplateresult-longpolluri":                "An alternate URI to use for long poll requests if provided (not provided)",
   329  	"getblocktemplateresult-submitold":                  "Not applicable",
   330  	"getblocktemplateresult-target":                     "Hex-encoded big-endian number which valid results must be less than",
   331  	"getblocktemplateresult-expires":                    "Maximum number of seconds (starting from when the server sent the response) this work is valid for",
   332  	"getblocktemplateresult-maxtime":                    "Maximum allowed time",
   333  	"getblocktemplateresult-mintime":                    "Minimum allowed time",
   334  	"getblocktemplateresult-mutable":                    "List of mutations the server explicitly allows",
   335  	"getblocktemplateresult-noncerange":                 "Two concatenated hex-encoded big-endian 32-bit integers which represent the valid ranges of nonces the miner may scan",
   336  	"getblocktemplateresult-capabilities":               "List of server capabilities including 'proposal' to indicate support for block proposals",
   337  	"getblocktemplateresult-reject-reason":              "Reason the proposal was invalid as-is (only applies to proposal responses)",
   338  	"getblocktemplateresult-default_witness_commitment": "The witness commitment itself. Will be populated if the block has witness data",
   339  	"getblocktemplateresult-weightlimit":                "The current limit on the max allowed weight of a block",
   340  
   341  	// GetBlockTemplateCmd help.
   342  	"getblocktemplate--synopsis": "Returns a JSON object with information necessary to construct a block to mine or accepts a proposal to validate.\n" +
   343  		"See BIP0022 and BIP0023 for the full specification.",
   344  	"getblocktemplate-request":     "Request object which controls the mode and several parameters",
   345  	"getblocktemplate--condition0": "mode=template",
   346  	"getblocktemplate--condition1": "mode=proposal, rejected",
   347  	"getblocktemplate--condition2": "mode=proposal, accepted",
   348  	"getblocktemplate--result1":    "An error string which represents why the proposal was rejected or nothing if accepted",
   349  
   350  	// GetCFilterCmd help.
   351  	"getcfilter--synopsis":  "Returns a block's committed filter given its hash.",
   352  	"getcfilter-filtertype": "The type of filter to return (0=regular)",
   353  	"getcfilter-hash":       "The hash of the block",
   354  	"getcfilter--result0":   "The block's committed filter",
   355  
   356  	// GetCFilterHeaderCmd help.
   357  	"getcfilterheader--synopsis":  "Returns a block's compact filter header given its hash.",
   358  	"getcfilterheader-filtertype": "The type of filter header to return (0=regular)",
   359  	"getcfilterheader-hash":       "The hash of the block",
   360  	"getcfilterheader--result0":   "The block's gcs filter header",
   361  
   362  	// GetConnectionCountCmd help.
   363  	"getconnectioncount--synopsis": "Returns the number of active connections to other peers.",
   364  	"getconnectioncount--result0":  "The number of connections",
   365  
   366  	// GetCurrentNetCmd help.
   367  	"getcurrentnet--synopsis": "Get palcoin network the server is running on.",
   368  	"getcurrentnet--result0":  "The network identifer",
   369  
   370  	// GetDifficultyCmd help.
   371  	"getdifficulty--synopsis": "Returns the proof-of-work difficulty as a multiple of the minimum difficulty.",
   372  	"getdifficulty--result0":  "The difficulty",
   373  
   374  	// GetGenerateCmd help.
   375  	"getgenerate--synopsis": "Returns if the server is set to generate coins (mine) or not.",
   376  	"getgenerate--result0":  "True if mining, false if not",
   377  
   378  	// GetHashesPerSecCmd help.
   379  	"gethashespersec--synopsis": "Returns a recent hashes per second performance measurement while generating coins (mining).",
   380  	"gethashespersec--result0":  "The number of hashes per second",
   381  
   382  	// InfoChainResult help.
   383  	"infochainresult-version":         "The version of the server",
   384  	"infochainresult-protocolversion": "The latest supported protocol version",
   385  	"infochainresult-blocks":          "The number of blocks processed",
   386  	"infochainresult-timeoffset":      "The time offset",
   387  	"infochainresult-connections":     "The number of connected peers",
   388  	"infochainresult-proxy":           "The proxy used by the server",
   389  	"infochainresult-difficulty":      "The current target difficulty",
   390  	"infochainresult-testnet":         "Whether or not server is using testnet",
   391  	"infochainresult-relayfee":        "The minimum relay fee for non-free transactions in PALC/KB",
   392  	"infochainresult-errors":          "Any current errors",
   393  
   394  	// InfoWalletResult help.
   395  	"infowalletresult-version":         "The version of the server",
   396  	"infowalletresult-protocolversion": "The latest supported protocol version",
   397  	"infowalletresult-walletversion":   "The version of the wallet server",
   398  	"infowalletresult-balance":         "The total palcoin balance of the wallet",
   399  	"infowalletresult-blocks":          "The number of blocks processed",
   400  	"infowalletresult-timeoffset":      "The time offset",
   401  	"infowalletresult-connections":     "The number of connected peers",
   402  	"infowalletresult-proxy":           "The proxy used by the server",
   403  	"infowalletresult-difficulty":      "The current target difficulty",
   404  	"infowalletresult-testnet":         "Whether or not server is using testnet",
   405  	"infowalletresult-keypoololdest":   "Seconds since 1 Jan 1970 GMT of the oldest pre-generated key in the key pool",
   406  	"infowalletresult-keypoolsize":     "The number of new keys that are pre-generated",
   407  	"infowalletresult-unlocked_until":  "The timestamp in seconds since 1 Jan 1970 GMT that the wallet is unlocked for transfers, or 0 if the wallet is locked",
   408  	"infowalletresult-paytxfee":        "The transaction fee set in PALC/KB",
   409  	"infowalletresult-relayfee":        "The minimum relay fee for non-free transactions in PALC/KB",
   410  	"infowalletresult-errors":          "Any current errors",
   411  
   412  	// GetHeadersCmd help.
   413  	"getheaders--synopsis":     "Returns block headers starting with the first known block hash from the request",
   414  	"getheaders-blocklocators": "JSON array of hex-encoded hashes of blocks.  Headers are returned starting from the first known hash in this list",
   415  	"getheaders-hashstop":      "Block hash to stop including block headers for; if not found, all headers to the latest known block are returned.",
   416  	"getheaders--result0":      "Serialized block headers of all located blocks, limited to some arbitrary maximum number of hashes (currently 2000, which matches the wire protocol headers message, but this is not guaranteed)",
   417  
   418  	// GetInfoCmd help.
   419  	"getinfo--synopsis": "Returns a JSON object containing various state info.",
   420  
   421  	// GetMempoolInfoCmd help.
   422  	"getmempoolinfo--synopsis": "Returns memory pool information",
   423  
   424  	// GetMempoolInfoResult help.
   425  	"getmempoolinforesult-bytes": "Size in bytes of the mempool",
   426  	"getmempoolinforesult-size":  "Number of transactions in the mempool",
   427  
   428  	// GetMiningInfoResult help.
   429  	"getmininginforesult-blocks":             "Height of the latest best block",
   430  	"getmininginforesult-currentblocksize":   "Size of the latest best block",
   431  	"getmininginforesult-currentblockweight": "Weight of the latest best block",
   432  	"getmininginforesult-currentblocktx":     "Number of transactions in the latest best block",
   433  	"getmininginforesult-difficulty":         "Current target difficulty",
   434  	"getmininginforesult-errors":             "Any current errors",
   435  	"getmininginforesult-generate":           "Whether or not server is set to generate coins",
   436  	"getmininginforesult-genproclimit":       "Number of processors to use for coin generation (-1 when disabled)",
   437  	"getmininginforesult-hashespersec":       "Recent hashes per second performance measurement while generating coins",
   438  	"getmininginforesult-networkhashps":      "Estimated network hashes per second for the most recent blocks",
   439  	"getmininginforesult-pooledtx":           "Number of transactions in the memory pool",
   440  	"getmininginforesult-testnet":            "Whether or not server is using testnet",
   441  
   442  	// GetMiningInfoCmd help.
   443  	"getmininginfo--synopsis": "Returns a JSON object containing mining-related information.",
   444  
   445  	// GetNetworkHashPSCmd help.
   446  	"getnetworkhashps--synopsis": "Returns the estimated network hashes per second for the block heights provided by the parameters.",
   447  	"getnetworkhashps-blocks":    "The number of blocks, or -1 for blocks since last difficulty change",
   448  	"getnetworkhashps-height":    "Perform estimate ending with this height or -1 for current best chain block height",
   449  	"getnetworkhashps--result0":  "Estimated hashes per second",
   450  
   451  	// GetNetTotalsCmd help.
   452  	"getnettotals--synopsis": "Returns a JSON object containing network traffic statistics.",
   453  
   454  	// GetNetTotalsResult help.
   455  	"getnettotalsresult-totalbytesrecv": "Total bytes received",
   456  	"getnettotalsresult-totalbytessent": "Total bytes sent",
   457  	"getnettotalsresult-timemillis":     "Number of milliseconds since 1 Jan 1970 GMT",
   458  
   459  	// GetNodeAddressesResult help.
   460  	"getnodeaddressesresult-time":     "Timestamp in seconds since epoch (Jan 1 1970 GMT) keeping track of when the node was last seen",
   461  	"getnodeaddressesresult-services": "The services offered",
   462  	"getnodeaddressesresult-address":  "The address of the node",
   463  	"getnodeaddressesresult-port":     "The port of the node",
   464  
   465  	// GetNodeAddressesCmd help.
   466  	"getnodeaddresses--synopsis": "Return known addresses which can potentially be used to find new nodes in the network",
   467  	"getnodeaddresses-count":     "How many addresses to return. Limited to the smaller of 2500 or 23% of all known addresses",
   468  	"getnodeaddresses--result0":  "List of node addresses",
   469  
   470  	// GetPeerInfoResult help.
   471  	"getpeerinforesult-id":             "A unique node ID",
   472  	"getpeerinforesult-addr":           "The ip address and port of the peer",
   473  	"getpeerinforesult-addrlocal":      "Local address",
   474  	"getpeerinforesult-services":       "Services bitmask which represents the services supported by the peer",
   475  	"getpeerinforesult-relaytxes":      "Peer has requested transactions be relayed to it",
   476  	"getpeerinforesult-lastsend":       "Time the last message was received in seconds since 1 Jan 1970 GMT",
   477  	"getpeerinforesult-lastrecv":       "Time the last message was sent in seconds since 1 Jan 1970 GMT",
   478  	"getpeerinforesult-bytessent":      "Total bytes sent",
   479  	"getpeerinforesult-bytesrecv":      "Total bytes received",
   480  	"getpeerinforesult-conntime":       "Time the connection was made in seconds since 1 Jan 1970 GMT",
   481  	"getpeerinforesult-timeoffset":     "The time offset of the peer",
   482  	"getpeerinforesult-pingtime":       "Number of microseconds the last ping took",
   483  	"getpeerinforesult-pingwait":       "Number of microseconds a queued ping has been waiting for a response",
   484  	"getpeerinforesult-version":        "The protocol version of the peer",
   485  	"getpeerinforesult-subver":         "The user agent of the peer",
   486  	"getpeerinforesult-inbound":        "Whether or not the peer is an inbound connection",
   487  	"getpeerinforesult-startingheight": "The latest block height the peer knew about when the connection was established",
   488  	"getpeerinforesult-currentheight":  "The current height of the peer",
   489  	"getpeerinforesult-banscore":       "The ban score",
   490  	"getpeerinforesult-feefilter":      "The requested minimum fee a transaction must have to be announced to the peer",
   491  	"getpeerinforesult-syncnode":       "Whether or not the peer is the sync peer",
   492  
   493  	// GetPeerInfoCmd help.
   494  	"getpeerinfo--synopsis": "Returns data about each connected network peer as an array of json objects.",
   495  
   496  	// GetRawMempoolVerboseResult help.
   497  	"getrawmempoolverboseresult-size":             "Transaction size in bytes",
   498  	"getrawmempoolverboseresult-fee":              "Transaction fee in palcoin",
   499  	"getrawmempoolverboseresult-time":             "Local time transaction entered pool in seconds since 1 Jan 1970 GMT",
   500  	"getrawmempoolverboseresult-height":           "Block height when transaction entered the pool",
   501  	"getrawmempoolverboseresult-startingpriority": "Priority when transaction entered the pool",
   502  	"getrawmempoolverboseresult-currentpriority":  "Current priority",
   503  	"getrawmempoolverboseresult-depends":          "Unconfirmed transactions used as inputs for this transaction",
   504  	"getrawmempoolverboseresult-vsize":            "The virtual size of a transaction",
   505  	"getrawmempoolverboseresult-weight":           "The transaction's weight (between vsize*4-3 and vsize*4)",
   506  
   507  	// GetRawMempoolCmd help.
   508  	"getrawmempool--synopsis":   "Returns information about all of the transactions currently in the memory pool.",
   509  	"getrawmempool-verbose":     "Returns JSON object when true or an array of transaction hashes when false",
   510  	"getrawmempool--condition0": "verbose=false",
   511  	"getrawmempool--condition1": "verbose=true",
   512  	"getrawmempool--result0":    "Array of transaction hashes",
   513  
   514  	// GetRawTransactionCmd help.
   515  	"getrawtransaction--synopsis":   "Returns information about a transaction given its hash.",
   516  	"getrawtransaction-txid":        "The hash of the transaction",
   517  	"getrawtransaction-verbose":     "Specifies the transaction is returned as a JSON object instead of a hex-encoded string",
   518  	"getrawtransaction--condition0": "verbose=false",
   519  	"getrawtransaction--condition1": "verbose=true",
   520  	"getrawtransaction--result0":    "Hex-encoded bytes of the serialized transaction",
   521  
   522  	// GetTxOutResult help.
   523  	"gettxoutresult-bestblock":     "The block hash that contains the transaction output",
   524  	"gettxoutresult-confirmations": "The number of confirmations",
   525  	"gettxoutresult-value":         "The transaction amount in PALC",
   526  	"gettxoutresult-scriptPubKey":  "The public key script used to pay coins as a JSON object",
   527  	"gettxoutresult-version":       "The transaction version",
   528  	"gettxoutresult-coinbase":      "Whether or not the transaction is a coinbase",
   529  
   530  	// GetTxOutCmd help.
   531  	"gettxout--synopsis":      "Returns information about an unspent transaction output.",
   532  	"gettxout-txid":           "The hash of the transaction",
   533  	"gettxout-vout":           "The index of the output",
   534  	"gettxout-includemempool": "Include the mempool when true",
   535  
   536  	// HelpCmd help.
   537  	"help--synopsis":   "Returns a list of all commands or help for a specified command.",
   538  	"help-command":     "The command to retrieve help for",
   539  	"help--condition0": "no command provided",
   540  	"help--condition1": "command specified",
   541  	"help--result0":    "List of commands",
   542  	"help--result1":    "Help for specified command",
   543  
   544  	// PingCmd help.
   545  	"ping--synopsis": "Queues a ping to be sent to each connected peer.\n" +
   546  		"Ping times are provided by getpeerinfo via the pingtime and pingwait fields.",
   547  
   548  	// SearchRawTransactionsCmd help.
   549  	"searchrawtransactions--synopsis": "Returns raw data for transactions involving the passed address.\n" +
   550  		"Returned transactions are pulled from both the database, and transactions currently in the mempool.\n" +
   551  		"Transactions pulled from the mempool will have the 'confirmations' field set to 0.\n" +
   552  		"Usage of this RPC requires the optional --addrindex flag to be activated, otherwise all responses will simply return with an error stating the address index has not yet been built.\n" +
   553  		"Similarly, until the address index has caught up with the current best height, all requests will return an error response in order to avoid serving stale data.",
   554  	"searchrawtransactions-address":     "The Palcoin address to search for",
   555  	"searchrawtransactions-verbose":     "Specifies the transaction is returned as a JSON object instead of hex-encoded string",
   556  	"searchrawtransactions--condition0": "verbose=0",
   557  	"searchrawtransactions--condition1": "verbose=1",
   558  	"searchrawtransactions-skip":        "The number of leading transactions to leave out of the final response",
   559  	"searchrawtransactions-count":       "The maximum number of transactions to return",
   560  	"searchrawtransactions-vinextra":    "Specify that extra data from previous output will be returned in vin",
   561  	"searchrawtransactions-reverse":     "Specifies that the transactions should be returned in reverse chronological order",
   562  	"searchrawtransactions-filteraddrs": "Address list.  Only inputs or outputs with matching address will be returned",
   563  	"searchrawtransactions--result0":    "Hex-encoded serialized transaction",
   564  
   565  	// SendRawTransactionCmd help.
   566  	"sendrawtransaction--synopsis":    "Submits the serialized, hex-encoded transaction to the local peer and relays it to the network.",
   567  	"sendrawtransaction-hextx":        "Serialized, hex-encoded signed transaction",
   568  	"sendrawtransaction-feesetting":   "Whether or not to allow insanely high fees in bitcoind < v0.19.0 or the max fee rate for bitcoind v0.19.0 and later (palcd does not yet implement this parameter, so it has no effect)",
   569  	"sendrawtransaction--result0":     "The hash of the transaction",
   570  	"allowhighfeesormaxfeerate-value": "Either the boolean value for the allowhighfees parameter in bitcoind < v0.19.0 or the numerical value for the maxfeerate field in bitcoind v0.19.0 and later",
   571  
   572  	// SetGenerateCmd help.
   573  	"setgenerate--synopsis":    "Set the server to generate coins (mine) or not.",
   574  	"setgenerate-generate":     "Use true to enable generation, false to disable it",
   575  	"setgenerate-genproclimit": "The number of processors (cores) to limit generation to or -1 for default",
   576  
   577  	// SignMessageWithPrivKeyCmd help.
   578  	"signmessagewithprivkey--synopsis": "Sign a message with the private key of an address",
   579  	"signmessagewithprivkey-privkey":   "The private key to sign the message with",
   580  	"signmessagewithprivkey-message":   "The message to create a signature of",
   581  	"signmessagewithprivkey--result0":  "The signature of the message encoded in base 64",
   582  
   583  	// StopCmd help.
   584  	"stop--synopsis": "Shutdown palcd.",
   585  	"stop--result0":  "The string 'palcd stopping.'",
   586  
   587  	// SubmitBlockOptions help.
   588  	"submitblockoptions-workid": "This parameter is currently ignored",
   589  
   590  	// SubmitBlockCmd help.
   591  	"submitblock--synopsis":   "Attempts to submit a new serialized, hex-encoded block to the network.",
   592  	"submitblock-hexblock":    "Serialized, hex-encoded block",
   593  	"submitblock-options":     "This parameter is currently ignored",
   594  	"submitblock--condition0": "Block successfully submitted",
   595  	"submitblock--condition1": "Block rejected",
   596  	"submitblock--result1":    "The reason the block was rejected",
   597  
   598  	// ValidateAddressResult help.
   599  	"validateaddresschainresult-isvalid":         "Whether or not the address is valid",
   600  	"validateaddresschainresult-address":         "The palcoin address (only when isvalid is true)",
   601  	"validateaddresschainresult-isscript":        "If the key is a script",
   602  	"validateaddresschainresult-iswitness":       "If the address is a witness address",
   603  	"validateaddresschainresult-witness_version": "The version number of the witness program",
   604  	"validateaddresschainresult-witness_program": "The hex value of the witness program",
   605  
   606  	// ValidateAddressCmd help.
   607  	"validateaddress--synopsis": "Verify an address is valid.",
   608  	"validateaddress-address":   "Palcoin address to validate",
   609  
   610  	// VerifyChainCmd help.
   611  	"verifychain--synopsis": "Verifies the block chain database.\n" +
   612  		"The actual checks performed by the checklevel parameter are implementation specific.\n" +
   613  		"For palcd this is:\n" +
   614  		"checklevel=0 - Look up each block and ensure it can be loaded from the database.\n" +
   615  		"checklevel=1 - Perform basic context-free sanity checks on each block.",
   616  	"verifychain-checklevel": "How thorough the block verification is",
   617  	"verifychain-checkdepth": "The number of blocks to check",
   618  	"verifychain--result0":   "Whether or not the chain verified",
   619  
   620  	// VerifyMessageCmd help.
   621  	"verifymessage--synopsis": "Verify a signed message.",
   622  	"verifymessage-address":   "The palcoin address to use for the signature",
   623  	"verifymessage-signature": "The base-64 encoded signature provided by the signer",
   624  	"verifymessage-message":   "The signed message",
   625  	"verifymessage--result0":  "Whether or not the signature verified",
   626  
   627  	// -------- Websocket-specific help --------
   628  
   629  	// Session help.
   630  	"session--synopsis":       "Return details regarding a websocket client's current connection session.",
   631  	"sessionresult-sessionid": "The unique session ID for a client's websocket connection.",
   632  
   633  	// NotifyBlocksCmd help.
   634  	"notifyblocks--synopsis": "Request notifications for whenever a block is connected or disconnected from the main (best) chain.",
   635  
   636  	// StopNotifyBlocksCmd help.
   637  	"stopnotifyblocks--synopsis": "Cancel registered notifications for whenever a block is connected or disconnected from the main (best) chain.",
   638  
   639  	// NotifyNewTransactionsCmd help.
   640  	"notifynewtransactions--synopsis": "Send either a txaccepted or a txacceptedverbose notification when a new transaction is accepted into the mempool.",
   641  	"notifynewtransactions-verbose":   "Specifies which type of notification to receive. If verbose is true, then the caller receives txacceptedverbose, otherwise the caller receives txaccepted",
   642  
   643  	// StopNotifyNewTransactionsCmd help.
   644  	"stopnotifynewtransactions--synopsis": "Stop sending either a txaccepted or a txacceptedverbose notification when a new transaction is accepted into the mempool.",
   645  
   646  	// NotifyReceivedCmd help.
   647  	"notifyreceived--synopsis": "Send a recvtx notification when a transaction added to mempool or appears in a newly-attached block contains a txout pkScript sending to any of the passed addresses.\n" +
   648  		"Matching outpoints are automatically registered for redeemingtx notifications.",
   649  	"notifyreceived-addresses": "List of address to receive notifications about",
   650  
   651  	// StopNotifyReceivedCmd help.
   652  	"stopnotifyreceived--synopsis": "Cancel registered receive notifications for each passed address.",
   653  	"stopnotifyreceived-addresses": "List of address to cancel receive notifications for",
   654  
   655  	// OutPoint help.
   656  	"outpoint-hash":  "The hex-encoded bytes of the outpoint hash",
   657  	"outpoint-index": "The index of the outpoint",
   658  
   659  	// NotifySpentCmd help.
   660  	"notifyspent--synopsis": "Send a redeemingtx notification when a transaction spending an outpoint appears in mempool (if relayed to this palcd instance) and when such a transaction first appears in a newly-attached block.",
   661  	"notifyspent-outpoints": "List of transaction outpoints to monitor.",
   662  
   663  	// StopNotifySpentCmd help.
   664  	"stopnotifyspent--synopsis": "Cancel registered spending notifications for each passed outpoint.",
   665  	"stopnotifyspent-outpoints": "List of transaction outpoints to stop monitoring.",
   666  
   667  	// LoadTxFilterCmd help.
   668  	"loadtxfilter--synopsis": "Load, add to, or reload a websocket client's transaction filter for mempool transactions, new blocks and rescanblocks.",
   669  	"loadtxfilter-reload":    "Load a new filter instead of adding data to an existing one",
   670  	"loadtxfilter-addresses": "Array of addresses to add to the transaction filter",
   671  	"loadtxfilter-outpoints": "Array of outpoints to add to the transaction filter",
   672  
   673  	// Rescan help.
   674  	"rescan--synopsis": "Rescan block chain for transactions to addresses.\n" +
   675  		"When the endblock parameter is omitted, the rescan continues through the best block in the main chain.\n" +
   676  		"Rescan results are sent as recvtx and redeemingtx notifications.\n" +
   677  		"This call returns once the rescan completes.",
   678  	"rescan-beginblock": "Hash of the first block to begin rescanning",
   679  	"rescan-addresses":  "List of addresses to include in the rescan",
   680  	"rescan-outpoints":  "List of transaction outpoints to include in the rescan",
   681  	"rescan-endblock":   "Hash of final block to rescan",
   682  
   683  	// RescanBlocks help.
   684  	"rescanblocks--synopsis":   "Rescan blocks for transactions matching the loaded transaction filter.",
   685  	"rescanblocks-blockhashes": "List of hashes to rescan.  Each next block must be a child of the previous.",
   686  	"rescanblocks--result0":    "List of matching blocks.",
   687  
   688  	// RescannedBlock help.
   689  	"rescannedblock-hash":         "Hash of the matching block.",
   690  	"rescannedblock-transactions": "List of matching transactions, serialized and hex-encoded.",
   691  
   692  	// Uptime help.
   693  	"uptime--synopsis": "Returns the total uptime of the server.",
   694  	"uptime--result0":  "The number of seconds that the server has been running",
   695  
   696  	// Version help.
   697  	"version--synopsis":       "Returns the JSON-RPC API version (semver)",
   698  	"version--result0--desc":  "Version objects keyed by the program or API name",
   699  	"version--result0--key":   "Program or API name",
   700  	"version--result0--value": "Object containing the semantic version",
   701  
   702  	// VersionResult help.
   703  	"versionresult-versionstring": "The JSON-RPC API version (semver)",
   704  	"versionresult-major":         "The major component of the JSON-RPC API version",
   705  	"versionresult-minor":         "The minor component of the JSON-RPC API version",
   706  	"versionresult-patch":         "The patch component of the JSON-RPC API version",
   707  	"versionresult-prerelease":    "Prerelease info about the current build",
   708  	"versionresult-buildmetadata": "Metadata about the current build",
   709  }
   710  
   711  // rpcResultTypes specifies the result types that each RPC command can return.
   712  // This information is used to generate the help.  Each result type must be a
   713  // pointer to the type (or nil to indicate no return value).
   714  var rpcResultTypes = map[string][]interface{}{
   715  	"addnode":                nil,
   716  	"createrawtransaction":   {(*string)(nil)},
   717  	"debuglevel":             {(*string)(nil), (*string)(nil)},
   718  	"decoderawtransaction":   {(*btcjson.TxRawDecodeResult)(nil)},
   719  	"decodescript":           {(*btcjson.DecodeScriptResult)(nil)},
   720  	"estimatefee":            {(*float64)(nil)},
   721  	"generate":               {(*[]string)(nil)},
   722  	"getaddednodeinfo":       {(*[]string)(nil), (*[]btcjson.GetAddedNodeInfoResult)(nil)},
   723  	"getbestblock":           {(*btcjson.GetBestBlockResult)(nil)},
   724  	"getbestblockhash":       {(*string)(nil)},
   725  	"getblock":               {(*string)(nil), (*btcjson.GetBlockVerboseResult)(nil)},
   726  	"getblockcount":          {(*int64)(nil)},
   727  	"getblockhash":           {(*string)(nil)},
   728  	"getblockheader":         {(*string)(nil), (*btcjson.GetBlockHeaderVerboseResult)(nil)},
   729  	"getblocktemplate":       {(*btcjson.GetBlockTemplateResult)(nil), (*string)(nil), nil},
   730  	"getblockchaininfo":      {(*btcjson.GetBlockChainInfoResult)(nil)},
   731  	"getcfilter":             {(*string)(nil)},
   732  	"getcfilterheader":       {(*string)(nil)},
   733  	"getconnectioncount":     {(*int32)(nil)},
   734  	"getcurrentnet":          {(*uint32)(nil)},
   735  	"getdifficulty":          {(*float64)(nil)},
   736  	"getgenerate":            {(*bool)(nil)},
   737  	"gethashespersec":        {(*float64)(nil)},
   738  	"getheaders":             {(*[]string)(nil)},
   739  	"getinfo":                {(*btcjson.InfoChainResult)(nil)},
   740  	"getmempoolinfo":         {(*btcjson.GetMempoolInfoResult)(nil)},
   741  	"getmininginfo":          {(*btcjson.GetMiningInfoResult)(nil)},
   742  	"getnettotals":           {(*btcjson.GetNetTotalsResult)(nil)},
   743  	"getnetworkhashps":       {(*int64)(nil)},
   744  	"getnodeaddresses":       {(*[]btcjson.GetNodeAddressesResult)(nil)},
   745  	"getpeerinfo":            {(*[]btcjson.GetPeerInfoResult)(nil)},
   746  	"getrawmempool":          {(*[]string)(nil), (*btcjson.GetRawMempoolVerboseResult)(nil)},
   747  	"getrawtransaction":      {(*string)(nil), (*btcjson.TxRawResult)(nil)},
   748  	"gettxout":               {(*btcjson.GetTxOutResult)(nil)},
   749  	"node":                   nil,
   750  	"help":                   {(*string)(nil), (*string)(nil)},
   751  	"ping":                   nil,
   752  	"searchrawtransactions":  {(*string)(nil), (*[]btcjson.SearchRawTransactionsResult)(nil)},
   753  	"sendrawtransaction":     {(*string)(nil)},
   754  	"setgenerate":            nil,
   755  	"signmessagewithprivkey": {(*string)(nil)},
   756  	"stop":                   {(*string)(nil)},
   757  	"submitblock":            {nil, (*string)(nil)},
   758  	"uptime":                 {(*int64)(nil)},
   759  	"validateaddress":        {(*btcjson.ValidateAddressChainResult)(nil)},
   760  	"verifychain":            {(*bool)(nil)},
   761  	"verifymessage":          {(*bool)(nil)},
   762  	"version":                {(*map[string]btcjson.VersionResult)(nil)},
   763  
   764  	// Websocket commands.
   765  	"loadtxfilter":              nil,
   766  	"session":                   {(*btcjson.SessionResult)(nil)},
   767  	"notifyblocks":              nil,
   768  	"stopnotifyblocks":          nil,
   769  	"notifynewtransactions":     nil,
   770  	"stopnotifynewtransactions": nil,
   771  	"notifyreceived":            nil,
   772  	"stopnotifyreceived":        nil,
   773  	"notifyspent":               nil,
   774  	"stopnotifyspent":           nil,
   775  	"rescan":                    nil,
   776  	"rescanblocks":              {(*[]btcjson.RescannedBlock)(nil)},
   777  }
   778  
   779  // helpCacher provides a concurrent safe type that provides help and usage for
   780  // the RPC server commands and caches the results for future calls.
   781  type helpCacher struct {
   782  	sync.Mutex
   783  	usage      string
   784  	methodHelp map[string]string
   785  }
   786  
   787  // rpcMethodHelp returns an RPC help string for the provided method.
   788  //
   789  // This function is safe for concurrent access.
   790  func (c *helpCacher) rpcMethodHelp(method string) (string, error) {
   791  	c.Lock()
   792  	defer c.Unlock()
   793  
   794  	// Return the cached method help if it exists.
   795  	if help, exists := c.methodHelp[method]; exists {
   796  		return help, nil
   797  	}
   798  
   799  	// Look up the result types for the method.
   800  	resultTypes, ok := rpcResultTypes[method]
   801  	if !ok {
   802  		return "", errors.New("no result types specified for method " +
   803  			method)
   804  	}
   805  
   806  	// Generate, cache, and return the help.
   807  	help, err := btcjson.GenerateHelp(method, helpDescsEnUS, resultTypes...)
   808  	if err != nil {
   809  		return "", err
   810  	}
   811  	c.methodHelp[method] = help
   812  	return help, nil
   813  }
   814  
   815  // rpcUsage returns one-line usage for all support RPC commands.
   816  //
   817  // This function is safe for concurrent access.
   818  func (c *helpCacher) rpcUsage(includeWebsockets bool) (string, error) {
   819  	c.Lock()
   820  	defer c.Unlock()
   821  
   822  	// Return the cached usage if it is available.
   823  	if c.usage != "" {
   824  		return c.usage, nil
   825  	}
   826  
   827  	// Generate a list of one-line usage for every command.
   828  	usageTexts := make([]string, 0, len(rpcHandlers))
   829  	for k := range rpcHandlers {
   830  		usage, err := btcjson.MethodUsageText(k)
   831  		if err != nil {
   832  			return "", err
   833  		}
   834  		usageTexts = append(usageTexts, usage)
   835  	}
   836  
   837  	// Include websockets commands if requested.
   838  	if includeWebsockets {
   839  		for k := range wsHandlers {
   840  			usage, err := btcjson.MethodUsageText(k)
   841  			if err != nil {
   842  				return "", err
   843  			}
   844  			usageTexts = append(usageTexts, usage)
   845  		}
   846  	}
   847  
   848  	sort.Strings(usageTexts)
   849  	c.usage = strings.Join(usageTexts, "\n")
   850  	return c.usage, nil
   851  }
   852  
   853  // newHelpCacher returns a new instance of a help cacher which provides help and
   854  // usage for the RPC server commands and caches the results for future calls.
   855  func newHelpCacher() *helpCacher {
   856  	return &helpCacher{
   857  		methodHelp: make(map[string]string),
   858  	}
   859  }