| 1072 | } |
| 1073 | |
| 1074 | static RPCHelpMan getblock() |
| 1075 | { |
| 1076 | return RPCHelpMan{"getblock", |
| 1077 | "\nIf verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.\n" |
| 1078 | "If verbosity is 1, returns an Object with information about block <hash>.\n" |
| 1079 | "If verbosity is 2, returns an Object with information about block <hash> and information about each transaction.\n" |
| 1080 | "If verbosity is 3, returns an Object with information about block <hash> and information about each transaction, including prevout information for inputs (only for unpruned blocks in the current best chain).\n", |
| 1081 | { |
| 1082 | {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The block hash"}, |
| 1083 | {"verbosity|verbose", RPCArg::Type::NUM, RPCArg::Default{1}, "0 for hex-encoded data, 1 for a JSON object, 2 for JSON object with transaction data, and 3 for JSON object with transaction data including prevout information for inputs"}, |
| 1084 | }, |
| 1085 | { |
| 1086 | RPCResult{"for verbosity = 0", |
| 1087 | RPCResult::Type::STR_HEX, "", "A string that is serialized, hex-encoded data for block 'hash'"}, |
| 1088 | RPCResult{"for verbosity = 1", |
| 1089 | RPCResult::Type::OBJ, "", "", |
| 1090 | { |
| 1091 | {RPCResult::Type::STR_HEX, "hash", "the block hash (same as provided)"}, |
| 1092 | {RPCResult::Type::NUM, "confirmations", "The number of confirmations, or -1 if the block is not on the main chain"}, |
| 1093 | {RPCResult::Type::NUM, "size", "The block size"}, |
| 1094 | {RPCResult::Type::NUM, "strippedsize", "The block size excluding witness data"}, |
| 1095 | {RPCResult::Type::NUM, "weight", "The block weight as defined in BIP 141"}, |
| 1096 | {RPCResult::Type::NUM, "height", "The block height or index"}, |
| 1097 | {RPCResult::Type::NUM, "version", "The block version"}, |
| 1098 | {RPCResult::Type::STR_HEX, "versionHex", "The block version formatted in hexadecimal"}, |
| 1099 | {RPCResult::Type::STR_HEX, "merkleroot", "The merkle root"}, |
| 1100 | {RPCResult::Type::ARR, "tx", "The transaction ids", |
| 1101 | {{RPCResult::Type::STR_HEX, "", "The transaction id"}}}, |
| 1102 | {RPCResult::Type::NUM_TIME, "time", "The block time expressed in " + UNIX_EPOCH_TIME}, |
| 1103 | {RPCResult::Type::NUM_TIME, "mediantime", "The median block time expressed in " + UNIX_EPOCH_TIME}, |
| 1104 | {RPCResult::Type::NUM, "nonce", "The nonce"}, |
| 1105 | {RPCResult::Type::STR_HEX, "bits", "The bits"}, |
| 1106 | {RPCResult::Type::NUM, "difficulty", "The difficulty"}, |
| 1107 | {RPCResult::Type::STR_HEX, "chainwork", "Expected number of hashes required to produce the chain up to this block (in hex)"}, |
| 1108 | {RPCResult::Type::NUM, "nTx", "The number of transactions in the block"}, |
| 1109 | {RPCResult::Type::STR, "signblock_witness_asm", "ASM of sign block witness data"}, |
| 1110 | {RPCResult::Type::STR_HEX, "signblock_witness_hex", "Hex of sign block witness data"}, |
| 1111 | {RPCResult::Type::OBJ, "dynamic_parameters", "Dynamic federation parameters in the block, if any", |
| 1112 | { |
| 1113 | {RPCResult::Type::OBJ, "current", "enforced dynamic federation parameters. The signblockscript is published for each block, while others are published only at epoch start", |
| 1114 | { |
| 1115 | {RPCResult::Type::STR_HEX, "signblockscript", "signblock script"}, |
| 1116 | {RPCResult::Type::NUM, "max_block_witness", "Maximum serialized size of the block witness stack"}, |
| 1117 | {RPCResult::Type::STR_HEX, "fedpegscript", "fedpeg script"}, |
| 1118 | {RPCResult::Type::ARR, "extension_space", "array of hex-encoded strings", |
| 1119 | { |
| 1120 | {RPCResult::Type::ELISION, "", ""} |
| 1121 | }}, |
| 1122 | }}, |
| 1123 | {RPCResult::Type::OBJ, "proposed", "Proposed parameters. Uninforced. Must be published in full", |
| 1124 | { |
| 1125 | {RPCResult::Type::ELISION, "", "same entries as current"} |
| 1126 | }}, |
| 1127 | }}, |
| 1128 | {RPCResult::Type::STR_HEX, "previousblockhash", /*optional=*/true, "The hash of the previous block (if available)"}, |
| 1129 | {RPCResult::Type::STR_HEX, "nextblockhash", /*optional=*/true, "The hash of the next block (if available)"}, |
| 1130 | }}, |
| 1131 | RPCResult{"for verbosity = 2", |
nothing calls this directly
no test coverage detected