refactor: prefer snake case, TxToUniv arg hashBlock renamed block_hash

This commit is contained in:
Michael Dietz
2021-09-29 09:58:36 -05:00
committed by fanquake
parent 828a094ecf
commit 22f25a6116
2 changed files with 5 additions and 4 deletions

View File

@@ -54,6 +54,6 @@ std::string FormatScript(const CScript& script);
std::string EncodeHexTx(const CTransaction& tx, const int serializeFlags = 0); std::string EncodeHexTx(const CTransaction& tx, const int serializeFlags = 0);
std::string SighashToStr(unsigned char sighash_type); std::string SighashToStr(unsigned char sighash_type);
void ScriptToUniv(const CScript& script, UniValue& out, bool include_hex = true, bool include_address = false); void ScriptToUniv(const CScript& script, UniValue& out, bool include_hex = true, bool include_address = false);
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex = true, int serialize_flags = 0, const CTxUndo* txundo = nullptr, TxVerbosity verbosity = TxVerbosity::SHOW_DETAILS); void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry, bool include_hex = true, int serialize_flags = 0, const CTxUndo* txundo = nullptr, TxVerbosity verbosity = TxVerbosity::SHOW_DETAILS);
#endif // BITCOIN_CORE_IO_H #endif // BITCOIN_CORE_IO_H

View File

@@ -164,7 +164,7 @@ void ScriptToUniv(const CScript& script, UniValue& out, bool include_hex, bool i
out.pushKV("type", GetTxnOutputType(type)); out.pushKV("type", GetTxnOutputType(type));
} }
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex, int serialize_flags, const CTxUndo* txundo, TxVerbosity verbosity) void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry, bool include_hex, int serialize_flags, const CTxUndo* txundo, TxVerbosity verbosity)
{ {
entry.pushKV("txid", tx.GetHash().GetHex()); entry.pushKV("txid", tx.GetHash().GetHex());
entry.pushKV("hash", tx.GetWitnessHash().GetHex()); entry.pushKV("hash", tx.GetWitnessHash().GetHex());
@@ -253,8 +253,9 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry,
entry.pushKV("fee", ValueFromAmount(fee)); entry.pushKV("fee", ValueFromAmount(fee));
} }
if (!hashBlock.IsNull()) if (!block_hash.IsNull()) {
entry.pushKV("blockhash", hashBlock.GetHex()); entry.pushKV("blockhash", block_hash.GetHex());
}
if (include_hex) { if (include_hex) {
entry.pushKV("hex", EncodeHexTx(tx, serialize_flags)); // The hex-encoded transaction. Used the name "hex" to be consistent with the verbose output of "getrawtransaction". entry.pushKV("hex", EncodeHexTx(tx, serialize_flags)); // The hex-encoded transaction. Used the name "hex" to be consistent with the verbose output of "getrawtransaction".