aboutsummaryrefslogtreecommitdiff
path: root/src/core_write.cpp
diff options
context:
space:
mode:
authorstickies-v <stickies-v@protonmail.com>2023-01-26 11:21:27 +0000
committerstickies-v <stickies-v@protonmail.com>2023-01-26 11:51:33 +0000
commita24e633339c45eaca28fc7af0488956332ac300c (patch)
treeaab6108f222d853cc21cfe500ca6c7f4e653862e /src/core_write.cpp
parent77a36033b5ecbf8dedb917d680f4116786fd7375 (diff)
downloadbitcoin-a24e633339c45eaca28fc7af0488956332ac300c.tar.xz
refactor: rpc: set TxToJSON default verbosity to SHOW_DETAILS
`TxToJSON()` and `TxToUniv()` are only to be called when we want to decode the transaction (i.e. its details) into JSON. If `TxVerbosity` is `SHOW_TXID`, the function should not have been (and currently is not) called in the first place. There is no behaviour change, current logic simply assumes anything less than `TxVerbosity::SHOW_DETAILS_AND_PREVOUT` equals `TxVerbosity::SHOW_DETAILS`. With this change, the assumptions and intent become more explicit.
Diffstat (limited to 'src/core_write.cpp')
-rw-r--r--src/core_write.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core_write.cpp b/src/core_write.cpp
index 91a6eb2864..300bd30e43 100644
--- a/src/core_write.cpp
+++ b/src/core_write.cpp
@@ -170,6 +170,8 @@ void ScriptToUniv(const CScript& script, UniValue& out, bool include_hex, bool i
void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry, bool include_hex, int serialize_flags, const CTxUndo* txundo, TxVerbosity verbosity)
{
+ CHECK_NONFATAL(verbosity >= TxVerbosity::SHOW_DETAILS);
+
entry.pushKV("txid", tx.GetHash().GetHex());
entry.pushKV("hash", tx.GetWitnessHash().GetHex());
// Transaction version is actually unsigned in consensus checks, just signed in memory,