Skip to content

Commit 1bdd5f6

Browse files
committed
Address review comments from #22918
* fix English in release notes * Simplify `switch` to `if`.
1 parent 0ccf9b2 commit 1bdd5f6

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

doc/release-notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Updated RPCs
8282
`gettransaction verbose=true` and REST endpoints `/rest/tx`, `/rest/getutxos`,
8383
`/rest/block` no longer return the `addresses` and `reqSigs` fields, which
8484
were previously deprecated in 22.0. (#22650)
85-
- The `getblock` RPC command now supports verbose level 3 containing transaction inputs
85+
- The `getblock` RPC command now supports verbosity level 3 containing transaction inputs'
8686
`prevout` information. The existing `/rest/block/` REST endpoint is modified to contain
8787
this information too. Every `vin` field will contain an additional `prevout` subfield
8888
describing the spent output. `prevout` contains the following keys:

src/core_write.cpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -208,22 +208,17 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry,
208208
const CTxOut& prev_txout = prev_coin.out;
209209

210210
amt_total_in += prev_txout.nValue;
211-
switch (verbosity) {
212-
case TxVerbosity::SHOW_TXID:
213-
case TxVerbosity::SHOW_DETAILS:
214-
break;
215211

216-
case TxVerbosity::SHOW_DETAILS_AND_PREVOUT:
217-
UniValue o_script_pub_key(UniValue::VOBJ);
218-
ScriptPubKeyToUniv(prev_txout.scriptPubKey, o_script_pub_key, /* includeHex */ true);
212+
if (verbosity == TxVerbosity::SHOW_DETAILS_AND_PREVOUT) {
213+
UniValue o_script_pub_key(UniValue::VOBJ);
214+
ScriptPubKeyToUniv(prev_txout.scriptPubKey, o_script_pub_key, /*include_hex=*/ true);
219215

220-
UniValue p(UniValue::VOBJ);
221-
p.pushKV("generated", bool(prev_coin.fCoinBase));
222-
p.pushKV("height", uint64_t(prev_coin.nHeight));
223-
p.pushKV("value", ValueFromAmount(prev_txout.nValue));
224-
p.pushKV("scriptPubKey", o_script_pub_key);
225-
in.pushKV("prevout", p);
226-
break;
216+
UniValue p(UniValue::VOBJ);
217+
p.pushKV("generated", bool(prev_coin.fCoinBase));
218+
p.pushKV("height", uint64_t(prev_coin.nHeight));
219+
p.pushKV("value", ValueFromAmount(prev_txout.nValue));
220+
p.pushKV("scriptPubKey", o_script_pub_key);
221+
in.pushKV("prevout", p);
227222
}
228223
}
229224
in.pushKV("sequence", (int64_t)txin.nSequence);

src/rpc/blockchain.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* tip, const CBlockIn
229229
TxToUniv(*tx, uint256(), objTx, true, RPCSerializationFlags(), txundo, verbosity);
230230
txs.push_back(objTx);
231231
}
232+
break;
232233
}
233234

234235
result.pushKV("tx", txs);

0 commit comments

Comments
 (0)