@@ -80,6 +80,17 @@ static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue&
80
80
}
81
81
}
82
82
83
+ static std::vector<RPCResult> ScriptPubKeyDoc () {
84
+ return
85
+ {
86
+ {RPCResult::Type::STR, " asm" , " Disassembly of the public key script" },
87
+ {RPCResult::Type::STR, " desc" , " Inferred descriptor for the output" },
88
+ {RPCResult::Type::STR_HEX, " hex" , " The raw public key script bytes, hex-encoded" },
89
+ {RPCResult::Type::STR, " address" , /* optional=*/ true , " The Bitcoin address (only if a well-defined address exists)" },
90
+ {RPCResult::Type::STR, " type" , " The type (one of: " + GetAllOutputTypes () + " )" },
91
+ };
92
+ }
93
+
83
94
static std::vector<RPCResult> DecodeTxDoc (const std::string& txid_field_doc)
84
95
{
85
96
return {
@@ -115,14 +126,7 @@ static std::vector<RPCResult> DecodeTxDoc(const std::string& txid_field_doc)
115
126
{
116
127
{RPCResult::Type::STR_AMOUNT, " value" , " The value in " + CURRENCY_UNIT},
117
128
{RPCResult::Type::NUM, " n" , " index" },
118
- {RPCResult::Type::OBJ, " scriptPubKey" , " " ,
119
- {
120
- {RPCResult::Type::STR, " asm" , " Disassembly of the public key script" },
121
- {RPCResult::Type::STR, " desc" , " Inferred descriptor for the output" },
122
- {RPCResult::Type::STR_HEX, " hex" , " The raw public key script bytes, hex-encoded" },
123
- {RPCResult::Type::STR, " type" , " The type, eg 'pubkeyhash'" },
124
- {RPCResult::Type::STR, " address" , /* optional=*/ true , " The Bitcoin address (only if a well-defined address exists)" },
125
- }},
129
+ {RPCResult::Type::OBJ, " scriptPubKey" , " " , ScriptPubKeyDoc ()},
126
130
}},
127
131
}},
128
132
};
@@ -177,8 +181,8 @@ static RPCHelpMan getrawtransaction()
177
181
" Hint: Use gettransaction for wallet transactions.\n\n "
178
182
179
183
" If verbosity is 0 or omitted, returns the serialized transaction as a hex-encoded string.\n "
180
- " If verbosity is 1, returns a JSON Object with information about transaction.\n "
181
- " If verbosity is 2, returns a JSON Object with information about transaction, including fee and prevout information." ,
184
+ " If verbosity is 1, returns a JSON Object with information about the transaction.\n "
185
+ " If verbosity is 2, returns a JSON Object with information about the transaction, including fee and prevout information." ,
182
186
{
183
187
{" txid" , RPCArg::Type::STR_HEX, RPCArg::Optional::NO, " The transaction id" },
184
188
{" verbosity|verbose" , RPCArg::Type::NUM, RPCArg::Default{0 }, " 0 for hex-encoded data, 1 for a JSON object, and 2 for JSON object with fee and prevout" },
@@ -189,7 +193,6 @@ static RPCHelpMan getrawtransaction()
189
193
RPCResult::Type::STR, " data" , " The serialized transaction as a hex-encoded string for 'txid'"
190
194
},
191
195
RPCResult{" if verbosity is set to 1" ,
192
- // When updating this documentation, update `decoderawtransaction` in the same way.
193
196
RPCResult::Type::OBJ, " " , " " ,
194
197
Cat<std::vector<RPCResult>>(
195
198
{
@@ -206,25 +209,18 @@ static RPCHelpMan getrawtransaction()
206
209
RPCResult::Type::OBJ, " " , " " ,
207
210
{
208
211
{RPCResult::Type::ELISION, " " , " Same output as verbosity = 1" },
209
- {RPCResult::Type::NUM, " fee" , /* optional */ true , " transaction fee in " + CURRENCY_UNIT + " , omitted if block undo data is not available" },
212
+ {RPCResult::Type::NUM, " fee" , /* optional= */ true , " transaction fee in " + CURRENCY_UNIT + " , omitted if block undo data is not available" },
210
213
{RPCResult::Type::ARR, " vin" , " " ,
211
214
{
212
- {RPCResult::Type::OBJ, " " , /* optional */ true , " utxo being spent, omitted if block undo data is not available" ,
215
+ {RPCResult::Type::OBJ, " " , " utxo being spent, omitted if block undo data is not available" ,
213
216
{
214
217
{RPCResult::Type::ELISION, " " , " Same output as verbosity = 1" },
215
- {RPCResult::Type::OBJ, " prevout" , " Only if undo information is available)" ,
218
+ {RPCResult::Type::OBJ, " prevout" , /* optional= */ true , " Only if undo information is available)" ,
216
219
{
217
220
{RPCResult::Type::BOOL, " generated" , " Coinbase or not" },
218
221
{RPCResult::Type::NUM, " height" , " The height of the prevout" },
219
222
{RPCResult::Type::STR_AMOUNT, " value" , " The value in " + CURRENCY_UNIT},
220
- {RPCResult::Type::OBJ, " scriptPubKey" , " " ,
221
- {
222
- {RPCResult::Type::STR, " asm" , " Disassembly of the public key script" },
223
- {RPCResult::Type::STR, " desc" , " Inferred descriptor for the output" },
224
- {RPCResult::Type::STR_HEX, " hex" , " The raw public key script bytes, hex-encoded" },
225
- {RPCResult::Type::STR, " address" , /* optional=*/ true , " The Bitcoin address (only if a well-defined address exists)" },
226
- {RPCResult::Type::STR, " type" , " The type (one of: " + GetAllOutputTypes () + " )" },
227
- }},
223
+ {RPCResult::Type::OBJ, " scriptPubKey" , " " , ScriptPubKeyDoc ()},
228
224
}},
229
225
}},
230
226
}},
0 commit comments