From 2b1fdc2c6ce1d0b0e51a3f107e23443c142d57af Mon Sep 17 00:00:00 2001 From: Michael Dietz Date: Mon, 10 May 2021 15:23:39 -0400 Subject: [PATCH] refactor: minor styling, prefer snake case and same line if --- src/core_io.h | 2 +- src/core_write.cpp | 7 +++---- src/rpc/rawtransaction.cpp | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/core_io.h b/src/core_io.h index dec0297637b..f00f1552490 100644 --- a/src/core_io.h +++ b/src/core_io.h @@ -44,7 +44,7 @@ UniValue ValueFromAmount(const CAmount amount); std::string FormatScript(const CScript& script); std::string EncodeHexTx(const CTransaction& tx, const int serializeFlags = 0); std::string SighashToStr(unsigned char sighash_type); -void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex, bool include_address = true); +void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool include_hex, bool include_address = true); void ScriptToUniv(const CScript& script, UniValue& out); void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex = true, int serialize_flags = 0, const CTxUndo* txundo = nullptr); diff --git a/src/core_write.cpp b/src/core_write.cpp index aa560806cdd..d92c970cb6c 100644 --- a/src/core_write.cpp +++ b/src/core_write.cpp @@ -143,16 +143,15 @@ std::string EncodeHexTx(const CTransaction& tx, const int serializeFlags) void ScriptToUniv(const CScript& script, UniValue& out) { - ScriptPubKeyToUniv(script, out, /* fIncludeHex */ true, /* include_address */ false); + ScriptPubKeyToUniv(script, out, /* include_hex */ true, /* include_address */ false); } -void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex, bool include_address) +void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool include_hex, bool include_address) { CTxDestination address; out.pushKV("asm", ScriptToAsmStr(scriptPubKey)); - if (fIncludeHex) - out.pushKV("hex", HexStr(scriptPubKey)); + if (include_hex) out.pushKV("hex", HexStr(scriptPubKey)); std::vector> solns; const TxoutType type{Solver(scriptPubKey, solns)}; diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 7d21c4f59b5..b32bc670b6f 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -572,7 +572,7 @@ static RPCHelpMan decodescript() } else { // Empty scripts are valid } - ScriptPubKeyToUniv(script, r, /* fIncludeHex */ false); + ScriptPubKeyToUniv(script, r, /* include_hex */ false); UniValue type; type = find_value(r, "type"); @@ -606,7 +606,7 @@ static RPCHelpMan decodescript() // Newer segwit program versions should be considered when then become available. segwitScr = GetScriptForDestination(WitnessV0ScriptHash(script)); } - ScriptPubKeyToUniv(segwitScr, sr, /* fIncludeHex */ true); + ScriptPubKeyToUniv(segwitScr, sr, /* include_hex */ true); sr.pushKV("p2sh-segwit", EncodeDestination(ScriptHash(segwitScr))); r.pushKV("segwit", sr); } @@ -1161,7 +1161,7 @@ static RPCHelpMan decodepsbt() txout = input.witness_utxo; UniValue o(UniValue::VOBJ); - ScriptPubKeyToUniv(txout.scriptPubKey, o, /* fIncludeHex */ true); + ScriptPubKeyToUniv(txout.scriptPubKey, o, /* include_hex */ true); UniValue out(UniValue::VOBJ); out.pushKV("amount", ValueFromAmount(txout.nValue));