Skip to content

Commit 8b9efeb

Browse files
mjdietzxfanquake
authored andcommitted
refactor: use named args when ScriptToUniv or TxToUniv are invoked
1 parent 22f25a6 commit 8b9efeb

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

src/bitcoin-tx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ static void MutateTx(CMutableTransaction& tx, const std::string& command,
750750
static void OutputTxJSON(const CTransaction& tx)
751751
{
752752
UniValue entry(UniValue::VOBJ);
753-
TxToUniv(tx, uint256(), entry);
753+
TxToUniv(tx, /*block_hash=*/uint256(), entry);
754754

755755
std::string jsonOutput = entry.write(4);
756756
tfm::format(std::cout, "%s\n", jsonOutput);

src/rest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ static bool rest_tx(const std::any& context, HTTPRequest* req, const std::string
670670

671671
case RetFormat::JSON: {
672672
UniValue objTx(UniValue::VOBJ);
673-
TxToUniv(*tx, hashBlock, objTx);
673+
TxToUniv(*tx, /*block_hash=*/hashBlock, /*entry=*/ objTx);
674674
std::string strJSON = objTx.write() + "\n";
675675
req->WriteHeader("Content-Type", "application/json");
676676
req->WriteReply(HTTP_OK, strJSON);

src/rpc/blockchain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* tip, const CBlockIn
187187
// coinbase transaction (i.e. i == 0) doesn't have undo data
188188
const CTxUndo* txundo = (have_undo && i > 0) ? &blockUndo.vtxundo.at(i - 1) : nullptr;
189189
UniValue objTx(UniValue::VOBJ);
190-
TxToUniv(*tx, uint256(), objTx, true, RPCSerializationFlags(), txundo, verbosity);
190+
TxToUniv(*tx, /*block_hash=*/uint256(), /*entry=*/objTx, /*include_hex=*/true, RPCSerializationFlags(), txundo, verbosity);
191191
txs.push_back(objTx);
192192
}
193193
break;

src/rpc/rawtransaction.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue&
5858
// Blockchain contextual information (confirmations and blocktime) is not
5959
// available to code in bitcoin-common, so we query them here and push the
6060
// data into the returned UniValue.
61-
TxToUniv(tx, uint256(), entry, true, RPCSerializationFlags());
61+
TxToUniv(tx, /*block_hash=*/uint256(), entry, /*include_hex=*/true, RPCSerializationFlags());
6262

6363
if (!hashBlock.IsNull()) {
6464
LOCK(cs_main);
@@ -383,7 +383,7 @@ static RPCHelpMan decoderawtransaction()
383383
}
384384

385385
UniValue result(UniValue::VOBJ);
386-
TxToUniv(CTransaction(std::move(mtx)), uint256(), result, false);
386+
TxToUniv(CTransaction(std::move(mtx)), /*block_hash=*/uint256(), /*entry=*/result, /*include_hex=*/false);
387387

388388
return result;
389389
},
@@ -900,7 +900,7 @@ static RPCHelpMan decodepsbt()
900900

901901
// Add the decoded tx
902902
UniValue tx_univ(UniValue::VOBJ);
903-
TxToUniv(CTransaction(*psbtx.tx), uint256(), tx_univ, false);
903+
TxToUniv(CTransaction(*psbtx.tx), /*block_hash=*/uint256(), /*entry=*/tx_univ, /*include_hex=*/false);
904904
result.pushKV("tx", tx_univ);
905905

906906
// Add the global xpubs
@@ -970,7 +970,7 @@ static RPCHelpMan decodepsbt()
970970
txout = input.non_witness_utxo->vout[psbtx.tx->vin[i].prevout.n];
971971

972972
UniValue non_wit(UniValue::VOBJ);
973-
TxToUniv(*input.non_witness_utxo, uint256(), non_wit, false);
973+
TxToUniv(*input.non_witness_utxo, /*block_hash=*/uint256(), /*entry=*/non_wit, /*include_hex=*/false);
974974
in.pushKV("non_witness_utxo", non_wit);
975975

976976
have_a_utxo = true;
@@ -1003,12 +1003,12 @@ static RPCHelpMan decodepsbt()
10031003
// Redeem script and witness script
10041004
if (!input.redeem_script.empty()) {
10051005
UniValue r(UniValue::VOBJ);
1006-
ScriptToUniv(input.redeem_script, r);
1006+
ScriptToUniv(input.redeem_script, /*out=*/r);
10071007
in.pushKV("redeem_script", r);
10081008
}
10091009
if (!input.witness_script.empty()) {
10101010
UniValue r(UniValue::VOBJ);
1011-
ScriptToUniv(input.witness_script, r);
1011+
ScriptToUniv(input.witness_script, /*out=*/r);
10121012
in.pushKV("witness_script", r);
10131013
}
10141014

@@ -1113,12 +1113,12 @@ static RPCHelpMan decodepsbt()
11131113
// Redeem script and witness script
11141114
if (!output.redeem_script.empty()) {
11151115
UniValue r(UniValue::VOBJ);
1116-
ScriptToUniv(output.redeem_script, r);
1116+
ScriptToUniv(output.redeem_script, /*out=*/r);
11171117
out.pushKV("redeem_script", r);
11181118
}
11191119
if (!output.witness_script.empty()) {
11201120
UniValue r(UniValue::VOBJ);
1121-
ScriptToUniv(output.witness_script, r);
1121+
ScriptToUniv(output.witness_script, /*out=*/r);
11221122
out.pushKV("witness_script", r);
11231123
}
11241124

src/test/fuzz/transaction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,6 @@ FUZZ_TARGET_INIT(transaction, initialize_transaction)
102102
(void)IsWitnessStandard(tx, coins_view_cache);
103103

104104
UniValue u(UniValue::VOBJ);
105-
TxToUniv(tx, /*hashBlock=*/uint256::ZERO, u);
106-
TxToUniv(tx, /*hashBlock=*/uint256::ONE, u);
105+
TxToUniv(tx, /*block_hash=*/uint256::ZERO, /*entry=*/u);
106+
TxToUniv(tx, /*block_hash=*/uint256::ONE, /*entry=*/u);
107107
}

src/wallet/rpc/transactions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ RPCHelpMan gettransaction()
800800

801801
if (verbose) {
802802
UniValue decoded(UniValue::VOBJ);
803-
TxToUniv(*wtx.tx, uint256(), decoded, false);
803+
TxToUniv(*wtx.tx, /*block_hash=*/uint256(), /*entry=*/decoded, /*include_hex=*/false);
804804
entry.pushKV("decoded", decoded);
805805
}
806806

0 commit comments

Comments
 (0)