Skip to content

Commit f20b416

Browse files
committed
[RPC] add vout.n sequence number to decoderawtransaction
1 parent 259177a commit f20b416

File tree

2 files changed

+32
-26
lines changed

2 files changed

+32
-26
lines changed

src/core_write.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ void OutputToJSON(uint256 &txid, int i,
170170
CTxOutStandard *s = (CTxOutStandard*) baseOut;
171171
entry.pushKV("value", ValueFromAmount(s->nValue));
172172
entry.pushKV("valueSat", s->nValue);
173+
entry.pushKV("vout.n", i);
173174
UniValue o(UniValue::VOBJ);
174175
ScriptPubKeyToUniv(s->scriptPubKey, o, true);
175176
entry.pushKV("scriptPubKey", o);
@@ -180,6 +181,7 @@ void OutputToJSON(uint256 &txid, int i,
180181
CTxOutData *s = (CTxOutData*) baseOut;
181182
entry.pushKV("type", "data");
182183
entry.pushKV("data_hex", HexStr(s->vData.begin(), s->vData.end()));
184+
entry.pushKV("vout.n", i);
183185
CAmount nValue;
184186
if (s->GetCTFee(nValue))
185187
entry.pushKV("ct_fee", ValueFromAmount(nValue));
@@ -190,6 +192,7 @@ void OutputToJSON(uint256 &txid, int i,
190192
CTxOutCT *s = (CTxOutCT*) baseOut;
191193
entry.pushKV("type", "blind");
192194
entry.pushKV("valueCommitment", HexStr(&s->commitment.data[0], &s->commitment.data[0]+33));
195+
entry.pushKV("vout.n", i);
193196
UniValue o(UniValue::VOBJ);
194197
ScriptPubKeyToUniv(s->scriptPubKey, o, true);
195198
entry.pushKV("scriptPubKey", o);
@@ -202,6 +205,7 @@ void OutputToJSON(uint256 &txid, int i,
202205
{
203206
CTxOutRingCT *s = (CTxOutRingCT*) baseOut;
204207
entry.pushKV("type", "ringct");
208+
entry.pushKV("vout.n", i);
205209
entry.pushKV("pubkey", HexStr(s->pk.begin(), s->pk.end()));
206210
entry.pushKV("valueCommitment", HexStr(&s->commitment.data[0], &s->commitment.data[0]+33));
207211
entry.pushKV("data_hex", HexStr(s->vData.begin(), s->vData.end()));

src/rpc/rawtransaction.cpp

+28-26
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,22 @@ static UniValue getrawtransaction(const JSONRPCRequest& request)
9494

9595
"\nResult (if verbose is set to true):\n"
9696
"{\n"
97-
" \"in_active_chain\": b, (bool) Whether specified block is in the active chain or not (only present with explicit \"blockhash\" argument)\n"
98-
" \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n"
99-
" \"txid\" : \"id\", (string) The transaction id (same as provided)\n"
100-
" \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions)\n"
97+
" \"in_active_chain\": (bool) Whether specified block is in the active chain or not (only present with explicit \"blockhash\" argument)\n"
98+
" \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n"
99+
" \"txid\" : \"id\", (string) The transaction id (same as provided)\n"
100+
" \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions)\n"
101101
" \"size\" : n, (numeric) The serialized transaction size\n"
102102
" \"vsize\" : n, (numeric) The virtual transaction size (differs from size for witness transactions)\n"
103103
" \"weight\" : n, (numeric) The transaction's weight (between vsize*4-3 and vsize*4)\n"
104104
" \"version\" : n, (numeric) The version\n"
105105
" \"locktime\" : ttt, (numeric) The lock time\n"
106106
" \"vin\" : [ (array of json objects)\n"
107107
" {\n"
108-
" \"txid\": \"id\", (string) The transaction id\n"
108+
" \"txid\": \"id\", (string) The transaction id\n"
109109
" \"vout\": n, (numeric) \n"
110110
" \"scriptSig\": { (json object) The script\n"
111-
" \"asm\": \"asm\", (string) asm\n"
112-
" \"hex\": \"hex\" (string) hex\n"
111+
" \"asm\": \"asm\", (string) asm\n"
112+
" \"hex\": \"hex\" (string) hex\n"
113113
" },\n"
114114
" \"sequence\": n (numeric) The script sequence number\n"
115115
" \"txinwitness\": [\"hex\", ...] (array of string) hex-encoded witness data (if any)\n"
@@ -118,22 +118,23 @@ static UniValue getrawtransaction(const JSONRPCRequest& request)
118118
" ],\n"
119119
" \"vout\" : [ (array of json objects)\n"
120120
" {\n"
121-
" \"value\" : x.xxx, (numeric) The value in " + CURRENCY_UNIT + "\n"
122-
" \"n\" : n, (numeric) index\n"
123-
" \"scriptPubKey\" : { (json object)\n"
121+
" \"value\" : x.xxx, (numeric) The value in " + CURRENCY_UNIT + "\n"
122+
" \"valueSat\" : x.xxx, (numeric) The sat value in " + CURRENCY_UNIT + "\n"
123+
" \"vout.n\" : n, (numeric) index\n"
124+
" \"scriptPubKey\" : { (json object)\n"
124125
" \"asm\" : \"asm\", (string) the asm\n"
125126
" \"hex\" : \"hex\", (string) the hex\n"
126-
" \"reqSigs\" : n, (numeric) The required sigs\n"
127+
" \"reqSigs\" : n, (numeric) The required sigs\n"
127128
" \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n"
128-
" \"addresses\" : [ (json array of string)\n"
129-
" \"address\" (string) veil address\n"
129+
" \"addresses\" : [ (json array of string)\n"
130+
" \"address\" (string) veil address\n"
130131
" ,...\n"
131132
" ]\n"
132133
" }\n"
133134
" }\n"
134135
" ,...\n"
135136
" ],\n"
136-
" \"blockhash\" : \"hash\", (string) the block hash\n"
137+
" \"blockhash\" : \"hash\", (string) The block hash\n"
137138
" \"confirmations\" : n, (numeric) The confirmations\n"
138139
" \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT)\n"
139140
" \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
@@ -519,42 +520,43 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
519520
"\nReturn a JSON object representing the serialized, hex-encoded transaction.\n"
520521

521522
"\nArguments:\n"
522-
"1. \"hexstring\" (string, required) The transaction hex string\n"
523+
"1. \"hexstring\" (string, required) The transaction hex string\n"
523524
"2. iswitness (boolean, optional) Whether the transaction hex is a serialized witness transaction\n"
524525
" If iswitness is not present, heuristic tests will be used in decoding\n"
525526

526527
"\nResult:\n"
527528
"{\n"
528-
" \"txid\" : \"id\", (string) The transaction id\n"
529-
" \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions)\n"
529+
" \"txid\" : \"id\", (string) The transaction id\n"
530+
" \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions)\n"
530531
" \"size\" : n, (numeric) The transaction size\n"
531532
" \"vsize\" : n, (numeric) The virtual transaction size (differs from size for witness transactions)\n"
532533
" \"weight\" : n, (numeric) The transaction's weight (between vsize*4 - 3 and vsize*4)\n"
533534
" \"version\" : n, (numeric) The version\n"
534535
" \"locktime\" : ttt, (numeric) The lock time\n"
535536
" \"vin\" : [ (array of json objects)\n"
536537
" {\n"
537-
" \"txid\": \"id\", (string) The transaction id\n"
538+
" \"txid\": \"id\", (string) The transaction id\n"
538539
" \"vout\": n, (numeric) The output number\n"
539540
" \"scriptSig\": { (json object) The script\n"
540-
" \"asm\": \"asm\", (string) asm\n"
541-
" \"hex\": \"hex\" (string) hex\n"
541+
" \"asm\": \"asm\", (string) asm\n"
542+
" \"hex\": \"hex\" (string) hex\n"
542543
" },\n"
543544
" \"txinwitness\": [\"hex\", ...] (array of string) hex-encoded witness data (if any)\n"
544-
" \"sequence\": n (numeric) The script sequence number\n"
545+
" \"sequence\": n (numeric) The script sequence number\n"
545546
" }\n"
546547
" ,...\n"
547548
" ],\n"
548549
" \"vout\" : [ (array of json objects)\n"
549550
" {\n"
550-
" \"value\" : x.xxx, (numeric) The value in " + CURRENCY_UNIT + "\n"
551-
" \"n\" : n, (numeric) index\n"
552-
" \"scriptPubKey\" : { (json object)\n"
551+
" \"value\" : x.xxx, (numeric) The value in " + CURRENCY_UNIT + "\n"
552+
" \"valueSat\" : x.xxx, (numeric) The sat value in " + CURRENCY_UNIT + "\n"
553+
" \"vout.n\" : n, (numeric) index\n"
554+
" \"scriptPubKey\" : { (json object)\n"
553555
" \"asm\" : \"asm\", (string) the asm\n"
554556
" \"hex\" : \"hex\", (string) the hex\n"
555-
" \"reqSigs\" : n, (numeric) The required sigs\n"
557+
" \"reqSigs\" : n, (numeric) The required sigs\n"
556558
" \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n"
557-
" \"addresses\" : [ (json array of string)\n"
559+
" \"addresses\" : [ (json array of string)\n"
558560
" \"12tvKAXCxZjSmdNbao16dKXC8tRWfcF5oc\" (string) veil address\n"
559561
" ,...\n"
560562
" ]\n"

0 commit comments

Comments
 (0)