| 64 | } |
| 65 | |
| 66 | static UniValue getrawtransaction(const JSONRPCRequest& request) |
| 67 | { |
| 68 | if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) |
| 69 | throw std::runtime_error( |
| 70 | "getrawtransaction \"txid\" ( verbose \"blockhash\" )\n" |
| 71 | |
| 72 | "\nNOTE: By default this function only works for mempool transactions. If the -txindex option is\n" |
| 73 | "enabled, it also works for blockchain transactions. If the block which contains the transaction\n" |
| 74 | "is known, its hash can be provided even for nodes without -txindex. Note that if a blockhash is\n" |
| 75 | "provided, only that block will be searched and if the transaction is in the mempool or other\n" |
| 76 | "blocks, or if this node does not have the given block available, the transaction will not be found.\n" |
| 77 | "DEPRECATED: for now, it also works for transactions with unspent outputs.\n" |
| 78 | |
| 79 | "\nReturn the raw transaction data.\n" |
| 80 | "\nIf verbose is 'true', returns an Object with information about 'txid'.\n" |
| 81 | "If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.\n" |
| 82 | |
| 83 | "\nArguments:\n" |
| 84 | "1. \"txid\" (string, required) The transaction id\n" |
| 85 | "2. verbose (bool, optional, default=false) If false, return a string, otherwise return a json object\n" |
| 86 | "3. \"blockhash\" (string, optional) The block in which to look for the transaction\n" |
| 87 | |
| 88 | "\nResult (if verbose is not set or set to false):\n" |
| 89 | "\"data\" (string) The serialized, hex-encoded data for 'txid'\n" |
| 90 | |
| 91 | "\nResult (if verbose is set to true):\n" |
| 92 | "{\n" |
| 93 | " \"in_active_chain\": b, (bool) Whether specified block is in the active chain or not (only present with explicit \"blockhash\" argument)\n" |
| 94 | " \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n" |
| 95 | " \"txid\" : \"id\", (string) The transaction id (same as provided)\n" |
| 96 | " \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions)\n" |
| 97 | " \"size\" : n, (numeric) The serialized transaction size\n" |
| 98 | " \"vsize\" : n, (numeric) The virtual transaction size (differs from size for witness transactions)\n" |
| 99 | " \"weight\" : n, (numeric) The transaction's weight (between vsize*4-3 and vsize*4)\n" |
| 100 | " \"version\" : n, (numeric) The version\n" |
| 101 | " \"locktime\" : ttt, (numeric) The lock time\n" |
| 102 | " \"vin\" : [ (array of json objects)\n" |
| 103 | " {\n" |
| 104 | " \"txid\": \"id\", (string) The transaction id\n" |
| 105 | " \"vout\": n, (numeric) \n" |
| 106 | " \"scriptSig\": { (json object) The script\n" |
| 107 | " \"asm\": \"asm\", (string) asm\n" |
| 108 | " \"hex\": \"hex\" (string) hex\n" |
| 109 | " },\n" |
| 110 | " \"sequence\": n (numeric) The script sequence number\n" |
| 111 | " \"txinwitness\": [\"hex\", ...] (array of string) hex-encoded witness data (if any)\n" |
| 112 | " }\n" |
| 113 | " ,...\n" |
| 114 | " ],\n" |
| 115 | " \"vout\" : [ (array of json objects)\n" |
| 116 | " {\n" |
| 117 | " \"value\" : x.xxx, (numeric) The value in " + CURRENCY_UNIT + "\n" |
| 118 | " \"n\" : n, (numeric) index\n" |
| 119 | " \"scriptPubKey\" : { (json object)\n" |
| 120 | " \"asm\" : \"asm\", (string) the asm\n" |
| 121 | " \"hex\" : \"hex\", (string) the hex\n" |
| 122 | " \"reqSigs\" : n, (numeric) The required sigs\n" |
| 123 | " \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n" |
nothing calls this directly
no test coverage detected